Hi Mike,

I can't use ini files because I don't know which database to use until the
test is running. However, I was able to solve via tags.


On Mon, May 12, 2014 at 8:52 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:

>
> there's no standard per se.  I'm partial to .ini files and in particular a
> test.ini file for tests.  Environment variables are another option.     The
> app overall needs a way to differentiate database urls for tests vs.
> running normally, so migrations aren't special.  The migration environment
> should draw upon the same source of connectivity as that of the rest of the
> app.
>
>
>
> On May 12, 2014, at 9:27 PM, Charles Reese <charlespre...@gmail.com>
> wrote:
>
> I need to specify different databases for different configurations, one
> for running migrations, one for units tests, one for Jenkins...
>
> Here is what I currently do:
>
> alembic/env.py:
>
> def run_migrations_online():
>     engine = create_engine(
>         create_app('settings.yaml').config['DATABASE_URL'],
>         poolclass=pool.NullPool)
>     connection = engine.connect()
>     context.configure(
>         connection=connection,
>         target_metadata=target_metadata)
>     try:
>         with context.begin_transaction():
>             context.run_migrations()
>     finally:
>         connection.close()
>
> That works for regular migrations, but not for tests. What is the standard
> way to do this?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy-alembic+unsubscr...@googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "sqlalchemy-alembic" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sqlalchemy-alembic/UzGMaIPjyhk/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> sqlalchemy-alembic+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to