Skip to content

Commit 03606cd

Browse files
authored
fix: default to 7 days expiration for read_csv, read_json, read_parquet (#193)
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) Follow-up to https://togithub.com/googleapis/python-bigquery-dataframes/pull/175/files#r1389686556 🦕
1 parent 9d2e6dc commit 03606cd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bigframes/session/__init__.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -836,11 +836,20 @@ def _read_bigquery_load_job(
836836
)
837837

838838
self._start_generic_job(load_job)
839+
table_id = f"{table.project}.{table.dataset_id}.{table.table_id}"
840+
841+
# Update the table expiration so we aren't limited to the default 24
842+
# hours of the anonymous dataset.
843+
table_expiration = bigquery.Table(table_id)
844+
table_expiration.expires = (
845+
datetime.datetime.now(datetime.timezone.utc) + constants.DEFAULT_EXPIRATION
846+
)
847+
self.bqclient.update_table(table_expiration, ["expires"])
839848

840849
# The BigQuery REST API for tables.get doesn't take a session ID, so we
841850
# can't get the schema for a temp table that way.
842851
return self.read_gbq_table(
843-
f"{table.project}.{table.dataset_id}.{table.table_id}",
852+
table_id,
844853
index_col=index_col,
845854
col_order=col_order,
846855
)

0 commit comments

Comments
 (0)