Skip to content

Commit

Permalink
added redshift tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin committed Jan 3, 2024
1 parent 17dd19a commit 69c20ce
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion integration_tests/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ integration_tests:
type: redshift
host: dbt-testgen.117819748843.us-east-1.redshift-serverless.amazonaws.com
user: dbt_testgen
password: "{{ env_var('REDSHIFT_PASSWORD') }}"
password: mw*gXe9JMvp!0v%E #"{{ env_var('REDSHIFT_PASSWORD') }}"
dbname: dbt_testgen
schema: dbt_testgen
port: 5439
2 changes: 1 addition & 1 deletion integration_tests/seeds/colnames_with_spaces.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
First Name,Age (Years),Current City
first name,age (years),current city
John,25,New York
Alice,30,San Francisco
Bob,22,Chicago
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
models:
- name: colnames_with_spaces
columns:
- name: First Name
- name: first name
description: Accepted values test generated by dbt-testgen
tests:
- accepted_values:
values:
- Alice
- Bob
- John
- name: Age (Years)
- name: age (years)
description: Accepted values test generated by dbt-testgen
tests:
- accepted_values:
values:
- '22'
- '25'
- '30'
- name: Current City
- name: current city
description: Accepted values test generated by dbt-testgen
tests:
- accepted_values:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
models:
- name: colnames_with_spaces
columns:
- name: Age (Years)
- name: age (years)
description: Numeric range test generated by dbt-testgen
tests:
- dbt_utils.accepted_range:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
models:
- name: colnames_with_spaces
columns:
- name: First Name
- name: first name
description: Uniqueness test generated by dbt-testgen
tests:
- unique
- not_null
quote: true
- name: Age (Years)
- name: age (years)
description: Uniqueness test generated by dbt-testgen
tests:
- unique
Expand Down
2 changes: 1 addition & 1 deletion macros/helpers/columns.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro exclude_column_types(columns, exclude_types) %}
{% macro exclude_column_types(columns, exclude_types) %}
{% set filtered_columns = [] %}
{% for col in columns %}
{% if col.is_string() and "string" not in exclude_types %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
{{ return("array_agg(" ~ adapter.quote(colname) ~ "::VARCHAR)") }}
{% endmacro %}

{% macro redshift__array_agg(colname) %}
{{ return("split_to_array(listagg(" ~ adapter.quote(colname) ~ "::VARCHAR, '|'), '|') ") }}
{% endmacro %}



{% macro get_accepted_values_test_suggestions(
table_relation,
Expand Down

0 comments on commit 69c20ce

Please sign in to comment.