Skip to content

test: use random suffix in DML test table #114

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

Merged
merged 8 commits into from
Apr 7, 2021

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Apr 6, 2021

This should avoid flakes. Also, adds a table expiration so that
if cleanup fails, BigQuery will still eventually remove the
table.

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 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 #111 🦕

This should avoid flakes. Also, adds a table expiration so that
if cleanup fails, BigQuery will still eventually remove the
table.
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. label Apr 6, 2021
@tswast tswast requested a review from shollyman April 6, 2021 14:55
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Apr 6, 2021
empty_table = bigquery.Table(table_id, schema=bigquery_schema)
bigquery_client.create_table(empty_table, exists_ok=True)
# Add table expiration in case cleanup fails.
empty_table.expires = datetime.datetime.utcnow() + datetime.timedelta(days=1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than doing this to tables individually, perhaps just set the default expiration to 1d on the bigquery_dml_dataset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Done

@tswast tswast added the automerge Merge the pull request once unit tests and other checks pass. label Apr 7, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit 29c7fb0 into googleapis:master Apr 7, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests.system.test_sqlalchemy_bigquery: test_dml failed
2 participants