Skip to content

Conversation

kmontemayor2-sc
Copy link
Collaborator

As discussed offline, we can add this to "easily" cache some bq table outputs.

This is a very naive cacheing strategy, and needs to asusme the bq table doesn't get modified, but since many of our usecases are like:

CREATE IF NOT EXIST {date_table_name}
....

Using this should be "safe" in many circumstances.

logger.exception(f"Could not run query: {e}")
raise e

def run_if_exists(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think BQ already check this if you don't set your write_disposition to WRITE_TRUNCATE and it's default to WRITE_EMPTY

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BQ returns an error 1. I don't think we want to error out in this case.

We could modify the code otherwise but I think there's use in having the name be different

Copy link
Collaborator

@yliu2-sc yliu2-sc Sep 30, 2025

Choose a reason for hiding this comment

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

shouldn't the function name be run_query_if_not_table_exists instead?

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

Successfully merging this pull request may close these issues.

3 participants