Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,9 @@ def _ensure_bqstorage_client(
pandas_gbq = None # type: ignore

if pandas_gbq is None:
user_agent = "pandas-gbq/0.0.0"
user_agent = "pandas-gbq/0.0.0 legacy-gcb"
else:
user_agent = f"pandas-gbq/{pandas_gbq.__version__}"
user_agent = f"pandas-gbq/{pandas_gbq.__version__} legacy-gcb"

if client_info is None:
amended_client_info = google.api_core.gapic_v1.client_info.ClientInfo(
Expand Down
14 changes: 10 additions & 4 deletions packages/google-cloud-bigquery/tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ def test_ensure_bqstorage_client_pandas_gbq_installed(self):
mock_client.assert_called_once()
_, kwargs = mock_client.call_args
self.assertEqual(
kwargs["client_info"].user_agent, "app-agent pandas-gbq/0.13.0"
kwargs["client_info"].user_agent, "app-agent pandas-gbq/0.13.0 legacy-gcb"
)

def test_ensure_bqstorage_client_pandas_gbq_not_installed(self):
Expand All @@ -888,7 +888,9 @@ def test_ensure_bqstorage_client_pandas_gbq_not_installed(self):

mock_client.assert_called_once()
_, kwargs = mock_client.call_args
self.assertEqual(kwargs["client_info"].user_agent, "app-agent pandas-gbq/0.0.0")
self.assertEqual(
kwargs["client_info"].user_agent, "app-agent pandas-gbq/0.0.0 legacy-gcb"
)

def test_ensure_bqstorage_client_client_info_none(self):
bigquery_storage = pytest.importorskip("google.cloud.bigquery_storage")
Expand All @@ -905,7 +907,9 @@ def test_ensure_bqstorage_client_client_info_none(self):

mock_client.assert_called_once()
_, kwargs = mock_client.call_args
self.assertEqual(kwargs["client_info"].user_agent, "pandas-gbq/0.0.0")
self.assertEqual(
kwargs["client_info"].user_agent, "pandas-gbq/0.0.0 legacy-gcb"
)

def test_ensure_bqstorage_client_client_info_user_agent_none(self):
bigquery_storage = pytest.importorskip("google.cloud.bigquery_storage")
Expand All @@ -926,7 +930,9 @@ def test_ensure_bqstorage_client_client_info_user_agent_none(self):

mock_client.assert_called_once()
_, kwargs = mock_client.call_args
self.assertEqual(kwargs["client_info"].user_agent, "pandas-gbq/0.0.0")
self.assertEqual(
kwargs["client_info"].user_agent, "pandas-gbq/0.0.0 legacy-gcb"
)

def test_ensure_bqstorage_client_missing_dependency(self):
creds = _make_credentials()
Expand Down
Loading