Skip to content
Advertisement

Tag: flask-sqlalchemy

SQLAlchemy changes value after commit

Seemingly out of nowhere, my Flask app is now inserting the same value for one column in a table in my database no matter what when it had been previously working. I have a model here: and code in my application: The result of the prints is So it looks like after the record is committed, the number changes and

Flask-SQLAlchemy: ‘Table’ object has no attribute ‘query_by’

I’m developing an API with Flask and I cannot retrieve queries from a MySQL database I’ve connected with flask-sqlalchemy (not sqlalchemy alone). This is a pre-existing database downloaded from my client’s PHPMyAdmin, so I haven’t ran db.create_all(): I simply created the connection string in config.py, then instantiated db = SQLAchemy() and initialized it (db.init_app(app)) in my factory function (i’m using

SQLAlchemy SQL expression with JSONB query

I have the following property on a flask-sqlalchemy model. I want to make this approved_at property a sortable column in flask-admin, but apparently I need to convert this to a hybrid property using SQL expressions. I don’t know how to convert this query into a sqlalchemy SQL expression, since it’s pretty complex with the JSONB query in it. I’ve looked

Advertisement