dbt jaffle shop demo doesn't work on adapter
See original GitHub issueMinimum working example
Here’s my directory
.
├── docker-compose.yml
├── dockerfile
├── jaffle_shop # is this repo https://github.com/fishtown-analytics/jaffle_shop
└── profiles.yml
# dockerfile
FROM python:3.8
RUN \
export ACCEPT_EULA=Y && \
apt-get update && \
apt-get install -y --no-install-recommends curl g++ unixodbc-dev && \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
apt-get install -y --no-install-recommends msodbcsql17 && \
pip install dbt dbt-sqlserver
COPY ./jaffle_shop/ /usr/src/app
COPY profiles.yml /root/.dbt/profiles.yml
WORKDIR /usr/src/app
CMD ["dbt", "debug"]
# profiles.yml
config:
partial_parse: false
send_anonymous_usage_stats: false
jaffle_shop:
target: jaffle
outputs:
jaffle:
type: sqlserver
driver: 'ODBC Driver 17 for SQL Server'
server: "{{ env_var('DB_HOST') }}"
port: "{{ env_var('DB_PORT') | as_number }}"
database: tempdb
schema: jaffle
user: "{{ env_var('DB_USER') }}"
password: "{{ env_var('DB_PASS') }}"
# docker-compose.yml
version: "3.1"
services:
db:
image: mcr.microsoft.com/mssql/server:2017-latest
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=Password!
dbt:
build: .
depends_on:
- db
environment:
- DB_HOST=db
- DB_PORT=1433
- DB_USER=sa
- DB_PASS=Password!
Steps to reproduce
In one terminal run the following commands in the dbt container. This shows that the profile is setup correctly, it creates the seed tables, and then successfully creates 3 views stg_orders,stg_customers,stg_payments
and 2 tables customers, orders
docker compose run dbt /bin/bash
dbt debug # works
dbt seed # works
dbt run # works
So by the end you should see:
# dbt run
Running with dbt=0.19.1
Found 5 models, 20 tests, 0 snapshots, 0 analyses, 153 macros, 0 operations, 3 seed files, 0 sources, 0 exposures
18:21:54 | Concurrency: 1 threads (target='jaffle')
18:21:54 |
18:21:54 | 1 of 5 START view model jaffle.stg_orders............................ [RUN]
18:21:54 | 1 of 5 OK created view model jaffle.stg_orders....................... [OK in 0.09s]
18:21:54 | 2 of 5 START view model jaffle.stg_payments.......................... [RUN]
18:21:54 | 2 of 5 OK created view model jaffle.stg_payments..................... [OK in 0.04s]
18:21:54 | 3 of 5 START view model jaffle.stg_customers......................... [RUN]
18:21:54 | 3 of 5 OK created view model jaffle.stg_customers.................... [OK in 0.05s]
18:21:54 | 4 of 5 START table model jaffle.orders............................... [RUN]
18:21:54 | 4 of 5 OK created table model jaffle.orders.......................... [OK in 0.07s]
18:21:54 | 5 of 5 START table model jaffle.customers............................ [RUN]
18:21:54 | 5 of 5 OK created table model jaffle.customers....................... [OK in 0.04s]
18:21:54 |
18:21:54 | Finished running 3 view models, 2 table models in 0.36s.
Completed successfully
While that is still running, in another terminal run:
docker compose exec db /opt/mssql-tools/bin/sqlcmd -S db -U sa -P Password!
1> select * from jaffle.stg_customers
2> go
# ok
1> select * from jaffle.customers
2> go
# Invalid object name 'jaffle.customers'.
Expected
I was expecting the jaffle.customers
table to exist since dbt was successful
I hope the example helps. Have I missed anything?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
dbt + Materialize demo: Running dbt's jaffle_shop with ...
This tutorial serves as a practical hands-on demonstration of the adapter. In this case, we are using static not streaming data, but the ......
Read more >dbt Guide - GitLab
If you're interested in using dbt, the dbt documentation has a great tutorial on getting setup to work on data from a fictional...
Read more >pedram on Twitter: "Time for streaming with dbt with the infamous ...
but theres a problem with this flow. ... Why can't our Jaffle Shop run continuously? ... Materialize and dbt work together through the...
Read more >Quick tip: Using dbt with SingleStoreDB | by Akmal Chaudhri
This short article will show how to set up dbt for use with SingleStoreDB. We'll also quickly apply a dbt example to test...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nice! I’ll try the new pip package
@owlas sorry for your trouble here – I think the problem is two-fold:
v0.19.1
that doesn’t surface errors happening on the server like it used to.If you don’t mind could you:
pip install git+https://github.com/dbt-msft/dbt-sqlserver.git
),