forked from databricks/dbt-databricks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_set_tblproperties.py
52 lines (40 loc) · 1.56 KB
/
test_set_tblproperties.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from cProfile import run
from tests.integration.base import DBTIntegrationTest, use_profile
import dbt.exceptions
import json
class TestSetTblproperties(DBTIntegrationTest):
@property
def schema(self):
return "set_tblproperties"
@property
def models(self):
return "models"
def test_set_tblproperties(self):
self.run_dbt(['seed'])
self.run_dbt(['run'])
self.run_dbt(['run'])
self.assertTablesEqual("set_tblproperties", "expected")
self.assertTablesEqual("set_tblproperties_to_view", "expected")
results = self.run_sql(
'show tblproperties {schema}.{table}'.format(
schema=self.unique_schema(), table='set_tblproperties'
),
fetch='all'
)
tblproperties = [result[0] for result in results]
assert 'delta.autoOptimize.optimizeWrite' in tblproperties
assert 'delta.autoOptimize.autoCompact' in tblproperties
results = self.run_sql(
'show tblproperties {schema}.{table}'.format(
schema=self.unique_schema(), table='set_tblproperties_to_view'
),
fetch='all'
)
tblproperties = [result[0] for result in results]
assert 'tblproperties_to_view' in tblproperties
@use_profile("databricks_cluster")
def test_set_tblproperties_databricks_cluster(self):
self.test_set_tblproperties()
@use_profile("databricks_sql_endpoint")
def test_set_tblproperties_databricks_sql_endpoint(self):
self.test_set_tblproperties()