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
Base = declarative_base()
class FakeModel(Base): # type: ignore
__tablename__ = "fake"
id = Column(Integer, Sequence("fakemodel_id_sequence"), index=True, primary_key=True)
class DerivedModel(Base): # type: ignore
__tablename__ = "derived"
id = Column(Integer, Sequence("derivedmodel_id_sequence"), primary_key=True)
fake = Column(Integer, ForeignKey("fake.id"))
eng = create_engine("duckdb:///:memory:")
Base.metadata.create_all(eng)
↓
sqlalchemy.exc.DBAPIError: (duckdb.duckdb.Error) Cannot alter entry "fake" because there are entries that depend on it.
[SQL:
CREATE TABLE derived (
id INTEGER NOT NULL,
fake INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(fake) REFERENCES fake (id)
)
If I remove index=True on FakeModel.id, it works fine. The index is probably automatic on PK columns, but it shouldn't be an error to make it explicit.
DuckDB Engine Version
0.11.2
DuckDB Version
0.10.1
SQLAlchemy Version
2.0.29
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
File "../python3.8/site-packages/duckdb_engine/__init__.py", line 162, in execute
self.__c.execute(statement, parameters)
sqlalchemy.exc.DBAPIError: (duckdb.duckdb.Error) Cannot alter entry "test_suites" because there are entries that depend on it.
[SQL:
CREATE TABLE suite_case_association (
test_suite_id INTEGER NOT NULL,
test_case_id INTEGER NOT NULL,
PRIMARY KEY (test_suite_id, test_case_id),
FOREIGN KEY(test_suite_id) REFERENCES test_suites (id),
FOREIGN KEY(test_case_id) REFERENCES test_cases (id)
)
]
The root cause is the two index=True of the name fields.
What happened?
This pair of table definitions fails:
↓
If I remove
index=True
onFakeModel.id
, it works fine. The index is probably automatic on PK columns, but it shouldn't be an error to make it explicit.DuckDB Engine Version
0.11.2
DuckDB Version
0.10.1
SQLAlchemy Version
2.0.29
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: