Create a temporary SQLite database with information_schema. Use a mock information_schema
()
| 90 | |
| 91 | @pytest.fixture |
| 92 | def sqlite_engine_meta() -> sa.Engine: |
| 93 | """Create a temporary SQLite database with information_schema. |
| 94 | Use a mock information_schema""" |
| 95 | |
| 96 | import sqlalchemy as sa |
| 97 | |
| 98 | engine = sa.create_engine("sqlite:///:memory:") |
| 99 | |
| 100 | sql("ATTACH ':memory:' AS information_schema", engine=engine) |
| 101 | sql( |
| 102 | "CREATE TABLE information_schema.tables (table_name TEXT)", |
| 103 | engine=engine, |
| 104 | ) |
| 105 | sql( |
| 106 | "INSERT INTO information_schema.tables VALUES ('tables')", |
| 107 | engine=engine, |
| 108 | ) |
| 109 | |
| 110 | return engine |
| 111 | |
| 112 | |
| 113 | @pytest.mark.skipif(not HAS_SQLALCHEMY, reason="SQLAlchemy not installed") |
nothing calls this directly
no test coverage detected
searching dependent graphs…