36
36
Tuple ,
37
37
Union ,
38
38
)
39
- import uuid
40
39
import warnings
41
40
42
41
import google .api_core .client_info
@@ -986,7 +985,7 @@ def _read_pandas(
986
985
job_config .clustering_fields = cluster_cols
987
986
job_config .labels = {"bigframes-api" : api_name }
988
987
989
- load_table_destination = self . _create_session_table ( )
988
+ load_table_destination = bigframes_io . random_table ( self . _anonymous_dataset )
990
989
load_job = self .bqclient .load_table_from_dataframe (
991
990
pandas_dataframe_copy ,
992
991
load_table_destination ,
@@ -999,8 +998,9 @@ def _read_pandas(
999
998
total_ordering_columns = frozenset ([ordering_col ]),
1000
999
integer_encoding = IntegerEncoding (True , is_sequential = True ),
1001
1000
)
1002
- table_expression = self .ibis_client .sql (
1003
- f"SELECT * FROM `{ load_table_destination .table_id } `"
1001
+ table_expression = self .ibis_client .table (
1002
+ load_table_destination .table_id ,
1003
+ database = f"{ load_table_destination .project } .{ load_table_destination .dataset_id } " ,
1004
1004
)
1005
1005
1006
1006
# b/297590178 Potentially a bug in bqclient.load_table_from_dataframe(), that only when the DF is empty, the index columns disappear in table_expression.
@@ -1278,13 +1278,6 @@ def _check_file_size(self, filepath: str):
1278
1278
"for large files to avoid loading the file into local memory."
1279
1279
)
1280
1280
1281
- def _create_session_table (self ) -> bigquery .TableReference :
1282
- table_name = f"{ uuid .uuid4 ().hex } "
1283
- dataset = bigquery .Dataset (
1284
- bigquery .DatasetReference (self .bqclient .project , "_SESSION" )
1285
- )
1286
- return dataset .table (table_name )
1287
-
1288
1281
def _create_empty_temp_table (
1289
1282
self ,
1290
1283
schema : Iterable [bigquery .SchemaField ],
@@ -1319,7 +1312,7 @@ def _create_sequential_ordering(
1319
1312
ibis .row_number ().cast (ibis_dtypes .int64 ).name (default_ordering_name )
1320
1313
)
1321
1314
table = table .mutate (** {default_ordering_name : default_ordering_col })
1322
- table_ref = self ._ibis_to_session_table (
1315
+ table_ref = self ._ibis_to_temp_table (
1323
1316
table ,
1324
1317
cluster_cols = list (index_cols ) + [default_ordering_name ],
1325
1318
api_name = api_name ,
@@ -1335,7 +1328,7 @@ def _create_sequential_ordering(
1335
1328
)
1336
1329
return table , ordering
1337
1330
1338
- def _ibis_to_session_table (
1331
+ def _ibis_to_temp_table (
1339
1332
self ,
1340
1333
table : ibis_types .Table ,
1341
1334
cluster_cols : Iterable [str ],
0 commit comments