{"id":14065404,"url":"https://github.com/xnuinside/table-meta","last_synced_at":"2025-07-20T09:32:23.506Z","repository":{"id":44966912,"uuid":"396306835","full_name":"xnuinside/table-meta","owner":"xnuinside","description":"Table Meta standard that used in fakeme library \u0026 OmyModels to unify data mapping for ORM, Python Models \u0026 ddl data","archived":false,"fork":false,"pushed_at":"2022-01-15T08:34:03.000Z","size":100,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-04T09:18:46.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xnuinside.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-15T10:08:07.000Z","updated_at":"2023-03-09T22:27:26.000Z","dependencies_parsed_at":"2022-09-19T08:50:34.216Z","dependency_job_id":null,"html_url":"https://github.com/xnuinside/table-meta","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xnuinside/table-meta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Ftable-meta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Ftable-meta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Ftable-meta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Ftable-meta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xnuinside","download_url":"https://codeload.github.com/xnuinside/table-meta/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Ftable-meta/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266100316,"owners_count":23876553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:04:28.521Z","updated_at":"2025-07-20T09:32:23.442Z","avatar_url":"https://github.com/xnuinside.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"### Table Meta\n\n\n![badge1](https://img.shields.io/pypi/v/table-meta) ![badge2](https://img.shields.io/pypi/l/table-meta) ![badge3](https://img.shields.io/pypi/pyversions/table-meta) [![Tests Pipeline](https://github.com/xnuinside/table-meta/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/xnuinside/table-meta/actions/workflows/main.yml?query=branch%3Amain)\n\n\nIt's a universal class that created to be a middleware, universal mapping for data from different parsers - simple-ddl-parser and py-models-parser.\n\nBased on this middleware 2 libraries are worked - omymodels \u0026 fakeme. \n\nIt's allow create 1 adapter for different inputs and produce output only on one standard - easy to maintain ad add different output variants.\n\nAll classes - Pydantic classes, so you can do with them anything that you can with Pydantic classes.\n\nLibrary contains 2 different classes - TableMeta - main class to convert input relative to models or tables. Second - Type, for Enum types data.\n\n### How it use\n\n## Install\n\n\n```bash\n\n    pip install table-meta\n\n```\n\n## Usage\n\n```python\n\nfrom table_meta import TableMeta\n\ndata = {your_table_definition}\n\ntable_data = TableMeta(**data)\n\n```\n\n### Convert simple-ddl-parser input to TableMeta\n\nSimple-ddl-parser: https://github.com/xnuinside/simple-ddl-parser\n\nPay attention that TableMeta expected data from simple-ddl-parser , that created with flag 'group_by_type=True'\nExample: result = DDLParser(ddl).run(group_by_type=True, output_mode=\"bigquery\")\n\nTo convert simple-ddl-parser output to TableMeta - use method: ddl_to_meta()\n\nUsage example:\n\n```python\n\n    from simple_ddl_parser import DDLParser\n    from table_meta import ddl_to_meta\n\n    ddl = \"your ddl\"\n    parser_result = DDLParser(ddl).run(group_by_type=True, output_mode=\"bigquery\")\n    data = ddl_to_meta(parser_result)\n\n    # ddl_to_meta returns Dict with 2 keys {\"tables\": [], \"types\": []} inside lists you will have Table Meta a models\n\n    print(data)\n\n```\n\n### Convert py-model-parser input to TableMeta\nPy-models-parser: https://github.com/xnuinside/py-models-parser\n\n\nUsage example:\n\n```python\n\n    from py_models_parser import parse\n    from table_meta import models_to_meta\n\n    model_from = \"your python models, supported by parser\"\n    result = parse(model_from)\n    data = models_to_meta(result)\n\n    # models_to_meta returns Dict with 2 keys {\"tables\": [], \"types\": []} inside lists you will have a Table Meta models\n\n    print(data)\n\n```\n\n\n## Changelog\n**v0.3.2**\n1. Added 'comment' attr to the Column\n\n**v0.3.0**\n1. Added search for type in columns with foreign keys from models \n2. Fixed issue with popylating Column details like unique or primary key from py-models-parser \n\n\n**v0.2.2**\n1. Added if_not_exists to table properties\n\n**v0.2.1**\n1. Added support for parsing 'dataset' from data as 'table_schema' also added fields like 'project' (to support BigQuery metadata)\n2. Depencencies updated\n3. Added HQL Table Properties\n\n**v0.1.5**\n1. field 'attrs' added to Type to store values from py-models-parser output\n\n**v0.1.3**\n1. 'parents' added to Type and to Table\n\n**v0.1.1**\n1. Fix dependencies for python 3.6\n\n**v0.1.0**\n\n1. Table Meta moved from O!MyModels to separate library. To make it re-usebale in fakeme library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Ftable-meta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxnuinside%2Ftable-meta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Ftable-meta/lists"}