Wow, thanks for such a fast response! I used the env.py script from 
here: 
https://github.com/inklesspen/pyramid_alembic_mako/blob/master/pyramid_alembic/alembic/%2Bpackage%2B/alembic/env.py_tmpl

Line 15:

> engine = engine_from_config(config.get_section('app:main'), 'sqlalchemy.')
>
Then in run_migrations_online():

> connection = engine.connect()

...
> context.configure(
>                 connection=connection,
>                 target_metadata=target_metadata
>                 ) 


However, once I have the context set up with a connection, I can't figure 
out how to retrieve it in a version script.

Thanks,
Ryan

On Monday, January 27, 2014 6:12:52 AM UTC-6, Michael Bayer wrote:
>
>
> On Jan 27, 2014, at 1:47 AM, Ryan Eberhardt <reber...@gmail.com<javascript:>> 
> wrote: 
>
> > Context: I'm using Pyramid with SQLAlchemy, and am pretty deep into a 
> project with no database versioning.  I'm looking to use Alembic to start 
> doing that. 
> > 
> > I read at 
> http://alembic.readthedocs.org/en/latest/tutorial.html#building-an-up-to-date-database-from-scratchthat
>  I can use the SQLAlchemy create_all for a first version to create the 
> schema.  I got my metadata from op.get_context.opts['target_metadata'], but 
> I can't figure out how to get the engine or connection to provide as the 
> create_all parameter... The snippet at the provided URL just shows 
> "my_metadata" and "engine" variables without showing where these came from. 
>  Am I missing?  Some solid Googling didn't turn anything up… 
>
> somewhere in your pyramid app, you’ve set up a create_engine() 
> somewhere…Pyramid doesn’t have any fixed convention for this so it depends 
> on how you are accessing this creation function.  How are you running it ? 
>   If you wrote some kind of .py script, it would call upon that function 
> where you’ve also done the create_engine() step.      This is all kind of 
> DIY so you’d just establish your own system. 
>
>
>

-- 
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/groups/opt_out.

Reply via email to