Commit 2ab66fb
feat: add Vertica adapter support (#963)
* Remove extra newlines that Vertica could not parse
Without trimming the leading and trailing newlines, Vertica would fail to parse the
compiled SQL. For example, `models/edr/dbt_artifacts/dbt_columns`
compiles the following SQL, via `elementary.get_dbt_columns_empty_table_query`, `empty_table` and `empty_column`:
```sql
select * from (
select
cast('dummy_string' as varchar(4096)) as unique_id
,
cast('dummy_string' as varchar(4096)) as parent_unique_id
,
cast('dummy_string' as varchar(4096)) as name
,
cast('dummy_string' as varchar(4096)) as data_type
,
cast('this_is_just_a_long_dummy_string' as varchar(4096)) as tags
,
cast('this_is_just_a_long_dummy_string' as varchar(4096)) as meta
,
cast('dummy_string' as varchar(4096)) as database_name
,
cast('dummy_string' as varchar(4096)) as schema_name
,
cast('dummy_string' as varchar(4096)) as table_name
,
cast('this_is_just_a_long_dummy_string' as varchar(4096)) as description
,
cast('dummy_string' as varchar(4096)) as resource_type
,
cast('dummy_string' as varchar(4096)) as generated_at
,
cast('dummy_string' as varchar(4096)) as metadata_hash
) as empty_table
where 1 = 0
```
which would cause
```
SQL Error [4856] [42601]: [Vertica][VJDBC](4856) ERROR: Syntax error at or near ")" at character 1
```
By trimming the newlines, the SQL is much tighter:
```sql
select * from (
select
cast('dummy_string' as varchar(4096)) as unique_id,
cast('dummy_string' as varchar(4096)) as parent_unique_id,
cast('dummy_string' as varchar(4096)) as name,
cast('dummy_string' as varchar(4096)) as data_type,
cast('this_is_just_a_long_dummy_string' as varchar(4096)) as tags,
cast('this_is_just_a_long_dummy_string' as varchar(4096)) as meta,
cast('dummy_string' as varchar(4096)) as database_name,
cast('dummy_string' as varchar(4096)) as schema_name,
cast('dummy_string' as varchar(4096)) as table_name,
cast('this_is_just_a_long_dummy_string' as varchar(4096)) as description,
cast('dummy_string' as varchar(4096)) as resource_type,
cast('dummy_string' as varchar(4096)) as generated_at,
cast('dummy_string' as varchar(4096)) as metadata_hash
) as empty_table
where 1 = 0
```
and this runs in Vertica just fine.
* Add Vertica-specific escape macro
This fixed 4 or 5 errors when running in my test project.
* Add Vertica-specific timeadd macro
* Attempt to set up Vertica in CI
* Debug missing port
* Add more missing env vars for CI
I thought I might have to add these and not just `VERTICA_PORT`.
* Try opentext namespace for CI image
* Use Ratio's Vertica-CE
I can't tell if OpenText pulled Vertica or what, but both the vertica
and opentext namespaces were failing. Luckily I had the image pulled
locally.
* Add dbt-vertica-version
dbt-vertica versions match dbt-core versions, and they are a bit behind,
which is why we default to the latest available: 1.8.5.
* Start Vertica after schema has been determined
* Use Ratio's GitHub package for vertica-ce
This should be a lot faster than pulling from docker.io
* Set Vertica env vars & persist across steps
* Forgot VERTICA_HOST
* Address CodeRabbit nit
* Try a healthcheck before moving on with Vertica
I'm seeing `Database Error: [Errno 32] Broken pipe` in the `Check DWH
connection` step.
* Use env vars for Vertica healthcheck
* Add test/CI profiles.yml fixture file
I use this for local dev via
`DBT_PROFILES_DIR="path/to/.github/fixtures/" and for GitHub Actions
secret `CI_PROFILES_YML`.
Linux+Wayland: `base64 .github/fixtures/profiles.yml | wl-copy`
MacOS: `base64 .github/fixtures/profiles.yml | pbcopy`
* Ignore the .user.yml in the fixtures dir
* fix: export SCHEMA_NAME to GITHUB_ENV for Vertica docker-compose
The Vertica docker-compose and env vars steps need SCHEMA_NAME to be
available across GitHub Actions steps.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: inline Vertica credentials instead of using env vars
Hardcode Vertica connection values directly in docker-compose-vertica.yml
(matching the pattern of other local adapters like sqlserver) and remove
the "Set Vertica environment variables" CI step.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* revert: remove unnecessary SCHEMA_NAME export to GITHUB_ENV
No longer needed since Vertica env vars step was removed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: remove dbt-vertica-version input parameter
Just install latest dbt-vertica instead of pinning a specific version.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: Vertica adapter compatibility fixes for integration tests
- Add VerticaDirectSeeder with direct vertica_python connection for atomic DDL+DML+COMMIT
- Add vertica__get_normalized_data_type macro to normalize VARCHAR/INT types
- Add vertica__get_default_config with query_max_size=250000
- Truncate message field in on_run_result_query_exceed to handle long error messages
- Add vertica__edr_type_string (varchar(16000)) and vertica__edr_type_long_string (varchar(32000))
- Add vertica__full_name_split using split_part instead of array subscripts
- Add vertica__buckets_cte, vertica__target_database, vertica__day_of_week, vertica__hour_of_week
- Add vertica__get_relation_max_length with Vertica identifier limit (128 chars)
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* fix: upgrade dbt-core for Vertica CI to support 'arguments' test property
dbt-vertica pins dbt-core~=1.8 which lacks native support for the
'arguments' test property used by the integration-test framework.
This caused all Vertica tests to fail in CI with:
macro 'dbt_macro__test_volume_anomalies' takes no keyword argument 'arguments'
Upgrade dbt-core after installing dbt-vertica (dbt-vertica 1.8.5
works fine with newer dbt-core versions, as verified locally).
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* fix: install dbt-vertica with --no-deps to allow latest dbt-core
The previous approach (pip install dbt-core after dbt-vertica) didn't
upgrade because pip saw 1.8.5 as satisfying the bare requirement.
Install dbt-vertica --no-deps then install vertica-python + dbt-core
separately so the latest dbt-core is used.
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* fix: override dbt-vertica seed macro to use unique reject table per seed
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* fix: address Vertica CI workflow, schema cleanup, and stddev precision
1. CI workflow: honor dbt-version input for Vertica installs and reject
unsupported Vertica+Fusion combinations with explicit error message.
2. Schema cleanup: add Vertica dispatches for edr_create_schema,
edr_drop_schema, edr_schema_exists, and edr_list_schemas using
v_catalog.schemata (Vertica lacks information_schema) and without
adapter.commit() (Vertica DDL is auto-committed).
3. Anomaly detection: add edr_normalize_stddev dispatched macro to
round(training_stddev, 6) on Vertica, fixing floating-point
artifacts where STDDEV returns ~4e-08 for identical values.
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* fix: add empty-seed guard and clarify query_max_size comment
- VerticaDirectSeeder.seed() now raises ValueError on empty data instead
of IndexError (consistent with other seeders)
- Updated vertica__get_default_config comment to clarify query_max_size
controls batch INSERT size, not per-column limits
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* style: address CodeRabbit nitpicks
- buckets_cte.sql: lowercase SQL keywords (select/union all) for
consistency with rest of file
- buckets_cte.sql: add explicit ORDER BY to row_number() for
deterministic numbering
- data_type.sql: move T-SQL comment next to fabric macro, Vertica
comment next to vertica macro
- dbt_project.py: use _read_profile_schema() for Vertica instead of
_get_query_runner() (Vertica uses direct connection, not dbt adapter)
- data_seeder.py: make query_runner Optional in BaseSqlInsertSeeder
since Vertica passes None
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* fix: use column references in row_number() ORDER BY for Vertica
ORDER BY 1 in a window function causes Vertica to misinterpret the
sort key, breaking bucket generation. Use explicit column references
(t1.v, t2.v, t3.v, t4.v) instead, matching the Dremio implementation.
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* revert: undo risky nitpick changes to isolate CI regression
Reverts buckets_cte.sql, dbt_project.py, and data_seeder.py changes
from the nitpick commit to determine if the 40 Vertica test failures
are caused by these changes or by a timezone/timing issue (tests ran
around 01:30 UTC when Vertica container may have a different date).
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
* style: re-apply CodeRabbit nitpick fixes (confirmed not causing CI failures)
The 40 Vertica test failures are timing-related (midnight UTC timezone
mismatch between CI runner and Vertica container), not caused by these
changes — verified by reverting all changes in f5c11ef which still
had the same 40 failures.
Changes:
- buckets_cte.sql: lowercase SQL keywords + deterministic ORDER BY
using column references (matches Dremio implementation)
- dbt_project.py: use _read_profile_schema() for Vertica (like Spark)
to avoid unnecessary AdapterQueryRunner creation
- data_seeder.py: make query_runner Optional since Vertica passes None
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
---------
Co-authored-by: Jesse Cooke <jesse@ratiopbc.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent e0637b0 commit 2ab66fb
File tree
28 files changed
+446
-19
lines changed- .github/workflows
- integration_tests
- dbt_project/macros
- ci_schemas_cleanup
- schema_utils
- profiles
- tests
- macros
- edr
- data_monitoring
- anomaly_detection
- monitors
- dbt_artifacts
- system/system_utils
- utils
- cross_db_utils
- data_types
- table_operations
- models/edr/data_monitoring/anomaly_detection
28 files changed
+446
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| |||
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| 76 | + | |
| 77 | + | |
67 | 78 | | |
68 | 79 | | |
69 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
154 | 173 | | |
155 | | - | |
| 174 | + | |
156 | 175 | | |
157 | 176 | | |
158 | 177 | | |
| |||
198 | 217 | | |
199 | 218 | | |
200 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
201 | 232 | | |
202 | 233 | | |
203 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
| |||
150 | 162 | | |
151 | 163 | | |
152 | 164 | | |
153 | | - | |
| 165 | + | |
154 | 166 | | |
155 | 167 | | |
156 | 168 | | |
| |||
0 commit comments