Skip to content

Update SQLAlchemy instrumentor tests to work with SQLAlchemy 2 #2975

@tammy-baylis-swi

Description

@tammy-baylis-swi

What problem do you want to solve?

The method sqlalchemy.engine.Connection.execute still accepts a regular string as query statement in SQLAlchemy 1.4, but it's no longer possible in SQLAlchemy 2:

Deprecated since version 2.0: passing a string to Connection.execute() is deprecated and will be removed in version 2.0. Use the text() construct with Connection.execute(), or the Connection.exec_driver_sql() method to invoke a driver-level SQL string.

See also https://docs.sqlalchemy.org/en/14/core/connections.html#sqlalchemy.engine.Connection.execute

This is an issue because several of the SQLAlchemy instrumentor tests still pass str instead of sqlalchemy.text, and the tests will fail if run with SQLAlchemy 2.

Describe the solution you'd like

I will update the tests.

Describe alternatives you've considered

No response

Additional Context

Related to #2970

Would you like to implement a fix?

Yis

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions