|
1 | 1 | flask-sqlacodegen |
2 | 2 | ================= |
3 | 3 |
|
4 | | -Fork of <a href="https://pypi.python.org/pypi/sqlacodegen">sqlacodegen</a>. Based off of version 1.1.6. |
| 4 | +Fork of <a href="https://pypi.python.org/pypi/sqlacodegen">sqlacodegen</a> by Alex Gronholm. Based off of version 1.1.6. |
5 | 5 |
|
6 | 6 | What's different: |
7 | | -* Support for Flask-SQLAlchemy syntax using `--flask` option. All this means: |
8 | | - * SQLAlchemy class is instantiated (i.e. `db = SQLAlchemy()`). |
9 | | - * Flask-SQLAlchemy columns are used (e.g. `db.Integer`). |
10 | | - * Metadata is only implicit in tables |
| 7 | +* Use the command `flask-sqlacodgen` instead of `sqlacodegen`. |
| 8 | +* Support for Flask-SQLAlchemy syntax using `--flask` option: |
| 9 | + - SQLAlchemy class is instantiated (i.e. `db = SQLAlchemy()`). |
| 10 | + - Flask-SQLAlchemy columns are used (e.g. `db.Integer`). |
| 11 | + - Metadata is only implicit in tables. |
11 | 12 | * Defaults to generating backrefs in relationships. `--nobackref` still included as option in case backrefs are not wanted. |
12 | 13 | * 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 <a href="https://pypi.python.org/pypi/inflect">inflect</a>. |
13 | 14 | * Generate explicit primary joins. I deal with pretty complicated tables that need explicit primary joins. |
14 | | -* 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 set up. |
15 | | -* `--ignore-cols` ignores special columns (e.g. id, inserted, updated) 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`. |
| 15 | +* 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. |
| 16 | +* `--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`. |
16 | 17 |
|
17 | 18 | ## Install |
18 | 19 |
|
19 | | -Note: planning to upload to pip. In the meantime, use the without pip option. |
| 20 | +With pip: |
| 21 | +``` |
| 22 | +pip install flask-sqlacodegen |
| 23 | +``` |
20 | 24 |
|
21 | 25 | Without pip: |
22 | 26 | ``` |
|
0 commit comments