MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / reflect_whole_tables

Function reflect_whole_tables

test/perf/many_table_reflection.py:294–321  ·  view source on GitHub ↗
(
    engine, schema_name, table_names, timing, mode, ignore_diff
)

Source from the content-addressed store, hash-verified

292
293@define_test
294def reflect_whole_tables(
295 engine, schema_name, table_names, timing, mode, ignore_diff
296):
297 single = None
298 meta = sa.MetaData(schema=schema_name)
299
300 if "single" in mode:
301
302 def go(bind):
303 single = {}
304 with timing("Table_autoload_with"):
305 for name in table_names:
306 single[(None, name)] = sa.Table(
307 name, meta, autoload_with=bind
308 )
309 return single
310
311 if USE_CONNECTION:
312 with engine.connect() as c:
313 single = go(c)
314 else:
315 single = go(engine)
316
317 multi_meta = sa.MetaData(schema=schema_name)
318 if "multi" in mode:
319 with timing("MetaData_reflect"):
320 multi_meta.reflect(engine, only=table_names)
321 return (multi_meta, single)
322
323
324@define_test

Callers

nothing calls this directly

Calls 3

reflectMethod · 0.95
goFunction · 0.70
connectMethod · 0.45

Tested by

no test coverage detected