there's a recipe for views, including DDL, here: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views
another way to go would be to alter the compilation of sqlalchemy.schema.DropTable which would somehow have to check those Table objects you have which are actually views, maybe if you put a flag on them table.isview=True or something like that. On May 6, 2012, at 7:07 AM, Stefan Urbanek wrote: > Hi, > > Problem: My code generates a table or a view, based on user's preference. > Table("something") accepts both table and view name and works properly for > most of the tasks, including Table.exists(). When I use Table.delete() > (postgresql) it works only on tables, when I try to use it on a view I get: > > sqlalchemy.exc.ProgrammingError: (ProgrammingError) "contracts_denorm" is not > a table > HINT: Use DROP VIEW to remove a view. > > This seems to be a little bit inconsistent or maybe I am missing something > here and not doing it right. How to properly drop a view using SQLAlchemy? As > for workaround, is there a way how I can at least determine whether the Table > object is a view and issue manual DROP VIEW statement by myself? > > Stefan Urbanek > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sqlalchemy/-/0aZj0MOWgagJ. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.