Using python sqlalchemy to execute raw queries with WITH statement

前端 未结 2 1395
北海茫月
北海茫月 2021-01-27 03:05

I\'m trying to insert values into a Postgres11 database with raw sqlalchemy text() queries. The following SQL query works correctly when I run it through psql-clien

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 03:53

    My question got answered on github.

    The solution is to wrap the execute in a transaction context:

    with engine.begin() as conn:
       conn.execute("whatever")
    

提交回复
热议问题