Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ rows for example `Cursor.fetchone()` or `Cursor.fetchmany()`. By default

**Compatibility**

`trino.sqlalchemy` is compatible with 1.3.x and 1.4.x SQLAlchemy versions. Unit and integrations tests against latest versions of both versions.
`trino.sqlalchemy` is compatible with the latest 1.3.x and 1.4.x SQLAlchemy
versions at the time of release of a particular version of the client.

**Installation**

Expand Down
31 changes: 8 additions & 23 deletions tests/integration/test_dbapi_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ def test_use_catalog_schema(trino_connection):


@pytest.mark.skipif(trino_version() == '351', reason="current_catalog not supported in older Trino versions")
def test_use_catalog(run_trino):
def test_use_schema(run_trino):
_, host, port = run_trino

trino_connection = trino.dbapi.Connection(
Expand All @@ -1036,8 +1036,7 @@ def test_use_catalog(run_trino):
assert result[0][1] == 'sf1'


@pytest.mark.skipif(trino_version() == '351', reason="Newer Trino versions return the system role")
def test_set_role_trino_higher_351(run_trino):
def test_set_role(run_trino):
_, host, port = run_trino

trino_connection = trino.dbapi.Connection(
Expand All @@ -1050,28 +1049,14 @@ def test_set_role_trino_higher_351(run_trino):

cur.execute("SET ROLE ALL")
cur.fetchall()
assert_role_headers(cur, "system=ALL")


@pytest.mark.skipif(trino_version() != '351', reason="Trino 351 returns the role for the current catalog")
def test_set_role_trino_351(run_trino):
_, host, port = run_trino

trino_connection = trino.dbapi.Connection(
host=host, port=port, user="test", catalog="tpch"
)
cur = trino_connection.cursor()
cur.execute('SHOW TABLES FROM information_schema')
cur.fetchall()
assert cur._request._client_session.roles == {}

cur.execute("SET ROLE ALL")
cur.fetchall()
assert_role_headers(cur, "tpch=ALL")
if trino_version() == "351":
assert_role_headers(cur, "tpch=ALL")
else:
# Newer Trino versions return the system role
assert_role_headers(cur, "system=ALL")


@pytest.mark.skipif(trino_version() == '351', reason="Newer Trino versions return the system role")
def test_set_role_in_connection_trino_higher_351(run_trino):
def test_set_role_in_connection(run_trino):
_, host, port = run_trino

trino_connection = trino.dbapi.Connection(
Expand Down