I came across a bunch of issues in a relatively simple code I got when upgraded to SQLA 2.0. Below I provided issues seen and solutions, but very much welcome any corrections. I thought this might come in handy for some. As a side note not since the move from like 0.4 to 0.5 or 0.6 did I experience SQLA working so different.
TypeError: MetaData.__init__() got an unexpected keyword argument 'bind'
meta = MeteaData(bind=e); meta.reflect(...) -> meta = MetaData(); meta.reflect(bind=e, ...)
TypeError: Connection.execute() got an unexpected keyword argument
connection.execute(q, par1=v1, par2=v2) -> connection.execute(q, dict(par1=v1, par2=v2))
sqlalchemy.exc.InvalidRequestError: This connection has already initialized a SQLAlchemy Transaction() object via begin() or autobegin; can't call begin() here unless rollback() or commit() is called first.
conn.execute() automatically starts transaction. If you use contect mgr with conn.begin() after that without commit() or rollback() you will get that error. Probably best to always use context manager? I would have preferred an option to not throw when connection is already in transaction, i.e. conn.begin(existing_ok=True).
TypeError: tuple indices must be integers or slices, not str
cur.one()['DocumentID'] -> cur.one().DocumentID
An insert statement into a varchar column with bound parameter being of type float resulted in different fomatting. Previouisly '0.1', currently
'0.1000000001'. PyODBC, MSSQL, fast_executemany=False.
AttributeError: 'Select' object has no attribute 'execute'
query.execute() does not work, must use conn.execute(query)