-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#2337) Handle array values in agate dataframe building
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
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
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
16 changes: 16 additions & 0 deletions
16
test/integration/060_run_query_tests/macros/test_pg_array_queries.sql
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,16 @@ | ||
|
||
{% macro test_array_results() %} | ||
|
||
{% set sql %} | ||
select ARRAY[1, 2, 3, 4] as mydata | ||
{% endset %} | ||
|
||
{% set result = run_query(sql) %} | ||
{% set value = result.columns['mydata'][0] %} | ||
|
||
{# This will be json-stringified #} | ||
{% if value != "[1, 2, 3, 4]" %} | ||
{% do exceptions.raise_compiler_error("Value was " ~ value) %} | ||
{% endif %} | ||
|
||
{% endmacro %} |
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,25 @@ | ||
|
||
from test.integration.base import DBTIntegrationTest, use_profile | ||
import json | ||
|
||
class TestPostgresTypes(DBTIntegrationTest): | ||
|
||
@property | ||
def schema(self): | ||
return "pg_query_types_060" | ||
|
||
@property | ||
def models(self): | ||
return "models" | ||
|
||
@property | ||
def project_config(self): | ||
return { | ||
'config-version': 2, | ||
'macro-paths': ['macros'], | ||
} | ||
|
||
@use_profile('postgres') | ||
def test__postgres_nested_types(self): | ||
result = self.run_dbt(['run-operation', 'test_array_results']) | ||
self.assertTrue(result.success) |