we have a recipe for that at: https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/Views
On Sep 30, 2014, at 11:03 AM, Stefan Urbanek <stefan.urba...@gmail.com> wrote: > I want to construct SELECT from the underlying table(s) to create the view > during the migration. The materialized VIEW is the target object to be > created by the migration. > > Stefan > > On Friday, September 26, 2014 5:34:52 PM UTC-4, Michael Bayer wrote: > not sure if i understand the question. where's the reflected table here? > are you trying to reflect the underlying SELECT from it, or make a new SELECT > out of an existing view ? > > if the question is, "I want to reflect a materialized view in Postgresql", we > just added that in 1.0, so is not released yet: > http://docs.sqlalchemy.org/en/latest/changelog/migration_10.html#postgresql-dialect-reflects-materialized-views-foreign-tables > > > > > > > On Sep 23, 2014, at 11:01 AM, Stefan Urbanek <stefan....@gmail.com> wrote: > >> Hi, >> >> We are trying to create a materialized view (PostgreSQL). We have this >> simple statement compiler: >> >> class CreateMaterializedView(Executable, ClauseElement): >> def __init__(self, name, select): >> self.name = name >> self.select = select >> >> @compiles(CreateMaterializedView) >> def visit_create_materialized_view(element, compiler, **kw): >> >> return "CREATE MATERIALIZED VIEW {} AS {}".format( >> element.name, >> compiler.process(element.select, literal_binds=True) >> ) >> >> What is the clean way to get the actual reflected metadata (Table object) to >> construct the `select` element for the CreateMaterializedView? >> >> Thanks, >> >> Stefan >> >> >> -- >> 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 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 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.