MCPcopy
hub / github.com/diffgram/diffgram / run_migrations_online

Function run_migrations_online

shared/alembic/env.py:53–74  ·  view source on GitHub ↗

Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.

()

Source from the content-addressed store, hash-verified

51
52
53def run_migrations_online():
54 """Run migrations in 'online' mode.
55
56 In this scenario we need to create an Engine
57 and associate a connection with the context.
58
59 """
60 connectable = engine_from_config(
61
62 config.get_section(config.config_ini_section),
63 prefix="sqlalchemy.",
64 poolclass=pool.NullPool,
65 connect_args = {"options": "-c statement_timeout=270000 -c idle_in_transaction_session_timeout=270000"} # 4.5 mins timeout
66 )
67
68 with connectable.connect() as connection:
69 context.configure(
70 connection=connection, target_metadata=target_metadata
71 )
72
73 with context.begin_transaction():
74 context.run_migrations()
75
76
77if context.is_offline_mode():

Callers 1

env.pyFile · 0.85

Calls 1

connectMethod · 0.45

Tested by

no test coverage detected