dbt-exasol adapter

1.10.5 · active · verified Sat Apr 11

dbt-exasol is an adapter that enables dbt (data build tool) to connect and interact with an Exasol data warehouse. It provides the necessary plumbing for dbt to compile and run SQL models against Exasol, supporting its specific SQL dialect and features. Currently at v1.10.5, the library is actively maintained with frequent releases to ensure compatibility with new dbt-core versions and address Exasol-specific behaviors.

Warnings

Install

Imports

Quickstart

To use dbt-exasol, you configure your Exasol connection details in a `profiles.yml` file, typically located in `~/.dbt/` or within your dbt project. You then define your dbt models, sources, and other resources as usual. This quickstart demonstrates the necessary `profiles.yml` and a sample model. Interaction with dbt is done through the `dbt` command-line interface (CLI).

import os

# This quickstart demonstrates the configuration for dbt-exasol.
# dbt-exasol is used via the dbt CLI, not direct Python execution of models.

# 1. Install dbt-exasol: pip install dbt-exasol

# 2. Configure your Exasol connection in ~/.dbt/profiles.yml (or project-specific):
profiles_yml_example = f'''
exasol_profile:
  target: dev
  outputs:
    dev:
      type: exasol
      host: {{os.environ.get('EXASOL_HOST', 'your_exasol_host')}}
      port: {{os.environ.get('EXASOL_PORT', 8563)}}
      schema: {{os.environ.get('EXASOL_SCHEMA', 'your_schema')}}
      user: {{os.environ.get('EXASOL_USER', 'your_user')}}
      password: {{os.environ.get('EXASOL_PASSWORD', 'your_password')}}
      # Optional advanced properties (e.g., for JDBC)
      # jdbc_properties:
      #   connectionTimeout: 10000
'''
print("Example profiles.yml content (use environment variables for security):")
print(profiles_yml_example)

# 3. Create a dbt project and specify the profile (dbt_project.yml):
# name: 'my_exasol_project'
# version: '1.0.0'
# config-version: 2
# profile: 'exasol_profile'

# 4. Create a simple dbt model (e.g., models/my_first_model.sql):
sql_model_example = '''
-- models/my_first_model.sql

SELECT
  'Hello, dbt-Exasol!' as greeting,
  CURRENT_TIMESTAMP as current_time
FROM DUAL;
'''
print("\nExample dbt model content:")
print(sql_model_example)

# 5. Run dbt commands from your project directory:
#    dbt debug --target dev
#    dbt run

if __name__ == '__main__':
    print("\nThis code provides configuration examples. Actual execution is via the dbt CLI.")
    print("Please set environment variables like EXASOL_HOST, EXASOL_USER, EXASOL_PASSWORD before running dbt commands.")

view raw JSON →