Releases: agronholm/sqlacodegen
Releases · agronholm/sqlacodegen
4.0.2
- Fixed rendering of inherited keyword arguments for dialect-specific types that use
**kwargsin their initializers (such as MySQLCHARwithcollation) while preserving existing*argsrendering behavior (PR by @hyoj0942) - Fixed missing metadata argument when rendering plain tables with the SQLModel
- Added support for self-referential tables in the SQLModel generator (PR by @sheinbergon)
- Fixed empty dialect kwargs (e.g.
postgresql_include=[]) being included in rendered indexes, tables, and columns (PR by @sheinbergon)
4.0.1
- Fix enum column definitions to explicitly include schema and name if reflected via SQLAlchemy's Metadata (pr by @sheinbergon)
4.0.0
- BACKWARD INCOMPATIBLE API changes (for those who customize code generation by subclassing the existing generators):
- Added new optional keyword argument,
explicit_foreign_keystoDeclarativeGenerator, to force foreign keys to be rendered asClassName.attribute_namestring references - Removed the
render_relationship_args()method from the SQLModel generator - Added two new methods for customizing relationship rendering in
DeclarativeGenerator:render_relationship_annotation(): returns the appropriate type annotation (without theMappedwrapper) for the relationshiprender_relationship_arguments(): returns a dictionary of keyword arguments tosqlalchemy.orm.relationship()
- Added new optional keyword argument,
4.0.0rc3
- BACKWARD INCOMPATIBLE Relationship names changed when multiple FKs or junction tables connect to the same target table. Regenerating models will break existing code.
- Added support for generating Python enum classes for
ARRAY(Enum(...))columns (e.g., PostgreSQLARRAY(ENUM)). Supports named/unnamed enums, shared enums across columns, and multi-dimensional arrays. Respects--options nonativeenums. (PR by @sheinbergon) - Improved relationship naming: one-to-many uses FK column names (e.g.,
simple_items_parent_container), many-to-many uses junction table names (e.g.,students_enrollments). Use--options nofknamesto revert to old behavior. (PR by @sheinbergon) - Fixed
Indexkwargs (e.g.mysql_length) being ignored during code generation (PR by @luliangce)
4.0.0rc2
- Add
values_callablelambda to generated native enums column definitions. This allows for proper enum value insertion when working with ORM models (PR by @sheinbergon)
4.0.0rc1
- BACKWARD INCOMPATIBLE
TablesGenerator.render_column_type()was changed to receive theColumnobject instead of the column type object as its sole argument - Added Python enum generation for native database ENUM types (e.g., PostgreSQL / MySQL ENUM). Retained synthetic Python enum generation from CHECK constraints with IN clauses (e.g.,
column IN ('val1', 'val2', ...)). Use--options nonativeenumsto disable enum generation for native database enums. Use--options nosyntheticenumsto disable enum generation for synthetic database enums (VARCHAR columns with check constraints). (PR by @sheinbergon)
3.2.0
- Dropped support for Python 3.9 (PR by @agronholm)
- Fix Postgres
DOMAINadaptation regression introduced in SQLAlchemy 2.0.42 (PR by @sheinbergon) - Support disabling special naming logic for single column many-to-one and one-to-one relationships (PR by @Henkhogan, revised by @sheinbergon)
- Add
include_dialect_optionsoption to renderTableandColumndialect-specific kwargs andinfoin generated code. (PR by @jaogoy) - Add
keep_dialect_typesoption to preserve dialect-specific column types instead of adapting to generic SQLAlchemy types. (PR by @jaogoy)
3.1.1
- Fallback
NotImplementederrors encountered when accessingpython_typefor non-native types totyping.Any(PR by @sheinbergon, based on work by @danplischke)
3.1.0
- Type annotations for ARRAY column attributes now include the Python type of the array elements (PR by @@JoaquimEsteves)
- Added support for specifying engine arguments via --engine-arg (PR by @LajosCseppento)
- Fixed incorrect package name used in importlib.metadata.version for sqlalchemy-citext, resolving PackageNotFoundError (PR by @oaimtiaz)
- Prevent double pluralization (PR by @dkratzert, remedied by @sheinbergon)
- Fixes DOMAIN extending JSON/JSONB data types (PR by @sheinbergon)
- Temporarily restrict SQLAlchemy version to 2.0.41 (PR by @sheinbergon)
- Fixes add_import behavior when adding imports from sqlalchemy and overall better alignment of import behavior(s) across generators (PR by @EthanKim8683)
- Fixes nullable column behavior for non-null columns for both sqlmodels and declarative generators (PR by @sheinbergon)
3.0.0
- Dropped support for Python 3.8 @agronholm
- Changed nullable relationships to include
Optionalin their type annotations @sheinbergon - Fixed SQLModel code generation @sheinbergon
- Fixed two rendering issues in
ENUMcolumns when a non-default schema is used: an unwarranted positional argument and missing theschemaargument @agronholm - Fixed
AttributeErrorwhen metadata contains user defined column types @agronholm - Fixed
AssertionErrorwhen metadata contains a column type that is a type decorator with an all-uppercase name @agronholm - Fixed MySQL
DOUBLEcolumn types being rendered with the wrong arguments @agronholm