dbt-vertica

1.8.5 · active · verified Tue Apr 14

dbt-vertica is the official adapter plugin for dbt (data build tool) that enables dbt to connect and transform data in Vertica databases. It leverages `vertica-python` for database connectivity and supports various dbt materializations and features. The library is actively maintained by Vertica, with the current version being 1.8.5, and follows the release cadence of dbt Core.

Warnings

Install

Imports

Quickstart

To get started with dbt-vertica, first install the adapter and dbt-core. Then, initialize a dbt project, configure your Vertica connection details in `profiles.yml` (using environment variables for security is recommended), and finally, run `dbt debug` to verify connectivity. You can then create and run your dbt models.

# 1. Install dbt-vertica and dbt-core (recommended for dbt Core >= 1.8)
pip install dbt-core dbt-vertica

# 2. Initialize a new dbt project
dbt init my_vertica_project
cd my_vertica_project

# 3. Configure your profiles.yml (usually located at ~/.dbt/profiles.yml)
#    Ensure you replace placeholders or set environment variables.
#    Example profiles.yml entry (use your actual values or env vars):
# my_vertica_profile:
#   target: dev
#   outputs:
#     dev:
#       type: vertica
#       host: "{{ env_var('DBT_VERTICA_HOST') }}"
#       port: "{{ env_var('DBT_VERTICA_PORT', 5433) | as_number }}"
#       username: "{{ env_var('DBT_VERTICA_USERNAME') }}"
#       password: "{{ env_var('DBT_VERTICA_PASSWORD') }}"
#       database: "{{ env_var('DBT_VERTICA_DATABASE') }}"
#       schema: "{{ env_var('DBT_VERTICA_SCHEMA') }}"

# 4. Set environment variables (replace with your Vertica connection details)
import os
os.environ['DBT_VERTICA_HOST'] = os.environ.get('DBT_VERTICA_HOST', 'your_vertica_host')
os.environ['DBT_VERTICA_PORT'] = os.environ.get('DBT_VERTICA_PORT', '5433')
os.environ['DBT_VERTICA_USERNAME'] = os.environ.get('DBT_VERTICA_USERNAME', 'your_username')
os.environ['DBT_VERTICA_PASSWORD'] = os.environ.get('DBT_VERTICA_PASSWORD', 'your_password')
os.environ['DBT_VERTICA_DATABASE'] = os.environ.get('DBT_VERTICA_DATABASE', 'your_database')
os.environ['DBT_VERTICA_SCHEMA'] = os.environ.get('DBT_VERTICA_SCHEMA', 'your_schema')

# 5. Test the connection
dbt debug --target dev --profile my_vertica_project

# 6. Create your first model (e.g., models/my_first_model.sql)
# SELECT 1 as id, 'Hello dbt!' as message

# 7. Run your dbt models
dbt run --profile my_vertica_project

view raw JSON →