-
Notifications
You must be signed in to change notification settings - Fork 371
Fix: Create empty physical tables for fully annotated self-referential models #5391
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -980,6 +980,32 @@ def test_new_forward_only_model(init_and_plan_context: t.Callable): | |
| assert context.engine_adapter.table_exists(snapshot.table_name(is_deployable=False)) | ||
|
|
||
|
|
||
| @time_machine.travel("2023-01-08 00:00:00 UTC") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a good example of a test that doesn't actually need the sushi project at all. Wouldnt this work much faster with an empty duckdb context?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It looks like this pattern has been used in other tests too. We might consider refactoring this separately. |
||
| def test_annotated_self_referential_model(init_and_plan_context: t.Callable): | ||
| context, _ = init_and_plan_context("examples/sushi") | ||
|
|
||
| # Projections are fully annotated in the query but columns were not specified explicitly | ||
| expressions = d.parse( | ||
| f""" | ||
| MODEL ( | ||
| name memory.sushi.test_self_ref, | ||
| kind FULL, | ||
| start '2023-01-01', | ||
| ); | ||
|
|
||
| SELECT 1::INT AS one FROM memory.sushi.test_self_ref; | ||
| """ | ||
| ) | ||
| model = load_sql_based_model(expressions) | ||
| assert model.depends_on_self | ||
| context.upsert_model(model) | ||
|
|
||
| context.plan("prod", skip_tests=True, no_prompts=True, auto_apply=True) | ||
|
|
||
| df = context.fetchdf("SELECT one FROM memory.sushi.test_self_ref") | ||
| assert len(df) == 0 | ||
|
|
||
|
|
||
| @time_machine.travel("2023-01-08 15:00:00 UTC") | ||
| def test_plan_set_choice_is_reflected_in_missing_intervals(init_and_plan_context: t.Callable): | ||
| context, _ = init_and_plan_context("examples/sushi") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.