<s> from __future__ import with_statement <EOL> from alembic import context <EOL> from sqlalchemy import engine_from_config , pool <EOL> config = context . config <EOL> target_metadata = None <EOL> def run_migrations_offline ( ) : <EOL> """<STR_LIT>""" <EOL> url = config . get_main_option ( "<STR_LIT>" ) <EOL> context . configure ( url = url ) <EOL> with context . begin_transaction ( ) : <EOL> context . run_migrations ( ) <EOL> def run_migrations_online ( ) : <EOL> """<STR_LIT>""" <EOL> engine = engine_from_config ( <EOL> config . get_section ( config . config_ini_section ) , <EOL> prefix = '<STR_LIT>' , <EOL> poolclass = pool . NullPool ) <EOL> connection = engine . connect ( ) <EOL> context . configure ( <EOL> connection = connection , <EOL> target_metadata = target_metadata <EOL> ) <EOL> try : <EOL> with context . begin_transaction ( ) : <EOL> context . run_migrations ( ) <EOL> finally : <EOL> connection . close ( ) <EOL> if context . is_offline_mode ( ) : <EOL> run_migrations_offline ( ) <EOL> else : <EOL> run_migrations_online ( ) </s>
