Skip to content
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

presto notimplemented errors (#1228) #1246

Merged
merged 2 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

{% materialization archive, adapter='presto' -%}
{{ exceptions.raise_not_implemented(
'archive materialization not implemented for '+adapter.type())
}}
{% endmaterialization %}
14 changes: 14 additions & 0 deletions test/integration/001_simple_copy_test/test_simple_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ def test__postgres__dbt_doesnt_run_empty_models(self):
self.assertFalse("empty" in models.keys())
self.assertFalse("disabled" in models.keys())

@use_profile("presto")
def test__presto__simple_copy(self):
self.use_default_project({"data-paths": [self.dir("seed-initial")]})

results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
results = self.run_dbt(expect_pass=False)
self.assertEqual(len(results), 7)
for result in results:
if 'incremental' in result.node.name:
self.assertIn('not implemented for presto', result.error)

self.assertManyTablesEqual(["seed", "view_model", "materialized"])

@use_profile("snowflake")
def test__snowflake__simple_copy(self):
self.use_default_project({"data-paths": [self.dir("seed-initial")]})
Expand Down
21 changes: 21 additions & 0 deletions test/integration/004_simple_archive_test/data/seed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
id,first_name,last_name,email,gender,ip_address,updated_at
1,Judith,Kennedy,[email protected],Female,54.60.24.128,2015-12-24 12:19:28
2,Arthur,Kelly,[email protected],Male,62.56.24.215,2015-10-28 16:22:15
3,Rachel,Moreno,[email protected],Female,31.222.249.23,2016-04-05 02:05:30
4,Ralph,Turner,[email protected],Male,157.83.76.114,2016-08-08 00:06:51
5,Laura,Gonzales,[email protected],Female,30.54.105.168,2016-09-01 08:25:38
6,Katherine,Lopez,[email protected],Female,169.138.46.89,2016-08-30 18:52:11
7,Jeremy,Hamilton,[email protected],Male,231.189.13.133,2016-07-17 02:09:46
8,Heather,Rose,[email protected],Female,87.165.201.65,2015-12-29 22:03:56
9,Gregory,Kelly,[email protected],Male,154.209.99.7,2016-03-24 21:18:16
10,Rachel,Lopez,[email protected],Female,237.165.82.71,2016-08-20 15:44:49
11,Donna,Welch,[email protected],Female,103.33.110.138,2016-02-27 01:41:48
12,Russell,Lawrence,[email protected],Male,189.115.73.4,2016-06-11 03:07:09
13,Michelle,Montgomery,[email protected],Female,243.220.95.82,2016-06-18 16:27:19
14,Walter,Castillo,[email protected],Male,71.159.238.196,2016-10-06 01:55:44
15,Robin,Mills,[email protected],Female,172.190.5.50,2016-10-31 11:41:21
16,Raymond,Holmes,[email protected],Male,148.153.166.95,2016-10-03 08:16:38
17,Gary,Bishop,[email protected],Male,161.108.182.13,2016-08-29 19:35:20
18,Anna,Riley,[email protected],Female,253.31.108.22,2015-12-11 04:34:27
19,Sarah,Knight,[email protected],Female,222.220.3.177,2016-09-26 00:49:06
20,Phyllis,Fox,[email protected],Female,163.191.232.95,2016-08-21 10:35:19
45 changes: 24 additions & 21 deletions test/integration/004_simple_archive_test/test_simple_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def project_config(self):
source_table = source_table.upper()

return {
"data-paths": ['test/integration/004_simple_archive_test/data'],
"archive": [
{
"source_schema": self.unique_schema(),
Expand All @@ -29,21 +30,23 @@ def project_config(self):
"target_table": "archive_actual",
"updated_at": '"updated_at"',
"unique_key": '''"id" || '-' || "first_name"'''
}
]
}
]
},
],
},
],
}

@attr(type='postgres')
def test__postgres__simple_archive(self):
self.use_profile('postgres')
self.use_default_project()
self.run_sql_file("test/integration/004_simple_archive_test/seed.sql")
def dbt_run_seed_archive(self):
self.run_sql_file('test/integration/004_simple_archive_test/seed.sql')

results = self.run_dbt(["archive"])
self.assertEqual(len(results), 1)


@attr(type='postgres')
def test__postgres__simple_archive(self):
self.dbt_run_seed_archive()

self.assertTablesEqual("archive_expected","archive_actual")

self.run_sql_file("test/integration/004_simple_archive_test/invalidate_postgres.sql")
Expand All @@ -56,12 +59,7 @@ def test__postgres__simple_archive(self):

@attr(type='snowflake')
def test__snowflake__simple_archive(self):
self.use_profile('snowflake')
self.use_default_project()
self.run_sql_file("test/integration/004_simple_archive_test/seed.sql")

results = self.run_dbt(["archive"])
self.assertEqual(len(results), 1)
self.dbt_run_seed_archive()

self.assertTablesEqual("ARCHIVE_EXPECTED", "ARCHIVE_ACTUAL")

Expand All @@ -75,12 +73,7 @@ def test__snowflake__simple_archive(self):

@attr(type='redshift')
def test__redshift__simple_archive(self):
self.use_profile('redshift')
self.use_default_project()
self.run_sql_file("test/integration/004_simple_archive_test/seed.sql")

results = self.run_dbt(["archive"])
self.assertEqual(len(results), 1)
self.dbt_run_seed_archive()

self.assertTablesEqual("archive_expected","archive_actual")

Expand All @@ -92,6 +85,16 @@ def test__redshift__simple_archive(self):

self.assertTablesEqual("archive_expected","archive_actual")

@attr(type='presto')
def test__presto__simple_archive_disabled(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
# presto does not run archives
results = self.run_dbt(["archive"], expect_pass=False)
self.assertEqual(len(results), 1)
self.assertIn('not implemented for presto', results[0].error)



class TestSimpleArchiveBigquery(DBTIntegrationTest):

Expand Down
18 changes: 15 additions & 3 deletions test/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,18 +896,30 @@ def _assertTableColumnsEqual(self, relation_a, relation_b):
table_a_result = self.get_relation_columns(relation_a)
table_b_result = self.get_relation_columns(relation_b)

text_types = {'text', 'character varying', 'character', 'varchar'}

self.assertEqual(len(table_a_result), len(table_b_result))
for a_column, b_column in zip(table_a_result, table_b_result):
a_name, a_type, a_size = a_column
b_name, b_type, b_size = b_column
self.assertEqual(a_name, b_name)
self.assertEqual(a_type, b_type)
self.assertEqual(a_name, b_name,
'{} vs {}: column "{}" != "{}"'.format(
relation_a, relation_b, a_name, b_name
))

self.assertEqual(a_type, b_type,
'{} vs {}: column "{}" has type "{}" != "{}"'.format(
relation_a, relation_b, a_name, a_type, b_type
))

if self.adapter_type == 'presto' and None in (a_size, b_size):
# None is compatible with any size
continue

self.assertEqual(a_size, b_size)
self.assertEqual(a_size, b_size,
'{} vs {}: column "{}" has size "{}" != "{}"'.format(
relation_a, relation_b, a_name, a_size, b_size
))

def assertEquals(self, *args, **kwargs):
# assertEquals is deprecated. This makes the warnings less chatty
Expand Down