Skip to content

Fix sqlalchemy create engine

Derrick Liu requested to merge fix-sqlalchemy-create-engine into dev

This PR pins SQLAlchemy at a particular version (1.4.11, since it seems like there were breaking changes in the calling convention for certain methods between the original >=1.3 range and 1.4) and changes our (undocumented) use of sqlalchemy.engine.create_engine() to use sqlalchemy.engine.engine_from_config instead.

We were using create_engine(url, **kwargs) in an unsupported and undocumented way, where we passed the URL as a kwarg. As of 1.12, the supported and documented interface for create_engine() expected url as the first positional argument. I believe this officially broke as of 1.14 and caused CI tests to fail when running tests against main branches.

In this PR, I replaced the call to create_engine with engine_from_config. Since we're passing in all of the engine arguments via a dictionary, engine_from_config is the supported way to do this without changing more SQLAlchemy logic.

Edited by Derrick Liu

Merge request reports