Commit 7efa358
authored
* Add SQLAlchemy 2.0 support (issue #49)
- New sqlalchemy_v2 generator with modern SQLAlchemy 2.0 syntax:
- Uses DeclarativeBase instead of deprecated declarative_base()
- Uses Mapped[T] type annotations for columns
- Uses mapped_column() instead of Column()
- Uses X | None union syntax for nullable columns
- Support for all column types, foreign keys, indexes, and constraints
- Added functional tests for SQLAlchemy v2 generation
- Added integration tests for SQLAlchemy v2 (validates generated code runs)
- Added integration tests for OpenAPI 3 generator
- Updated CHANGELOG.md and README.md with SQLAlchemy v2 support
- Removed unused files (SUGGESTIONS.md, one.ddl)
* Add SQLAlchemy as test dependency for integration tests
* Fix tox coverage by using usedevelop=true
* Add integration tests for all model generators
- dataclass: 4 tests for basic model, fields, defaults, multiple tables
- sqlalchemy (legacy): 4 tests for basic model, columns, FK, multiple tables
- sqlalchemy_core: 5 tests (skipped - generator has known bugs)
- sqlmodel: 4 tests (skipped - requires Pydantic>=2.0, conflicts with table-meta)
- gino: 4 tests (skipped - requires SQLAlchemy<1.4, conflicts with SQLAlchemy>=2.0)
Note: Some tests are skipped due to dependency conflicts:
- sqlmodel requires pydantic>=2.0, but table-meta requires pydantic<2.0
- gino requires sqlalchemy<1.4, but we use sqlalchemy>=2.0
- sqlalchemy_core generator has bugs (missing column names, broken type sizes)
* Run integration tests in isolated tox/CI environments
- Separate tox environments for different dependency requirements:
- py39-py313: unit and functional tests
- integration-sqlalchemy: pydantic v1, sqlalchemy v2
- integration-gino: pydantic v1, sqlalchemy v1.3 (gino requirement)
- Separate CI jobs for each integration test group
- SQLModel integration tests disabled due to unresolvable conflict:
- sqlmodel requires pydantic>=2.0
- table-meta requires pydantic<2.0
- Tests will be skipped until table-meta adds pydantic 2.x support
* Fix SQLModel integration tests to not depend on omymodels
Integration tests now use pre-generated code fixtures instead of
calling create_models() at runtime. This allows SQLModel tests to
run in an isolated environment with pydantic>=2.0 without conflicts.
Tests verify that the generated code (as users would commit to their repos)
works correctly with the target library.
* Fix sqlalchemy_core generator bugs and isolate gino tests
- Fix sqlalchemy_core generator: add column names to output
- Fix sqlalchemy_core generator: include type name with size
- Fix sqlalchemy_core generator: correct positional/keyword arg order for ForeignKey
- Convert gino tests to pre-generated code fixtures (no omymodels dependency)
- Update tox.ini and CI workflow for isolated gino tests
- Remove flawed parametrized converter test (py-models-parser limitations)
- Update functional test expected values for sqlalchemy_core
* Update CHANGELOG with sqlalchemy_core fixes
1 parent 50db95a commit 7efa358
File tree
38 files changed
+2175
-1017
lines changed- .github/workflows
- omymodels
- models
- sqlalchemy_core
- sqlalchemy_v2
- tests
- functional
- converter
- generator
- integration
- dataclass
- gino
- openapi3
- sqlalchemy_core
- sqlalchemy_v2
- sqlalchemy
- sqlmodel
38 files changed
+2175
-1017
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
57 | 115 | | |
58 | 116 | | |
59 | 117 | | |
| |||
78 | 136 | | |
79 | 137 | | |
80 | 138 | | |
81 | | - | |
| 139 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
| |||
75 | 83 | | |
76 | 84 | | |
77 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments