-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert postgres index tests (#6228)
- Loading branch information
Showing
12 changed files
with
290 additions
and
239 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Under the Hood | ||
body: Convert postgres index tests to pytest | ||
time: 2022-11-08T11:56:33.743042-06:00 | ||
custom: | ||
Author: stu-k | ||
Issue: "5770" | ||
PR: "6228" |
10 changes: 0 additions & 10 deletions
10
test/integration/065_postgres_index_tests/models-invalid/invalid_columns_type.sql
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
test/integration/065_postgres_index_tests/models-invalid/invalid_type.sql
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
test/integration/065_postgres_index_tests/models-invalid/invalid_unique_config.sql
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
test/integration/065_postgres_index_tests/models-invalid/missing_columns.sql
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
test/integration/065_postgres_index_tests/models/incremental.sql
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
test/integration/065_postgres_index_tests/models/table.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
test/integration/065_postgres_index_tests/snapshots/colors.sql
This file was deleted.
Oops, something went wrong.
134 changes: 0 additions & 134 deletions
134
test/integration/065_postgres_index_tests/test_postgres_indexes.py
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
models__incremental_sql = """ | ||
{{ | ||
config( | ||
materialized = "incremental", | ||
indexes=[ | ||
{'columns': ['column_a'], 'type': 'hash'}, | ||
{'columns': ['column_a', 'column_b'], 'unique': True}, | ||
] | ||
) | ||
}} | ||
select * | ||
from ( | ||
select 1 as column_a, 2 as column_b | ||
) t | ||
{% if is_incremental() %} | ||
where column_a > (select max(column_a) from {{this}}) | ||
{% endif %} | ||
""" | ||
|
||
models__table_sql = """ | ||
{{ | ||
config( | ||
materialized = "table", | ||
indexes=[ | ||
{'columns': ['column_a']}, | ||
{'columns': ['column_b']}, | ||
{'columns': ['column_a', 'column_b']}, | ||
{'columns': ['column_b', 'column_a'], 'type': 'btree', 'unique': True}, | ||
{'columns': ['column_a'], 'type': 'hash'} | ||
] | ||
) | ||
}} | ||
select 1 as column_a, 2 as column_b | ||
""" | ||
|
||
models_invalid__invalid_columns_type_sql = """ | ||
{{ | ||
config( | ||
materialized = "table", | ||
indexes=[ | ||
{'columns': 'column_a, column_b'}, | ||
] | ||
) | ||
}} | ||
select 1 as column_a, 2 as column_b | ||
""" | ||
|
||
models_invalid__invalid_type_sql = """ | ||
{{ | ||
config( | ||
materialized = "table", | ||
indexes=[ | ||
{'columns': ['column_a'], 'type': 'non_existent_type'}, | ||
] | ||
) | ||
}} | ||
select 1 as column_a, 2 as column_b | ||
""" | ||
|
||
models_invalid__invalid_unique_config_sql = """ | ||
{{ | ||
config( | ||
materialized = "table", | ||
indexes=[ | ||
{'columns': ['column_a'], 'unique': 'yes'}, | ||
] | ||
) | ||
}} | ||
select 1 as column_a, 2 as column_b | ||
""" | ||
|
||
models_invalid__missing_columns_sql = """ | ||
{{ | ||
config( | ||
materialized = "table", | ||
indexes=[ | ||
{'unique': True}, | ||
] | ||
) | ||
}} | ||
select 1 as column_a, 2 as column_b | ||
""" | ||
|
||
snapshots__colors_sql = """ | ||
{% snapshot colors %} | ||
{{ | ||
config( | ||
target_database=database, | ||
target_schema=schema, | ||
unique_key='id', | ||
strategy='check', | ||
check_cols=['color'], | ||
indexes=[ | ||
{'columns': ['id'], 'type': 'hash'}, | ||
{'columns': ['id', 'color'], 'unique': True}, | ||
] | ||
) | ||
}} | ||
{% if var('version') == 1 %} | ||
select 1 as id, 'red' as color union all | ||
select 2 as id, 'green' as color | ||
{% else %} | ||
select 1 as id, 'blue' as color union all | ||
select 2 as id, 'green' as color | ||
{% endif %} | ||
{% endsnapshot %} | ||
""" | ||
|
||
seeds__seed_csv = """country_code,country_name | ||
US,United States | ||
CA,Canada | ||
GB,United Kingdom | ||
""" |
Oops, something went wrong.