Skip to content

Commit 1ccb896

Browse files
authored
Set quix-streams user agent in BigQuerySink (#943)
1 parent 43c3996 commit 1ccb896

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

quixstreams/sinks/community/bigquery.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Any, Mapping, Optional
77

88
try:
9+
from google.api_core.client_info import ClientInfo
910
from google.cloud import bigquery
1011
from google.cloud.exceptions import NotFound
1112
from google.oauth2 import service_account
@@ -28,6 +29,9 @@
2829

2930
logger = logging.getLogger(__name__)
3031

32+
# Bump this if there are significant changes to the sink
33+
SINK_VERSION = "1.0"
34+
3135
# A column name for the records keys
3236
_KEY_COLUMN_NAME = "__key"
3337

@@ -137,6 +141,8 @@ def __init__(
137141
scopes=["https://www.googleapis.com/auth/bigquery"],
138142
)
139143
kwargs["credentials"] = credentials
144+
user_agent = f"quixstreams-bigquery-sink/{SINK_VERSION} (GPN:Quix;)"
145+
kwargs.setdefault("client_info", ClientInfo(user_agent=user_agent))
140146
self._client: Optional[bigquery.Client] = None
141147
self._client_settings = kwargs
142148

0 commit comments

Comments
 (0)