SQLAlchemy 2.0 - insert() not working on tables having triggers

Viewed 23

Running the following code snippet doesn't work in SQLAlchemy 2.0:

from sqlalchemy import create_engine
eng = create_engine("mssql://:...", future=True)

with eng.connect() as conn:
    q = insert(MappedClass).values(col1='xyz')
    conn.execute(q)

It throws the following error:

ProgrammingError: ...
The target table <tablename> of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.")
[SQL: INSERT INTO <tablename> (<col1>) OUTPUT inserted.id VALUES (?)]
[parameters: ('xyz',)]
(Background on this error at: https://sqlalche.me/e/14/f405)

This works in SQLAlchemy 1.4. Can someone please let me know if this should be done in a different way in SQLAlchemy 2.0 or if it is something that will be fixed as SQLAlchemy 2.0 is still under development?

0 Answers
Related