ibmdb/python-ibmdbsa

executing rename table via sqlalchemy silently fails

Closed this issue · 2 comments

Hello. I have a python application and I am using sqlalchemy to manage my db2 database. I can run most sql command successfully like:

from sqlalchemy import create_engine

engine = create_engine("db2+ibm_db://userid:passwd@hostname:port/database;SECURITY=SSL;")
stmt = text("ALTER TABLE TEST.A DROP CONSTRAINT SQL191023141500200")
engine.execute(stmt)

However, when I run a rename table, it silently fails. (doesn't throw an exception)

stmt = text("RENAME TABLE TEST.TAB1 TO TAB2")

If I run the same command via other means, it works fine. Any suggestions on what the issue might be?

imavo commented

The issue might be that autocommit is disabled, meaning that the RENAME action completes but gets rolled back. The rename table works correctly for me if I enable autocommit. (ibm_db_sa 0.3.5) with Db2-LUW and SQLAlchemy 1.3.16.

solution provided.