MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_via_engine

Method test_via_engine

test/engine/test_execute.py:1463–1482  ·  view source on GitHub ↗
(self, plain_tables, metadata)

Source from the content-addressed store, hash-verified

1461 )
1462
1463 def test_via_engine(self, plain_tables, metadata):
1464 with config.db.begin() as connection:
1465 metadata.create_all(connection)
1466
1467 map_ = {
1468 None: config.test_schema,
1469 "foo": config.test_schema,
1470 "bar": None,
1471 }
1472
1473 metadata = MetaData()
1474 t2 = Table("t2", metadata, Column("x", Integer), schema="foo")
1475
1476 with self.sql_execution_asserter(config.db) as asserter:
1477 eng = config.db.execution_options(schema_translate_map=map_)
1478 with eng.connect() as conn:
1479 conn.execute(select(t2.c.x))
1480 asserter.assert_(
1481 CompiledSQL("SELECT __[SCHEMA_foo].t2.x FROM __[SCHEMA_foo].t2")
1482 )
1483
1484
1485class ExecutionOptionsTest(fixtures.TestBase):

Callers

nothing calls this directly

Calls 12

create_allMethod · 0.95
MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
selectFunction · 0.90
CompiledSQLClass · 0.90
beginMethod · 0.45
execution_optionsMethod · 0.45
connectMethod · 0.45
executeMethod · 0.45
assert_Method · 0.45

Tested by

no test coverage detected