I'm using SQLAlchemy and MSSQL 2019 with triggers (insert/update) can't remove .
engine_new = create_engine('mssql+pymssql://***:***@***/***', implicit_returning=False)
Session_new = sessionmaker(bind=engine_new)
session_new = Session_new()
metadata_new = MetaData()
metadata_new.reflect(bind=engine_new)
partsTable = metadata_new.tables['parts']
def addPart(dataArt, manId)
# rowInsertStmt = insert(partsTable).values(
rowInsertStmt = partsTable.insert().values(
part_kod = dataArt.get('kod'),
part_description = dataArt.get('title'),
part_kod_supplier = dataArt.get('supplier'),
part_manufacturer = manId
)
session_new.execute(rowInsertStmt)
session_new.commit()
dataArt - list with parts descriptions
manId - is of manufactures
Error message:
The target table 'parts' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.DB-Lib error message 20018
Now, I think that SQLalchemy can't work with MSSQL triggers. Because no working solution was found on the web for my situation, but in official documents this problem is not highlighted.
Any advice, please? It possible use SQLalchemy without OUTPUT? Drop SQLalchemy and use direct SQL requests?
'implicit_returning':False
? That, according to both the answer and documentation, goes in the definition of your class, not the "first line".