-
Notifications
You must be signed in to change notification settings - Fork 139
APP-1316: add BigQuery expiration to elementary test temp tables #1030
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
MikaKerman
merged 6 commits into
master
from
app-1316-bigquery-add-expiration-to-elementary-test-temp-tables
Jun 25, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
65fa84e
APP-1316: add BigQuery expiration to elementary test temp tables
devin-ai-integration[bot] 3cee715
refactor: use expiration_hours param in CREATE instead of separate ALTER
devin-ai-integration[bot] 0b68aa6
fix: add expiration_hours param to all adapter dispatch macros
devin-ai-integration[bot] a9fbcfe
fix: add expiration_hours param to all create_or_replace adapter macros
devin-ai-integration[bot] de5a208
fix: forward expiration_hours in fabricspark delegate to spark macro
devin-ai-integration[bot] 39c5b5d
docs: add comment explaining non-temporary table with expiration_hours
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,64 +1,120 @@ | ||
| {% macro create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro create_or_replace(temporary, relation, sql_query, expiration_hours=none) %} | ||
| {{ | ||
| return( | ||
| adapter.dispatch("create_or_replace", "elementary")( | ||
| temporary, relation, sql_query | ||
| temporary, relation, sql_query, expiration_hours=expiration_hours | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| ) | ||
| ) | ||
| }} | ||
| {% endmacro %} | ||
|
|
||
| {# Snowflake and Bigquery #} | ||
| {% macro default__create_or_replace(temporary, relation, sql_query) %} | ||
| {% do elementary.edr_create_table_as(temporary, relation, sql_query) %} | ||
| {% macro default__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, expiration_hours=expiration_hours | ||
| ) %} | ||
| {% endmacro %} | ||
|
|
||
| {% macro redshift__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro redshift__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, drop_first=true, should_commit=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| drop_first=true, | ||
| should_commit=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% endmacro %} | ||
|
|
||
| {% macro postgres__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro postgres__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.run_query("BEGIN") %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, drop_first=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| drop_first=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% do elementary.run_query("COMMIT") %} | ||
| {% endmacro %} | ||
|
|
||
| {% macro spark__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro spark__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, drop_first=true, should_commit=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| drop_first=true, | ||
| should_commit=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% endmacro %} | ||
|
|
||
| {% macro fabricspark__create_or_replace(temporary, relation, sql_query) %} | ||
| {{ return(elementary.spark__create_or_replace(temporary, relation, sql_query)) }} | ||
| {% macro fabricspark__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {{ | ||
| return( | ||
| elementary.spark__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=expiration_hours | ||
| ) | ||
| ) | ||
| }} | ||
| {% endmacro %} | ||
|
|
||
| {% macro athena__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro athena__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, drop_first=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| drop_first=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% endmacro %} | ||
|
|
||
| {% macro trino__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro trino__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, drop_first=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| drop_first=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% endmacro %} | ||
|
|
||
| {% macro clickhouse__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro clickhouse__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, drop_first=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| drop_first=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% endmacro %} | ||
|
|
||
| {# DuckDB uses CREATE OR REPLACE TABLE, so drop_first is not needed. | ||
| should_commit=true ensures the table survives the ROLLBACK issued by test connections. #} | ||
| {% macro duckdb__create_or_replace(temporary, relation, sql_query) %} | ||
| {% macro duckdb__create_or_replace( | ||
| temporary, relation, sql_query, expiration_hours=none | ||
| ) %} | ||
| {% do elementary.edr_create_table_as( | ||
| temporary, relation, sql_query, should_commit=true | ||
| temporary, | ||
| relation, | ||
| sql_query, | ||
| should_commit=true, | ||
| expiration_hours=expiration_hours, | ||
| ) %} | ||
| {% endmacro %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment here that this table needs to survive cross-session, so it can't be temp, but we can set expiration hours for adapters that support it (currently only BQ)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 39c5b5d.