Flask-SqlAlchemy: generating SQL with select function for materialized view

Viewed 39

I am trying to write a materialized view using SqlAlchemy's select() function and I am getting a TypeError: 'DefaultMeta' object is not iterable

The models are using flask-sqlalchemy and not plain sqlalchemy;

class Meta(db.Model):
    __tablename__ = "meta"

    id = db.Column(UUID, primary_key=True)
    my_col = db.Column(db.String)

Right now I am testing to make sure I get the right sql statement in a view;

@app.route("/test", methods=["GET"])
def test():
    from sqlalchemy.sql import select, join,
    foo = select(Meta)
    return str(foo)

Expecting SQLAlchemy's equivalent to SELECT * FROM meta.

1 Answers

I had to update to SQLAlchemy >= 1.4.

Related