forked from brooklyn-data/dbt_artifacts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
134 lines (113 loc) · 9.21 KB
/
tox.ini
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
[tox]
skipsdist = True
envlist = lint_all
[sqlfluff]
dialect = snowflake
templater = dbt
rules = L001,L003,L004,L005,L006,L007,L008,L010,L011,L012,L014,L015,L017,L018,L021,L022,L023,L025,L027,L028,L030,L035,L036,L037,L039,L040,L041,L042,L045,L046,L048,L051,L055
# L001 Unnecessary trailing whitespace, sqlfluff fix compatible. # https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L001
# L003 Indentation not consistent with previous lines, sqlfluff fix compatible. # https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L003
# L004 Indentation should be with spaces, not tabs, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L004
# L005 Commas should not have whitespace directly before them, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L005
# L006 Operators should be surrounded by a single whitespace, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L006
# L007 Operators should be after newlines. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L007
# L008 Commas should be followed by a single whitespace unless followed by a comment, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L008
# L010 Inconsistent capitalisation of keywords, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L010
# L011 Implicit/explicit aliasing of table, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L011
# L012 Implicit/explicit aliasing of columns. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L012
# L014 Inconsistent capitalisation of unquoted identifiers, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L014
# L015 DISTINCT used with parentheses, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L015
# L017 Function name not immediately followed by bracket, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L017
# L018 WITH clause closing bracket should be aligned with WITH keyword, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L018
# L021 Ambiguous use of DISTINCT in select statement with GROUP BY. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L021
# L022 Blank line expected but not found after CTE closing bracket, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L022
# L023 Single whitespace expected after AS in WITH clause, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L023
# L025 Tables should not be aliased if that alias is not used, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L025
# L027 References should be qualified if select has more than one referenced table/view. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L027
# L028 References should be consistent in statements with a single table. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L028
# L030 Inconsistent capitalisation of function names, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L030
# L035 Do not specify "else null" in a case when statement (redundant), sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L035
# L036 Select targets should be on a new line unless there is only one select target, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L036
# L037 Ambiguous ordering directions for columns in order by clause, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L037
# L039 Unnecessary whitespace found, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L039
# L040 Inconsistent capitalisation of boolean/null literal. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L040
# L041 SELECT clause modifiers such as DISTINCT must be on the same line as SELECT, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L041
# L042 Join/From clauses should not contain subqueries. Use CTEs instead. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L042
# L045 Query defines a CTE (common-table expression) but does not use it, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L045
# L046 Jinja tags should have a single whitespace on either side. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L046
# L048 Quoted literals should be surrounded by a single whitespace, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L048
# L051 INNER JOIN must be fully qualified, sqlfluff fix compatible. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L051
# L055 Use LEFT JOIN instead of RIGHT JOIN. https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_L055
[sqlfluff:rules:L004]
indent_unit = space
tab_space_size = 4
[sqlfluff:rules:L010]
capitalisation_policy = lower
[sqlfluff:rules:L014]
capitalisation_policy = lower
[sqlfluff:rules:L028]
single_table_references = unqualified
[sqlfluff:rules:L030]
capitalisation_policy = lower
[sqlfluff:rules:L040]
capitalisation_policy = lower
[sqlfluff:rules:L042]
forbid_subquery_in = both
[testenv]
passenv =
DBT_PROFILES_DIR
DBT_ENV_SECRET_SNOWFLAKE_TEST_ACCOUNT
DBT_ENV_SECRET_SNOWFLAKE_TEST_USER
DBT_ENV_SECRET_SNOWFLAKE_TEST_PASSWORD
DBT_ENV_SECRET_SNOWFLAKE_TEST_ROLE
DBT_ENV_SECRET_SNOWFLAKE_TEST_DATABASE
DBT_ENV_SECRET_SNOWFLAKE_TEST_WAREHOUSE
GITHUB_SHA
deps =
dbt-snowflake~=1.0.0
sqlfluff-templater-dbt
[testenv:lint]
commands = sqlfluff lint {posargs} --ignore parsing
[testenv:lint_all]
commands = sqlfluff lint models --ignore parsing
[testenv:fix]
commands = sqlfluff fix {posargs} --ignore parsing
[testenv:fix_all]
commands = sqlfluff fix models --ignore parsing
[testenv:integration]
changedir = integration_test_project
commands =
dbt deps
# V1 upload tests
dbt run-operation drop_test_schema # Make sure we've got a clean slate
dbt run-operation create_artifact_resources
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/build/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/build_full_refresh/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/run/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/run/\}' # Upload twice to test idempotent uploads using 'merge into'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/run_full_refresh/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/seed/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/snapshot/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, sources], prefix: artifacts/schema_v4/source_freshness/\}'
dbt run-operation upload_dbt_artifacts --args '\{filenames: [manifest, run_results], prefix: artifacts/schema_v4/test/\}'
dbt run-operation dedupe_dbt_artifacts_v1 # Make sure the dedupe script succeeds.
dbt build -s dbt_artifacts --full-refresh
dbt build -s dbt_artifacts
# Test migration script
dbt run-operation migrate_artifacts_v1_to_v2
# Build (including test) again to make sure we still get the same results
dbt build -s dbt_artifacts --full-refresh
# V2 upload tests
dbt run-operation drop_test_schema # Make sure we've got a clean slate
dbt run-operation create_artifact_resources
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/build/\}'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/build_full_refresh/\}'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/run/\}'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/run/\}' # Upload twice to test idempotent uploads using 'merge into'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/run_full_refresh/\}'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/seed/\}'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/snapshot/\}'
dbt run-operation upload_dbt_artifacts_v2 --args '\{prefix: artifacts/schema_v4/test/\}'
dbt run-operation dedupe_dbt_artifacts_v2 # Make sure the dedupe script succeeds.
dbt build -s dbt_artifacts --full-refresh
dbt build -s dbt_artifacts