{"repo":"nucccc/sqlmodelgen","free":true,"listed":false,"github":"https://github.com/nucccc/sqlmodelgen","clone":"git clone https://github.com/nucccc/sqlmodelgen.git","description":"sqlmodel classes code generation","language":"Python","stars":20,"topics":["codegen","codegeneration","codegenerator","postgresql","sql","sqlite","sqlmodel"],"license":"MIT","category":"databases-storage","readme_excerpt":"sqlmodelgen sqlmodelgen is a library to generate models for the sqlmodel library (repo, official docs). It accepts in input the following sources: direct CREATE TABLE sql statements sqlite file path postgres connection string mysql connection from the mysql-connector-python library Installation Available on PyPi, just run pip install sqlmodelgen Code generation from Postgres requires the separate postgres extension, installable with pip install sqlmodelgen[postgres] , while code generation from MySQL requires the separate mysql extension, installable with pip install sqlmodelgen[mysql] Usage sqlmodelgen can be used both as a command line tool and as a library providing functions that can be invoked in python. Generating from CREATE TABLE generates: Generating from SQLite Generating from Postgres The separate postgres extension is required, it can be installed with pip install sqlmodelgen[postgres] . Generating from MYSQL The separate mysql extension is required, it can be installed with pip install sqlmodelgen[mysql] . Relationships sqlmodelgen allows to build relationships by passing the argument generate relationships=True to the functions: gen code from sql gen code from sqlite gen code from postgres gen code from mysql In such case sqlmodelgen is going to generate relationships between classes based on the foreign keys retrieved. The following example will generate: CLI usage CLI usage is supported, for example one can invokem with: help description for input arguments: I","default_branch":null,"files":null,"tree":[],"storefront":"/r/nucccc","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nucccc/sqlmodelgen/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}