I use:
CPython 2.7.3, Flask==0.10.1 Flask-SQLAlchemy==0.16 psycopg2==2.5.1 and postgresql-9.2
Trying to get PK from call insert with alchemy.
What does the engine look like:
app = Flask(__name__) app.config.from_envvar('SOME_VAR') app.wsgi_app = ProxyFix(app.wsgi_app) # Fix for old proxyes db = SQLAlchemy(app)
And executing the insert request in the application:
from sqlalchemy import text, exc def query(): return db.engine.connect().execute(text(''' insert into test...'''), kw) rv = query()
But after trying access to the inserted_primary_key property, we get:
InvalidRequestError: Statement is not an insert() expression construct.
How to enable implicit_returning in my case, reading documents does not help?
source share