diff --git a/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py b/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py index e6042e31..d1af1db2 100644 --- a/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py +++ b/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py @@ -180,6 +180,10 @@ def pre_exec(self): if priority is not None: self._dbapi_connection.connection.request_priority = priority + request_tag = self.execution_options.get("request_tag") + if request_tag: + self.cursor.request_tag = request_tag + def fire_sequence(self, seq, type_): """Builds a statement for fetching next value of the sequence.""" return self._execute_scalar( diff --git a/test/mockserver_tests/test_basics.py b/test/mockserver_tests/test_basics.py index 28ea1b86..378ba99d 100644 --- a/test/mockserver_tests/test_basics.py +++ b/test/mockserver_tests/test_basics.py @@ -71,7 +71,9 @@ def test_sqlalchemy_select1(self): with engine.connect().execution_options( isolation_level="AUTOCOMMIT" ) as connection: - results = connection.execute(select(1)).fetchall() + results = connection.execute( + select(1).execution_options(request_tag="my-tag") + ).fetchall() self.verify_select1(results) def test_sqlalchemy_select_now(self):