dbt adapter
dbt provides a SQL-first transformation tool for analytics engineering. The dbt-embucket adapter connects to Embucket by invoking the Lambda function directly through AWS APIs, so no public endpoint proves necessary.
Prerequisites
Section titled “Prerequisites”Before you begin, make sure you have the following:
- A deployed Embucket Lambda function and its ARN.
- AWS credentials with permission to invoke the Lambda function.
- Python 3.8 or later and dbt installed on your system.
Set up dbt with Embucket
Section titled “Set up dbt with Embucket”-
Install the adapter
Install the
dbt-embucketadapter from PyPI:Terminal window python -m pip install dbt-embucket -
Create a minimal project
Create a project directory with a model:
Terminal window mkdir embucket-dbt-demo && cd embucket-dbt-demomkdir -p modelsCreate a
dbt_project.ymlfile:name: embucket_demoversion: 1.0.0config-version: 2profile: embucketmodel-paths: ['models']models:embucket_demo:+materialized: viewCreate a
models/hello_embucket.sqlfile:select 1 as id, 'hello embucket' as message -
Configure the profile
Add the following block to your
profiles.ymlfile:embucket:target: devoutputs:dev:type: embucketfunction_arn: "{{ env_var('EMBUCKET_FUNCTION_ARN') }}"account: "{{ env_var('EMBUCKET_ACCOUNT', 'embucket') }}"user: "{{ env_var('EMBUCKET_USER', 'embucket') }}"password: "{{ env_var('EMBUCKET_PASSWORD', 'embucket') }}"database: "{{ env_var('EMBUCKET_DATABASE', 'demo') }}"schema: publicthreads: 1Export the Lambda function ARN as an environment variable:
Terminal window export EMBUCKET_FUNCTION_ARN=arn:aws:lambda:us-east-2:123456789012:function:embucket-lambdaProfile field reference
Field Required Description typeYes Set to embucket.function_arnYes ARN of the target Lambda function. accountYes Logical account identifier. userYes Authentication user name. passwordYes Authentication password. databaseYes Target database name. schemaYes Target schema name. threadsYes Number of concurrent dbt threads. -
Check the connection
Verify that dbt can reach the Lambda function:
Terminal window dbt debugA successful check produces the following output:
Connection test: [OK connection ok]All checks passed! -
Run a model
Build the example model:
Terminal window dbt rundbt compiles and runs the
hello_embucketmodel against Embucket. -
Verify the result
Query the model output with
dbt show:Terminal window dbt show --inline "select * from demo.public.hello_embucket"The query returns the following result:
+----+----------------+| ID | MESSAGE ||----+----------------|| 1 | hello embucket |+----+----------------+
Caveats
Section titled “Caveats”The adapter uses Lambda invoke transport, not a TCP connection. The adapter doesn’t support Python models. Use AWS credentials that can invoke the target Lambda function.
Troubleshooting
Section titled “Troubleshooting”| Problem | Solution |
|---|---|
profiles.yml not found | Check that the file exists in your dbt profiles directory. Run dbt debug --config-dir to locate it. |
EMBUCKET_FUNCTION_ARN missing | Export the variable before running dbt debug. |
| AWS credentials missing | The adapter needs IAM credentials with lambda:InvokeFunction permission. |
| Authentication failures | Verify the user and password values in your profile. |
| Runs succeed but data appears missing | Check the database, schema, and metastore configuration on the Lambda function. |
Next step
Section titled “Next step”For a complete analytics pipeline example, see Snowplow web analytics.