> On Nov 17, 2014, at 10:07 PM, Nick Retallack <nickretall...@gmail.com> wrote: > > On Monday, November 17, 2014 6:55:49 PM UTC-8, Michael Bayer wrote: > for what specifically? Autogenerate will work with whatever data you give > it. Send in a target_metadata with what you want to view on the Python side > and tailor an include_object() function if you need in order to filter what > comes from the database. > > So to make this work I'd have to enable include_schemas so it'd look at all > the schemas,
yes > and then add an include_object function to prevent it from including the > schemas I don't want? yes > Does include_object get run on stuff coming from the metadata or from the > database? yes > I guess that's determined by the "reflected" argument? yes > > How about if I just pass in a set of schemas to look in, instead? I think you should be setting the search path in your case, but if you weren’t: def include_schemas(names): # produce an include object function that filters on the given schemas def include_object(object, name, type_, reflected, compare_to): if type_ == “table”: return object.schema in names return include_object environment.configure(include_object=myapp.include_schemas([‘x’, ‘y’, ‘z’]) > That might be faster, since there could be many schema clones and I don't > really want to search them all. Python makes it possible and also encourages us that Alembic doesn’t provide two different API options that ultimately do the same thing. > Something like setting the search_path :P. > > Also how do I get it to not output explicit schemas in the migration, but > default to whatever is the correct schema for the current pass during the > actual upgrade? you should set the search path, if you’re on PG only then that’s a great idea. Do it in your env.py, get the Connection then just call set search path on it. env.py is there for you to customize freely. -- 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.