[Sqlalchemy-tickets] Issue #4311: [sqlite] ATTACH DATABASE does not have an effect (zzzeek/sqlalche
Brought to you by:
zzzeek
From: Jan K. <iss...@bi...> - 2018-08-02 12:32:34
|
New issue 4311: [sqlite] ATTACH DATABASE does not have an effect https://bitbucket.org/zzzeek/sqlalchemy/issues/4311/sqlite-attach-database-does-not-have-an Jan Koprowski: Hi, We are trying to use cross database joins in our code. We are testing our code against sqlite. We are running tests using pytest. Some tests failing as follow (on drop_all): ``` sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unknown database "second" [SQL: 'PRAGMA "second".table_info("table2")'] ``` ``` #!python class Table2(Base): __tablename__ = 'table2' __table_args__ = {'schema': 'second'} ``` ``` #!python engine = create_engine('sqlite://') Session.configure(bind=engine) metadata.bind = engine engine.execute(sqlalchemy.text('ATTACH DATABASE \'second.db\' AS second')) metadata.drop_all() metadata.create_all() ``` Our SQLAlchemy version is 1.2.10. There are tests using sqlite and same setup which works. Are you able to reproduce the problem? Do you have idea why such setup sometimes works? Thank you in advance, Jan |