Step 1: Install dependencies
To work with DBT we must first install the Trino libraries:
pip install dbt-trino
Step 2: Create a project
Let’s init a DBT project:
dbt init
Give the project a meaningful name and select the trino database:
Step 3: Configure the database connection
In the newly created project directory create a new file named “profiles.yml”. This should contain the following:
<project name>:
target: dev
outputs:
dev:
type: trino
method: none
user: admin
database: kafka
host: streambased.cloud
port: 8443
schema: streambased
threads: 1
http_scheme: https
Step 4: Create a model
In the “models” directory create a new file with the extension “.sql” (in this example transactions.sql). This should contain the SQL you wish to run:
SELECT * FROM kafka.streambased.demo_transactions
Step 5: Run the query
We can test run the query directly with DBT:
dbt show --select models/transactions.sql