def run_migrations_online():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

    """
    connectable = config.attributes.get('connection', None)
    config_opts = {}
    config_opts.update(common_config_opts)

    if connectable is None:
        connectable = engine_from_config(
            config.get_section(config.config_ini_section),
            prefix='sqlalchemy.',
            poolclass=pool.NullPool,
        )

    with connectable.connect() as connection:
        context.configure(
            connection=connection,
            **common_config_opts,
        )

        with context.begin_transaction():
            context.run_migrations()
Run migrations in 'online' mode.

In this scenario we need to create an Engine
and associate a connection with the context.
jupyterhub/alembic/env.py