MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _init_dbs

Method _init_dbs

test/ext/test_horizontal_shard.py:775–790  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

773 schema = "changeme"
774
775 def _init_dbs(self):
776 e = testing_engine("sqlite://")
777 with e.connect() as conn:
778 for i in range(1, 5):
779 conn.exec_driver_sql(
780 'ATTACH DATABASE "shard%s_%s.db" AS shard%s'
781 % (i, provision.FOLLOWER_IDENT, i)
782 )
783
784 db1 = e.execution_options(schema_translate_map={"changeme": "shard1"})
785 db2 = e.execution_options(schema_translate_map={"changeme": "shard2"})
786 db3 = e.execution_options(schema_translate_map={"changeme": "shard3"})
787 db4 = e.execution_options(schema_translate_map={"changeme": "shard4"})
788
789 self.engine = e
790 return db1, db2, db3, db4
791
792 def teardown_test(self):
793 testing_reaper.checkin_all()

Callers 1

setup_testMethod · 0.45

Calls 4

testing_engineFunction · 0.90
connectMethod · 0.45
exec_driver_sqlMethod · 0.45
execution_optionsMethod · 0.45

Tested by

no test coverage detected