>
> > the descriptions on that page for several other methods say 'see
> > execute_at() for more information' so it doesn't exactly "feel"
> deprecated.
>
> I see it just at DDLElement.execute() where that doc should be updated.
>  Where else?
>

I think here as well?

http://docs.sqlalchemy.org/en/latest/core/ddl.html#sqlalchemy.schema.DDL.params.statement

http://docs.sqlalchemy.org/en/latest/core/compiler.html?highlight=execute_at#subclassing-guidelines
(search for execute_at)




> > I tried calling the normal Index function, but it threw an exception
> > when I passed it a materialized view object
>
> what exception?


> OK this might be because that recipe uses a lower-case "table()" object
> which is not as full featured as Table, i'd alter the recipe to use
> Table perhaps
>


It may be related to using __table__() rather than Table(). I tried
altering the recipe to use Table(), but couldn't figure it out, since my
materialized views need to be created after the other tables are created.
Perhaps Flask-SQLAlchemy was doing some magic when I called db.create_all()
that grabbed everything with Table().

Not a big deal. I'm planning to blog how I worked everything out later this
week as reference for anyone else trying to create/manage a postgresql
materialized view with sqlalchemy, and when I do I'll send out a link to
the list.

For reference, here is the exception:

*# materialized view already exists as a __table__() object called
'GearCategoryMV'*
*# Afterwards I try creating an index on it:*

*db.Index('myindex', GearCategoryMV.id, unique=False)*

*# fails with the following traceback*

*Traceback (most recent call last):*
*  File "manage.py", line 11, in <module>*
*    from app.models.gear_models import (GearCategory, GearCategoryMV,
GearItem,*
*  File "/Users/jeffwidman/Code/rc/api_rc_flask/app/models/gear_models.py",
line 428, in <module>*
*    db.Index('myindex', GearCategoryMV.id, unique=True)*
*  File
"/Users/jeffwidman/.virtualenvs/api_rc_flask/lib/python3.5/site-packages/sqlalchemy/sql/schema.py",
line 3172, in __init__*
*    ColumnCollectionMixin.__init__(self, *columns)*
*  File
"/Users/jeffwidman/.virtualenvs/api_rc_flask/lib/python3.5/site-packages/sqlalchemy/sql/schema.py",
line 2446, in __init__*
*    self._check_attach()*
*  File
"/Users/jeffwidman/.virtualenvs/api_rc_flask/lib/python3.5/site-packages/sqlalchemy/sql/schema.py",
line 2491, in _check_attach*
*    col._on_table_attach(_col_attached)*
*  File
"/Users/jeffwidman/.virtualenvs/api_rc_flask/lib/python3.5/site-packages/sqlalchemy/sql/schema.py",
line 1306, in _on_table_attach*
*    fn(self, self.table)*
*  File
"/Users/jeffwidman/.virtualenvs/api_rc_flask/lib/python3.5/site-packages/sqlalchemy/sql/schema.py",
line 2488, in _col_attached*
*    self._check_attach(evt=True)*
*  File
"/Users/jeffwidman/.virtualenvs/api_rc_flask/lib/python3.5/site-packages/sqlalchemy/sql/schema.py",
line 2479, in _check_attach*
*    assert not evt, "Should not reach here on event call"*
*AssertionError: Should not reach here on event call*
ᐧ

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to