diff --git a/.riot/requirements/1169f2b.txt b/.riot/requirements/1420734.txt similarity index 58% rename from .riot/requirements/1169f2b.txt rename to .riot/requirements/1420734.txt index 08ce911402d..db4c43dd2a9 100644 --- a/.riot/requirements/1169f2b.txt +++ b/.riot/requirements/1420734.txt @@ -2,27 +2,26 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --no-annotate .riot/requirements/1169f2b.in +# pip-compile --no-annotate .riot/requirements/1420734.in # -attrs==23.1.0 -coverage[toml]==7.3.4 +attrs==23.2.0 +coverage[toml]==7.4.3 exceptiongroup==1.2.0 -greenlet==3.0.2 hypothesis==6.45.0 -importlib-metadata==7.0.0 +importlib-metadata==7.0.1 iniconfig==2.0.0 mock==5.1.0 -mysql-connector-python==8.2.0 +mysql-connector-python==8.3.0 opentracing==2.4.0 packaging==23.2 -pluggy==1.3.0 -protobuf==4.21.12 +pluggy==1.4.0 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==8.0.2 pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-randomly==3.15.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==2.0.27 tomli==2.0.1 +typing-extensions==4.10.0 zipp==3.17.0 diff --git a/.riot/requirements/16653b8.txt b/.riot/requirements/16653b8.txt new file mode 100644 index 00000000000..fc3e8e603af --- /dev/null +++ b/.riot/requirements/16653b8.txt @@ -0,0 +1,23 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --no-annotate .riot/requirements/16653b8.in +# +attrs==23.2.0 +coverage[toml]==7.4.3 +hypothesis==6.45.0 +iniconfig==2.0.0 +mock==5.1.0 +mysql-connector-python==8.3.0 +opentracing==2.4.0 +packaging==23.2 +pluggy==1.4.0 +psycopg2-binary==2.9.9 +pytest==8.0.2 +pytest-cov==4.1.0 +pytest-mock==3.12.0 +pytest-randomly==3.15.0 +sortedcontainers==2.4.0 +sqlalchemy==2.0.27 +typing-extensions==4.10.0 diff --git a/.riot/requirements/16711f6.txt b/.riot/requirements/16711f6.txt new file mode 100644 index 00000000000..052c2511287 --- /dev/null +++ b/.riot/requirements/16711f6.txt @@ -0,0 +1,23 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile --no-annotate .riot/requirements/16711f6.in +# +attrs==23.2.0 +coverage[toml]==7.4.3 +hypothesis==6.45.0 +iniconfig==2.0.0 +mock==5.1.0 +mysql-connector-python==8.3.0 +opentracing==2.4.0 +packaging==23.2 +pluggy==1.4.0 +psycopg2-binary==2.9.9 +pytest==8.0.2 +pytest-cov==4.1.0 +pytest-mock==3.12.0 +pytest-randomly==3.15.0 +sortedcontainers==2.4.0 +sqlalchemy==2.0.27 +typing-extensions==4.10.0 diff --git a/.riot/requirements/249c8eb.txt b/.riot/requirements/1b75c2c.txt similarity index 58% rename from .riot/requirements/249c8eb.txt rename to .riot/requirements/1b75c2c.txt index 48f919ea34f..ecbaedd93c4 100644 --- a/.riot/requirements/249c8eb.txt +++ b/.riot/requirements/1b75c2c.txt @@ -2,27 +2,26 @@ # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # -# pip-compile --no-annotate .riot/requirements/249c8eb.in +# pip-compile --no-annotate .riot/requirements/1b75c2c.in # -attrs==23.1.0 -coverage[toml]==7.3.4 +attrs==23.2.0 +coverage[toml]==7.4.3 exceptiongroup==1.2.0 -greenlet==3.0.3 hypothesis==6.45.0 -importlib-metadata==7.0.0 +importlib-metadata==7.0.1 iniconfig==2.0.0 mock==5.1.0 -mysql-connector-python==8.2.0 +mysql-connector-python==8.3.0 opentracing==2.4.0 packaging==23.2 -pluggy==1.3.0 -protobuf==4.21.12 +pluggy==1.4.0 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==8.0.2 pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-randomly==3.15.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==2.0.27 tomli==2.0.1 +typing-extensions==4.10.0 zipp==3.17.0 diff --git a/.riot/requirements/88a4503.txt b/.riot/requirements/1e17b32.txt similarity index 60% rename from .riot/requirements/88a4503.txt rename to .riot/requirements/1e17b32.txt index 12d82f785a2..3c33c77d9a0 100644 --- a/.riot/requirements/88a4503.txt +++ b/.riot/requirements/1e17b32.txt @@ -2,25 +2,23 @@ # This file is autogenerated by pip-compile with Python 3.10 # by the following command: # -# pip-compile --no-annotate .riot/requirements/88a4503.in +# pip-compile --no-annotate .riot/requirements/1e17b32.in # -attrs==23.1.0 -coverage[toml]==7.3.4 +attrs==23.2.0 +coverage[toml]==7.4.3 exceptiongroup==1.2.0 -greenlet==3.0.3 hypothesis==6.45.0 iniconfig==2.0.0 mock==5.1.0 -mysql-connector-python==8.2.0 +mysql-connector-python==8.3.0 opentracing==2.4.0 packaging==23.2 -pluggy==1.3.0 -protobuf==4.21.12 +pluggy==1.4.0 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==8.0.2 pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-randomly==3.15.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==1.3.24 tomli==2.0.1 diff --git a/.riot/requirements/2849a6e.txt b/.riot/requirements/2849a6e.txt new file mode 100644 index 00000000000..3c1571ed191 --- /dev/null +++ b/.riot/requirements/2849a6e.txt @@ -0,0 +1,22 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile --no-annotate .riot/requirements/2849a6e.in +# +attrs==23.2.0 +coverage[toml]==7.4.3 +hypothesis==6.45.0 +iniconfig==2.0.0 +mock==5.1.0 +mysql-connector-python==8.3.0 +opentracing==2.4.0 +packaging==23.2 +pluggy==1.4.0 +psycopg2-binary==2.9.9 +pytest==8.0.2 +pytest-cov==4.1.0 +pytest-mock==3.12.0 +pytest-randomly==3.15.0 +sortedcontainers==2.4.0 +sqlalchemy==1.3.24 diff --git a/.riot/requirements/1335bb4.txt b/.riot/requirements/30cfea5.txt similarity index 83% rename from .riot/requirements/1335bb4.txt rename to .riot/requirements/30cfea5.txt index 3cf9c161714..64e5b9fe5c5 100644 --- a/.riot/requirements/1335bb4.txt +++ b/.riot/requirements/30cfea5.txt @@ -2,12 +2,11 @@ # This file is autogenerated by pip-compile with Python 3.7 # by the following command: # -# pip-compile --config=pyproject.toml --no-annotate --resolver=backtracking .riot/requirements/1335bb4.in +# pip-compile --config=pyproject.toml --no-annotate --resolver=backtracking .riot/requirements/30cfea5.in # -attrs==23.1.0 +attrs==23.2.0 coverage[toml]==7.2.7 exceptiongroup==1.2.0 -greenlet==3.0.2 hypothesis==6.45.0 importlib-metadata==6.7.0 iniconfig==2.0.0 @@ -18,12 +17,12 @@ packaging==23.2 pluggy==1.2.0 protobuf==3.20.3 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==7.4.4 pytest-cov==4.1.0 pytest-mock==3.11.1 pytest-randomly==3.12.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==1.3.24 tomli==2.0.1 typing-extensions==4.7.1 zipp==3.15.0 diff --git a/.riot/requirements/3cdaaae.txt b/.riot/requirements/3cdaaae.txt new file mode 100644 index 00000000000..12741e036f3 --- /dev/null +++ b/.riot/requirements/3cdaaae.txt @@ -0,0 +1,25 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --no-annotate .riot/requirements/3cdaaae.in +# +attrs==23.2.0 +coverage[toml]==7.4.3 +exceptiongroup==1.2.0 +hypothesis==6.45.0 +iniconfig==2.0.0 +mock==5.1.0 +mysql-connector-python==8.3.0 +opentracing==2.4.0 +packaging==23.2 +pluggy==1.4.0 +psycopg2-binary==2.9.9 +pytest==8.0.2 +pytest-cov==4.1.0 +pytest-mock==3.12.0 +pytest-randomly==3.15.0 +sortedcontainers==2.4.0 +sqlalchemy==2.0.27 +tomli==2.0.1 +typing-extensions==4.10.0 diff --git a/.riot/requirements/1de8d24.txt b/.riot/requirements/6c1588c.txt similarity index 58% rename from .riot/requirements/1de8d24.txt rename to .riot/requirements/6c1588c.txt index 9dec5adc3f8..688786e2d78 100644 --- a/.riot/requirements/1de8d24.txt +++ b/.riot/requirements/6c1588c.txt @@ -2,27 +2,25 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --no-annotate .riot/requirements/1de8d24.in +# pip-compile --no-annotate .riot/requirements/6c1588c.in # -attrs==23.1.0 -coverage[toml]==7.3.4 +attrs==23.2.0 +coverage[toml]==7.4.3 exceptiongroup==1.2.0 -greenlet==3.0.2 hypothesis==6.45.0 -importlib-metadata==7.0.0 +importlib-metadata==7.0.1 iniconfig==2.0.0 mock==5.1.0 -mysql-connector-python==8.2.0 +mysql-connector-python==8.3.0 opentracing==2.4.0 packaging==23.2 -pluggy==1.3.0 -protobuf==4.21.12 +pluggy==1.4.0 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==8.0.2 pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-randomly==3.15.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==1.3.24 tomli==2.0.1 zipp==3.17.0 diff --git a/.riot/requirements/76e99a0.txt b/.riot/requirements/74b9848.txt similarity index 58% rename from .riot/requirements/76e99a0.txt rename to .riot/requirements/74b9848.txt index 180f0c4eb7d..23ab5ac44a5 100644 --- a/.riot/requirements/76e99a0.txt +++ b/.riot/requirements/74b9848.txt @@ -2,27 +2,25 @@ # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # -# pip-compile --no-annotate .riot/requirements/76e99a0.in +# pip-compile --no-annotate .riot/requirements/74b9848.in # -attrs==23.1.0 -coverage[toml]==7.3.4 +attrs==23.2.0 +coverage[toml]==7.4.3 exceptiongroup==1.2.0 -greenlet==3.0.3 hypothesis==6.45.0 -importlib-metadata==7.0.0 +importlib-metadata==7.0.1 iniconfig==2.0.0 mock==5.1.0 -mysql-connector-python==8.2.0 +mysql-connector-python==8.3.0 opentracing==2.4.0 packaging==23.2 -pluggy==1.3.0 -protobuf==4.21.12 +pluggy==1.4.0 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==8.0.2 pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-randomly==3.15.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==1.3.24 tomli==2.0.1 zipp==3.17.0 diff --git a/.riot/requirements/17f3594.txt b/.riot/requirements/dc69f1e.txt similarity index 83% rename from .riot/requirements/17f3594.txt rename to .riot/requirements/dc69f1e.txt index c56b2e5ddff..a81e8357b21 100644 --- a/.riot/requirements/17f3594.txt +++ b/.riot/requirements/dc69f1e.txt @@ -2,12 +2,11 @@ # This file is autogenerated by pip-compile with Python 3.7 # by the following command: # -# pip-compile --config=pyproject.toml --no-annotate --resolver=backtracking .riot/requirements/17f3594.in +# pip-compile --config=pyproject.toml --no-annotate --resolver=backtracking .riot/requirements/dc69f1e.in # -attrs==23.1.0 +attrs==23.2.0 coverage[toml]==7.2.7 exceptiongroup==1.2.0 -greenlet==3.0.2 hypothesis==6.45.0 importlib-metadata==6.7.0 iniconfig==2.0.0 @@ -18,12 +17,12 @@ packaging==23.2 pluggy==1.2.0 protobuf==3.20.3 psycopg2-binary==2.9.9 -pytest==7.4.3 +pytest==7.4.4 pytest-cov==4.1.0 pytest-mock==3.11.1 pytest-randomly==3.12.0 sortedcontainers==2.4.0 -sqlalchemy==1.4.50 +sqlalchemy==2.0.27 tomli==2.0.1 typing-extensions==4.7.1 zipp==3.15.0 diff --git a/.riot/requirements/f348277.txt b/.riot/requirements/f348277.txt new file mode 100644 index 00000000000..1b9bee412fb --- /dev/null +++ b/.riot/requirements/f348277.txt @@ -0,0 +1,22 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --no-annotate .riot/requirements/f348277.in +# +attrs==23.2.0 +coverage[toml]==7.4.3 +hypothesis==6.45.0 +iniconfig==2.0.0 +mock==5.1.0 +mysql-connector-python==8.3.0 +opentracing==2.4.0 +packaging==23.2 +pluggy==1.4.0 +psycopg2-binary==2.9.9 +pytest==8.0.2 +pytest-cov==4.1.0 +pytest-mock==3.12.0 +pytest-randomly==3.15.0 +sortedcontainers==2.4.0 +sqlalchemy==1.3.24 diff --git a/riotfile.py b/riotfile.py index f30b6f14063..cec88d1a772 100644 --- a/riotfile.py +++ b/riotfile.py @@ -1271,35 +1271,12 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION): }, venvs=[ Venv( - venvs=[ - Venv( - pys=select_pys(min_version="3.7", max_version="3.9"), - pkgs={ - "sqlalchemy": ["~=1.3", "~=1.4"], - "psycopg2-binary": latest, - "mysql-connector-python": latest, - }, - ), - Venv( - # sqlalchemy added support for Python 3.10 in 1.4.26 - pys="3.10", - pkgs={ - "sqlalchemy": "~=1.4", - "psycopg2-binary": latest, - "mysql-connector-python": latest, - }, - ), - # FIXME: tests fail with sqlalchemy 2.0 - # Venv( - # # sqlalchemy added support for Python 3.11 in 2.0 - # pys="3.11", - # pkgs={ - # "sqlalchemy": ["~=2.0.0", latest], - # "psycopg2-binary": latest, - # "mysql-connector-python": latest, - # }, - # ), - ], + pys=select_pys(min_version="3.7", max_version="3.12"), + pkgs={ + "sqlalchemy": ["~=1.3.0", latest], + "psycopg2-binary": latest, + "mysql-connector-python": latest, + }, ), ], ), diff --git a/tests/contrib/sqlalchemy/mixins.py b/tests/contrib/sqlalchemy/mixins.py index da9e73319c5..92334a2a71b 100644 --- a/tests/contrib/sqlalchemy/mixins.py +++ b/tests/contrib/sqlalchemy/mixins.py @@ -4,6 +4,7 @@ from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import create_engine +from sqlalchemy import text from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker @@ -147,7 +148,7 @@ def test_session_query(self): def test_engine_connect_execute(self): # ensures that engine.connect() is properly traced with self.connection() as conn: - rows = conn.execute("SELECT * FROM players").fetchall() + rows = conn.execute(text("SELECT * FROM players")).fetchall() assert len(rows) == 0 traces = self.pop_traces() @@ -173,7 +174,7 @@ def test_opentracing(self): with ot_tracer.start_active_span("sqlalch_op"): with self.connection() as conn: - rows = conn.execute("SELECT * FROM players").fetchall() + rows = conn.execute(text("SELECT * FROM players")).fetchall() assert len(rows) == 0 traces = self.pop_traces() diff --git a/tests/contrib/sqlalchemy/test_mysql.py b/tests/contrib/sqlalchemy/test_mysql.py index 5de744b8323..a66c5308bff 100644 --- a/tests/contrib/sqlalchemy/test_mysql.py +++ b/tests/contrib/sqlalchemy/test_mysql.py @@ -1,4 +1,5 @@ import pytest +from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from ddtrace.constants import ERROR_MSG @@ -34,7 +35,7 @@ def test_engine_execute_errors(self): # ensures that SQL errors are reported with pytest.raises(ProgrammingError): with self.connection() as conn: - conn.execute("SELECT * FROM a_wrong_table").fetchall() + conn.execute(text("SELECT * FROM a_wrong_table")).fetchall() traces = self.pop_traces() # trace composition @@ -72,7 +73,7 @@ def tearDown(self): def _generate_span(self): with pytest.raises(ProgrammingError): with self.connection() as conn: - conn.execute("SELECT * FROM a_wrong_table").fetchall() + conn.execute(text("SELECT * FROM a_wrong_table")).fetchall() traces = self.pop_traces() span = traces[0][0] diff --git a/tests/contrib/sqlalchemy/test_patch.py b/tests/contrib/sqlalchemy/test_patch.py index 43b1c834d49..75dfb79db9a 100644 --- a/tests/contrib/sqlalchemy/test_patch.py +++ b/tests/contrib/sqlalchemy/test_patch.py @@ -1,4 +1,5 @@ import sqlalchemy +from sqlalchemy import text from ddtrace import Pin from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY @@ -40,7 +41,7 @@ def tearDown(self): def test_engine_traced(self): # ensures that the engine is traced - rows = self.conn.execute("SELECT 1").fetchall() + rows = self.conn.execute(text("SELECT 1")).fetchall() assert len(rows) == 1 traces = self.pop_traces() @@ -58,7 +59,7 @@ def test_engine_traced(self): def test_engine_pin_service(self): # ensures that the engine service is updated with the PIN object Pin.override(self.engine, service="replica-db") - rows = self.conn.execute("SELECT 1").fetchall() + rows = self.conn.execute(text("SELECT 1")).fetchall() assert len(rows) == 1 traces = self.pop_traces() @@ -93,7 +94,7 @@ def test_analytics_sample_rate(self): ] for config, metric_value in matrix: with self.override_config("sqlalchemy", config): - self.conn.execute("SELECT 1").fetchall() + self.conn.execute(text("SELECT 1")).fetchall() root = self.get_root_span() assert_is_measured(root) diff --git a/tests/contrib/sqlalchemy/test_postgres.py b/tests/contrib/sqlalchemy/test_postgres.py index 8c0322af4bb..3a767a96a38 100644 --- a/tests/contrib/sqlalchemy/test_postgres.py +++ b/tests/contrib/sqlalchemy/test_postgres.py @@ -1,5 +1,6 @@ import psycopg2 import pytest +from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from ddtrace.constants import ERROR_MSG @@ -33,7 +34,7 @@ def test_engine_execute_errors(self): # ensures that SQL errors are reported with pytest.raises(ProgrammingError): with self.connection() as conn: - conn.execute("SELECT * FROM a_wrong_table").fetchall() + conn.execute(text("SELECT * FROM a_wrong_table")).fetchall() traces = self.pop_traces() # trace composition diff --git a/tests/contrib/sqlalchemy/test_sqlite.py b/tests/contrib/sqlalchemy/test_sqlite.py index be4a6711b89..92d625f0ebd 100644 --- a/tests/contrib/sqlalchemy/test_sqlite.py +++ b/tests/contrib/sqlalchemy/test_sqlite.py @@ -1,4 +1,5 @@ import pytest +from sqlalchemy import text from sqlalchemy.exc import OperationalError from ddtrace.constants import ERROR_MSG @@ -26,7 +27,7 @@ def test_engine_execute_errors(self): # ensures that SQL errors are reported with pytest.raises(OperationalError): with self.connection() as conn: - conn.execute("SELECT * FROM a_wrong_table").fetchall() + conn.execute(text("SELECT * FROM a_wrong_table")).fetchall() traces = self.pop_traces() # trace composition