Skip to main content

Flask sqlacodegen

Fork of sqlacodegen by Alex Gronholm.

What's different:

  • Support for Flask-SQLAlchemy syntax using --flask option.
  • Defaults to generating backrefs in relationships. --nobackref still included as option in case backrefs are not wanted.
  • Naming of backrefs is class name in snake_case (as opposed to CamelCase) and is pluralized if it's Many-to-One or Many-to-Many using inflect.
  • Primary joins are explicit.
  • If column has a server_default set it to FetchValue() instead of trying to determine what that value is. Original code did not set the right server defaults in my setup.
  • --ignore-cols ignores special columns when generating association tables. Original code requires all columns to be foreign keys in order to generate association table. Example: --ignore-cols id,inserted,updated.
  • Uses the command flask-sqlacodegen instead of sqlacodegen.
  • Added support for --notables to only generate model classes, even for association tables

Install

With pip:

pip install flask-sqlacodegen

Without pip:

git clone https://github.com/ksindi/flask-sqlacodegen.git
cd flask-sqlacodegen/
python setup.py install

For contributing:

git clone https://github.com/ksindi/flask-sqlacodegen.git
python -m venv env
pip install -r requirements.txt
python -m sqlacodegen.main --flask --outfile models.py mysql+pymysql://<username>:<password>@<database-ip>:<port>/<database-name> [--tables <tablenames>] [--notables]

Metadata

Release files for flask-sqlacodegen 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-sqlacodegen 2.0.0
File Size Uploaded
flask-sqlacodegen-2.0.0.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-sqlacodegen 2.0.0
File Interpreter ABI Platform
flask_sqlacodegen-2.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 25.9 kB

Release files / flask-sqlacodegen-2.0.0.tar.gz

Download URL flask-sqlacodegen-2.0.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b52847fac9d81696760da42327c1b0506113d4c95f6b46cf3e7d528cbff4d705
BLAKE2b-256 checksum
How to use checksums
7266aa20de8f231576896e00c362ee13a5e08eb71bad6c2a23c9f429899185d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / flask_sqlacodegen-2.0.0-py2.py3-none-any.whl

Download URL flask_sqlacodegen-2.0.0-py2.py3-none-any.whl
Size 13.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
803bd6d1b6f8d6c4037f630cd608c0df9b0efcd6fb0eefe536018da9f34888fe
BLAKE2b-256 checksum
How to use checksums
f37092f070d909c41f714c14bee03d07a5011f0d61d5ea78e037e6267cb4b9ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.8

2 release files

1.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page