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
4 changes: 3 additions & 1 deletion google/cloud/spanner_dbapi/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/spanner_dbapi/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion tests/system/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


Expand Down