Skip to content

Commit 9d2e6dc

Browse files
authored
fix: use random table when loading data for read_csv, read_json, read_parquet (#175)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent c816d84 commit 9d2e6dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bigframes/session/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ def _read_gbq_with_ordering(
806806
def _read_bigquery_load_job(
807807
self,
808808
filepath_or_buffer: str | IO["bytes"],
809-
table: bigquery.Table,
809+
table: Union[bigquery.Table, bigquery.TableReference],
810810
*,
811811
job_config: bigquery.LoadJobConfig,
812812
index_col: Iterable[str] | str = (),
@@ -1042,7 +1042,7 @@ def read_csv(
10421042
encoding: Optional[str] = None,
10431043
**kwargs,
10441044
) -> dataframe.DataFrame:
1045-
table = bigquery.Table(self._create_session_table())
1045+
table = bigframes_io.random_table(self._anonymous_dataset)
10461046

10471047
if engine is not None and engine == "bigquery":
10481048
if any(param is not None for param in (dtype, names)):
@@ -1156,7 +1156,7 @@ def read_parquet(
11561156
# Note: "engine" is omitted because it is redundant. Loading a table
11571157
# from a pandas DataFrame will just create another parquet file + load
11581158
# job anyway.
1159-
table = bigquery.Table(self._create_session_table())
1159+
table = bigframes_io.random_table(self._anonymous_dataset)
11601160

11611161
job_config = bigquery.LoadJobConfig()
11621162
job_config.create_disposition = bigquery.CreateDisposition.CREATE_IF_NEEDED
@@ -1179,7 +1179,7 @@ def read_json(
11791179
engine: Literal["ujson", "pyarrow", "bigquery"] = "ujson",
11801180
**kwargs,
11811181
) -> dataframe.DataFrame:
1182-
table = bigquery.Table(self._create_session_table())
1182+
table = bigframes_io.random_table(self._anonymous_dataset)
11831183

11841184
if engine == "bigquery":
11851185

0 commit comments

Comments
 (0)