Skip to content

Releases: agronholm/sqlacodegen

4.0.4

Choose a tag to compare

@github-actions github-actions released this 19 Jun 06:02
  • Added autoincrement to primary key columns to prevent missing field errors. (#473; PR by @jtmonroe)
  • Preserve dialect-specific ARRAY types (e.g. postgresql.ARRAY) instead of adapting them to the generic sqlalchemy.ARRAY. The generic type does not implement operators like .contains(), so adapting silently broke PostgreSQL array queries on generated models. (#441)

4.0.3

Choose a tag to compare

@github-actions github-actions released this 19 Mar 18:45
ac42f1a
  • Improved rendering of Identity server defaults by explicitly rendering non-default parameters; Decimal values (as returned by some databases) are now cast to int (PR by @NotCarlosSerrano)

4.0.2

Choose a tag to compare

@github-actions github-actions released this 01 Mar 21:20
9234437
  • Fixed rendering of inherited keyword arguments for dialect-specific types that use **kwargs in their initializers (such as MySQL CHAR with collation) while preserving existing *args rendering 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

Choose a tag to compare

@github-actions github-actions released this 20 Feb 09:02
de5adcc
  • Fix enum column definitions to explicitly include schema and name if reflected via SQLAlchemy's Metadata (pr by @sheinbergon)

4.0.0

Choose a tag to compare

@github-actions github-actions released this 17 Feb 03:16
  • BACKWARD INCOMPATIBLE API changes (for those who customize code generation by subclassing the existing generators):
    • Added new optional keyword argument, explicit_foreign_keys to DeclarativeGenerator, to force foreign keys to be rendered as ClassName.attribute_name string 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 the Mapped wrapper) for the relationship
      • render_relationship_arguments(): returns a dictionary of keyword arguments to sqlalchemy.orm.relationship()

4.0.0rc3

Choose a tag to compare

@github-actions github-actions released this 07 Feb 18:33
4772a34
  • 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., PostgreSQL ARRAY(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 nofknames to revert to old behavior. (PR by @sheinbergon)
  • Fixed Index kwargs (e.g. mysql_length) being ignored during code generation (PR by @luliangce)

4.0.0rc2

Choose a tag to compare

@github-actions github-actions released this 23 Jan 13:40
edb17ec
  • Add values_callable lambda to generated native enums column definitions. This allows for proper enum value insertion when working with ORM models (PR by @sheinbergon)

4.0.0rc1

Choose a tag to compare

@github-actions github-actions released this 18 Jan 11:39
f4619eb
  • BACKWARD INCOMPATIBLE TablesGenerator.render_column_type() was changed to receive the Column object 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 nonativeenums to disable enum generation for native database enums. Use --options nosyntheticenums to disable enum generation for synthetic database enums (VARCHAR columns with check constraints). (PR by @sheinbergon)

3.2.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 20:33
615d79c
  • Dropped support for Python 3.9 (PR by @agronholm)
  • Fix Postgres DOMAIN adaptation 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_options option to render Table and Column dialect-specific kwargs and info in generated code. (PR by @jaogoy)
  • Add keep_dialect_types option to preserve dialect-specific column types instead of adapting to generic SQLAlchemy types. (PR by @jaogoy)

3.1.1

Choose a tag to compare

@github-actions github-actions released this 04 Sep 09:34
a1f22fc
  • Fallback NotImplemented errors encountered when accessing python_type for non-native types to typing.Any (PR by @sheinbergon, based on work by @danplischke)