You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FEATURE: Add remaining features for Python SQLModel code generation
Implements several remaining features from the design document:
- Default factory for datetime columns with now() defaults (timezone-aware)
- Module prefix support for import paths in multi-file mode
- Generated columns with SQLAlchemy Computed support
- User-defined type detection (maps to str as fallback)
- Pydantic base models via generate_base_models config
- Relationship generation for foreign keys with back_populates
Also updates the design document to reflect current implementation status.
https://claude.ai/code/session_01Rk2mNUxaCsiqTBQZB1sLuW
-**Resolution**: [x] Using `X | None` (Python 3.10+ syntax).
652
645
653
646
4.**Enum Handling**: Literal types vs Python Enum classes?
654
-
-**Resolution**: Deferred to future work. Currently maps unknown types to `Any`.
647
+
-**Resolution**: [~] Partial. User-defined types are detected by schema but map to `str` as a fallback since enum values are not available in the `Codegen` trait input.
655
648
656
649
## Future Enhancements
657
650
658
-
1.[]**Relationship Generation**: Generate `Relationship()` attributes with back_populates
659
-
2.[]**Pydantic Base Models**: Generate Pydantic-only models via `generate_base_models` config
660
-
3.[]**User-Defined Enums**: Support PostgreSQL enum types as Python Literal or Enum
661
-
4.[]**Generated Columns**: Full `Computed` support with sa_column
662
-
5.[]**Single-Column Index**: Generate `Field(index=True)` for indexed columns
663
-
6.[]**Default Factory**: Generate `default_factory` for datetime fields with `now()` defaults
664
-
7.[]**Module Prefix**: Support `module_prefix` config for import paths
665
-
8.[]**String Length Validation**: Use extracted varchar/char length in `Field(max_length=n)`
651
+
1.[x]**Relationship Generation**: Generate `Relationship()` attributes with back_populates
652
+
2.[x]**Pydantic Base Models**: Generate Pydantic-only models via `generate_base_models` config
653
+
3.[~]**User-Defined Enums**: Support PostgreSQL enum types as Python Literal or Enum (partial - fallback to `str`)
654
+
4.[x]**Generated Columns**: Full `Computed` support with sa_column
655
+
5.[x]**Single-Column Index**: Generate `Field(index=True)` for indexed columns
656
+
6.[x]**Default Factory**: Generate `default_factory` for datetime fields with `now()` defaults
657
+
7.[x]**Module Prefix**: Support `module_prefix` config for import paths
658
+
8.[x]**String Length Validation**: Use extracted varchar/char length in `Field(max_length=n)`
0 commit comments