{"id":37636362,"url":"https://github.com/shrinivdeshmukh/sqlalchemy-modelgen","last_synced_at":"2026-01-16T11:09:54.272Z","repository":{"id":53004572,"uuid":"353806373","full_name":"shrinivdeshmukh/sqlalchemy-modelgen","owner":"shrinivdeshmukh","description":"Create sqlalchemy python model files by defining tables and columns in a YAML file","archived":false,"fork":false,"pushed_at":"2021-06-20T06:41:15.000Z","size":546,"stargazers_count":30,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-30T01:25:59.902Z","etag":null,"topics":["database-migration","database-schema","schema-versions","yaml"],"latest_commit_sha":null,"homepage":"","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/shrinivdeshmukh.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-04-01T19:31:31.000Z","updated_at":"2025-02-05T13:42:28.000Z","dependencies_parsed_at":"2022-08-24T01:10:35.399Z","dependency_job_id":null,"html_url":"https://github.com/shrinivdeshmukh/sqlalchemy-modelgen","commit_stats":null,"previous_names":["shree14/sqlalchemy-modelgen"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shrinivdeshmukh/sqlalchemy-modelgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrinivdeshmukh%2Fsqlalchemy-modelgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrinivdeshmukh%2Fsqlalchemy-modelgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrinivdeshmukh%2Fsqlalchemy-modelgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrinivdeshmukh%2Fsqlalchemy-modelgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shrinivdeshmukh","download_url":"https://codeload.github.com/shrinivdeshmukh/sqlalchemy-modelgen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrinivdeshmukh%2Fsqlalchemy-modelgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database-migration","database-schema","schema-versions","yaml"],"created_at":"2026-01-16T11:09:53.561Z","updated_at":"2026-01-16T11:09:54.258Z","avatar_url":"https://github.com/shrinivdeshmukh.png","language":"Python","readme":"\n# sqlalchemy-modelgen\n\n[![codecov](https://codecov.io/gh/shrinivdeshmukh/sqlalchemy-modelgen/branch/main/graph/badge.svg?token=N0XQENE6IL)](https://codecov.io/gh/shrinivdeshmukh/sqlalchemy-modelgen)\n[![PyPI](https://img.shields.io/pypi/v/alchemy-modelgen)](https://pypi.org/project/alchemy-modelgen/)\n\n\nCreate sqlalchemy python model files by defining tables and columns in a yaml file or by specifying database url\n\n# Installation\n\n```\npip install alchemy-modelgen\n```\n\n# Usage\n\n\u003col\u003e\n\n**\u003cli\u003e Initialize modelgen folder:\u003c/li\u003e**\n\n```\nmodelgen init -d /path/to/YOUR_FOLDER\ncd /path/to/YOUR_FOLDER\n```\n\u003cbr /\u003e\n\n**\u003cli\u003e Create sqlalchemy model code from: \u003c/li\u003e** \n \n **(Option 1)** `yaml` template:\n\n**For details on how to write the yaml file, please follow [docs](https://github.com/shree14/sqlalchemy-modelgen/blob/main/docs/yaml_creation.md)**\n```\nmodelgen createmodel --source yaml --path templates/example.yaml --alembic # path to your schema yaml file \n```\n   **(Option 2)** existing `database`: \n```\nmodelgen createmodel --source database --path mysql+mysqlconnector://root:example@localhost:3306/modelgen --outfile models/YOUR_FILENAME.py --alembic\n```\n\u003cbr /\u003e\n\n**\u003cli\u003e Running alembic migrations:\u003c/li\u003e**\n\n```\nmodelgen migrate revision --autogenerate -m \"COMMIT_MESSAGE\" -p mysql+mysqlconnector://root:example@localhost:3306/modelgen\n\nmodelgen migrate upgrade head -p mysql+mysqlconnector://root:example@localhost:3306/modelgen\n```\n\nThe arguments passed after `modelgen migrate` are based on alembic. Any command true for `alembic` can be used with `modelgen migrate`.\n\n**The database url can be passed using `-p` or `--path` argument, or can be set in the environment by the env var `DATABASE_URI`. If `DATABASE_URI` is set, `-p` or `--path` will be ignored**\n\n\u003cbr /\u003e\n\n**\u003cli\u003e Alter table support:\u003c/li\u003e**\n\n* Change column type, length, add contraint, etc in the yaml file. Then run:\n```\nmodelgen createmodel --source yaml --path templates/example.yaml --alembic\nmodelgen migrate revision --autogenerate -m \"COMMIT_MESSAGE\" -p mysql+mysqlconnector://root:example@localhost:3306/modelgen\n\nmodelgen migrate upgrade head -p mysql+mysqlconnector://root:example@localhost:3306/modelgen\n```\n\n\u003col\u003e\n\n## Credits\n\n* The code that reads the structure of an existing database and generates the appropriate SQLAlchemy model code is based on [agronholm/sqlacodegen's](https://github.com/agronholm/sqlacodegen) repository (Copyright (c) Alex Grönholm), license: [MIT License](https://github.com/agronholm/sqlacodegen/blob/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrinivdeshmukh%2Fsqlalchemy-modelgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshrinivdeshmukh%2Fsqlalchemy-modelgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrinivdeshmukh%2Fsqlalchemy-modelgen/lists"}