Skip to content

Commit 1f635af

Browse files
committed
fix: close oracle round 14 gaps
1 parent 8a16bb4 commit 1f635af

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

docs/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ sqlalchemy-excel/
120120
│ ├── types.py # ExcelTypeCompiler (type mappings)
121121
│ ├── reflection.py # ExcelInspectionMixin (schema inspection)
122122
│ └── py.typed # PEP 561 marker file
123-
├── tests/ # 18 test modules (402 passed, 2 xfailed)
123+
├── tests/ # 18 test modules (406 passed, 1 xfailed)
124124
│ ├── conftest.py # Shared fixtures
125125
│ ├── test_alter_table.py
126126
│ ├── test_dialect.py

docs/USAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ sqlalchemy-excel has some limitations due to the nature of Excel as a database:
386386
- **ALTER TABLE**: Supports `ADD COLUMN`, `DROP COLUMN`, and `RENAME COLUMN` via raw SQL through the driver.
387387
- **Raw CREATE/DROP reflection**: Raw `CREATE TABLE` writes declared schema metadata and raw `DROP TABLE` removes it.
388388
- **Schema guards scope**: Schema validation guards apply only to SQLAlchemy-compiled SQL. Raw SQL sent through `exec_driver_sql()` is forwarded directly to excel-dbapi without schema validation.
389-
- **ORM relationship limits**: Lazy one-to-many relationship loading can return empty collections; use eager loading (`joinedload`) for reliable one-to-many reads.
389+
- **ORM relationship limits**: Simple one-to-many lazy loading now works correctly. Use eager loading (`joinedload`) for more complex relationship patterns.
390390
- **Many-to-many loading is unsupported**: Association table persistence works, but relationship loader SQL for many-to-many is not fully supported.
391391
- **No foreign keys or indexes**: Excel has no concept of these.
392392
- **UNIQUE/CHECK/FOREIGN KEY are not enforced**: They are accepted for SQLAlchemy compatibility, ignored by the backend, and compile-time warnings are emitted for `CREATE TABLE` and `ALTER TABLE ... ADD COLUMN`.

src/sqlalchemy_excel/dialect.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ def _after_create(
3434
return
3535

3636
for col in target.columns:
37-
if col.server_default is not None:
37+
# Skip server_default warning if column has Computed or Identity,
38+
# as those are already warned in DDL compilation
39+
if (
40+
col.server_default is not None
41+
and getattr(col, "computed", None) is None
42+
and getattr(col, "identity", None) is None
43+
):
3844
warnings.warn(
3945
"Excel dialect does not support server_default; value will be ignored",
4046
stacklevel=2,
@@ -44,16 +50,8 @@ def _after_create(
4450
"Excel dialect does not support autoincrement=True; value must be set explicitly",
4551
stacklevel=2,
4652
)
47-
if getattr(col, "computed", None) is not None:
48-
warnings.warn(
49-
f"Column '{col.name}': Computed columns are not supported by excel dialect; the expression will be ignored",
50-
stacklevel=2,
51-
)
52-
if getattr(col, "identity", None) is not None:
53-
warnings.warn(
54-
f"Column '{col.name}': Identity columns are not supported by excel dialect; auto-increment will not be applied",
55-
stacklevel=2,
56-
)
53+
# Skip Computed and Identity warnings here - they're already warned in DDL compilation
54+
# to avoid duplicate warnings
5755

5856
import excel_dbapi
5957

tests/test_orm_relationships.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- one-to-many inserts and joined eager loading
55
66
Known limitations:
7-
- lazy relationship loading can return incorrect results
7+
- many-to-many relationship loading can return incorrect results
88
- many-to-many relationship loaders generate SQL patterns the backend can't parse
99
"""
1010

@@ -113,9 +113,6 @@ def test_one_to_many_relationship_round_trip(relationship_engine: Engine) -> Non
113113
assert [child.name for child in parent.children] == ["child-1", "child-2"]
114114

115115

116-
@pytest.mark.xfail(
117-
reason="Lazy one-to-many loaders currently return empty collections with this backend.",
118-
)
119116
def test_one_to_many_lazy_loading_boundary(relationship_engine: Engine) -> None:
120117
with Session(relationship_engine) as session:
121118
session.add(

0 commit comments

Comments
 (0)