I've added an issue to look into this at
https://bitbucket.org/zzzeek/alembic/issues/349/models-that-refer-to-a-view-with-table-the.



On 12/26/2015 06:57 PM, Jonathan Beluch wrote:
>     In the meantime, the standard way to control what autogenerate
>     considers
>     is using the include_object callable:
> 
>     
> http://alembic.readthedocs.org/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.configure.params.include_object
>     
> <http://alembic.readthedocs.org/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.configure.params.include_object>
> 
> 
>     here, you can even call the get_views() method of the Inspector and
>     then
>     check if the given table name is in the list:
> 
>     from sqlalchemy import inspect
>     reflected_views = set()
>     def include_object(object, name, type_, reflected, compare_to):
>         if type_ == "table" and name in reflected_views:
>             return False
>         else:
>             return True
> 
>     with connectable.connect() as connection:
>         reflected_views.update(inspect(connection).get_view_names())
>         context.configure(
>             # ...
>             include_object = include_object
>         )
> 
> 
> Thanks, will give that a try. Thanks for the quick response. 
> 
> -- 
> 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
> <mailto: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