Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize overwrite tables #108

Open
ellisvalentiner opened this issue Dec 20, 2024 · 0 comments
Open

Customize overwrite tables #108

ellisvalentiner opened this issue Dec 20, 2024 · 0 comments

Comments

@ellisvalentiner
Copy link

The _create_overwrite_table method uses a hardcoded format for the table name and duration for the table expiration.
It would be nice to be able to provide user-defined format for the table name and to set a table expiration date using a duration or explicit date time.

def _create_overwrite_table(self) -> None:
self.table = BigQueryTable(
name=f"{self.table_name}__{time.strftime('%Y%m%d%H%M%S')}__{uuid.uuid4()}",
**self.table_opts,
)
self.table.create_table(
self.client,
self.apply_transforms,
**{
"table": {
"expires": datetime.datetime.now() + datetime.timedelta(days=1),
},
"dataset": {
"location": self.config.get(
"location",
BigQueryTable.default_dataset_options()["location"],
)
},
},
)
time.sleep(2.5) # Wait for eventual consistency

Related to #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant