This repository was archived by the owner on Mar 13, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030FROM `{project}.{catalog}.{namespace}.{table}`
3131"""
3232
33+
3334@dataclasses .dataclass (frozen = True )
3435class BigLakeTableMetadata :
3536 schema : Sequence [google .cloud .bigquery .SchemaField ]
@@ -59,17 +60,22 @@ def get_table_metadata(
5960 job .result ()
6061 schema = job .schema
6162
62- count_rows = list (bqclient .query_and_wait (_COUNT_TEMPLATE .format (
63- project = reference .project ,
64- catalog = reference .catalog ,
65- namespace = "." .join (reference .namespace ),
66- table = reference .table ,
67- )))
68- assert len (count_rows ) == 1 , "got unexpected query response when determining number of rows"
63+ count_rows = list (
64+ bqclient .query_and_wait (
65+ _COUNT_TEMPLATE .format (
66+ project = reference .project ,
67+ catalog = reference .catalog ,
68+ namespace = "." .join (reference .namespace ),
69+ table = reference .table ,
70+ )
71+ )
72+ )
73+ assert (
74+ len (count_rows ) == 1
75+ ), "got unexpected query response when determining number of rows"
6976 total_rows = count_rows [0 ].total_rows
7077
7178 return BigLakeTableMetadata (
7279 schema = schema if schema is not None else [],
7380 num_rows = total_rows ,
7481 )
75-
Original file line number Diff line number Diff line change @@ -250,12 +250,14 @@ def _sample_bq_table(
250250 progress_bar_type : str | None ,
251251 use_bqstorage_api : bool ,
252252) -> Optional [pandas .DataFrame ]:
253- table = bqclient .get_table (google .cloud .bigquery .TableReference (
254- google .cloud .bigquery .DatasetReference (
255- reference .project_id , reference .dataset_id
256- ),
257- reference .table_id
258- ))
253+ table = bqclient .get_table (
254+ google .cloud .bigquery .TableReference (
255+ google .cloud .bigquery .DatasetReference (
256+ reference .project_id , reference .dataset_id
257+ ),
258+ reference .table_id ,
259+ )
260+ )
259261 num_rows = table .num_rows
260262 num_bytes = table .num_bytes
261263 table_type = table .table_type
Original file line number Diff line number Diff line change @@ -237,7 +237,9 @@ def test_download_results_in_parallel_no_table(
237237
238238
239239@mock .patch ("pandas_gbq.core.sample._download_results_in_parallel" )
240- def test_sample_with_tablesample (mock_download_results_in_parallel , mock_bigquery_client ):
240+ def test_sample_with_tablesample (
241+ mock_download_results_in_parallel , mock_bigquery_client
242+ ):
241243 proportion = 0.1
242244 target_row_count = 100
243245
Original file line number Diff line number Diff line change @@ -244,8 +244,7 @@ def test_create_user_agent_vscode_plugin():
244244 with mock .patch ("pathlib.Path.home" , return_value = user_home ):
245245 result = create_user_agent ()
246246 assert (
247- f"pandas-{ pd .__version__ } vscode googlecloudtools.cloudcode"
248- in result
247+ f"pandas-{ pd .__version__ } vscode googlecloudtools.cloudcode" in result
249248 )
250249
251250
You can’t perform that action at this time.
0 commit comments