Skip to content
Permalink
Browse files
perf(dbapi): set headers correctly for dynamic routing (#644)
  • Loading branch information
larkee committed Nov 18, 2021
1 parent 306a5ba commit d769ff803c41394c9c175e3de772039d816b9cb5
Showing with 9 additions and 3 deletions.
  1. +3 −1 google/cloud/spanner_dbapi/connection.py
  2. +1 −1 google/cloud/spanner_dbapi/version.py
  3. +5 −1 tests/system/test_dbapi.py
@@ -531,7 +531,9 @@ def connect(
"""

client_info = ClientInfo(
user_agent=user_agent or DEFAULT_USER_AGENT, python_version=PY_VERSION
user_agent=user_agent or DEFAULT_USER_AGENT,
python_version=PY_VERSION,
client_library_version=spanner.__version__,
)

if isinstance(credentials, str):
@@ -17,4 +17,4 @@

PY_VERSION = platform.python_version()
VERSION = pkg_resources.get_distribution("google-cloud-spanner").version
DEFAULT_USER_AGENT = "dbapi/" + VERSION
DEFAULT_USER_AGENT = "gl-dbapi/" + VERSION
@@ -409,7 +409,11 @@ def test_user_agent(shared_instance, dbapi_database):
conn = connect(shared_instance.name, dbapi_database.name)
assert (
conn.instance._client._client_info.user_agent
== "dbapi/" + pkg_resources.get_distribution("google-cloud-spanner").version
== "gl-dbapi/" + pkg_resources.get_distribution("google-cloud-spanner").version
)
assert (
conn.instance._client._client_info.client_library_version
== pkg_resources.get_distribution("google-cloud-spanner").version
)


0 comments on commit d769ff8

Please sign in to comment.