juan_luis_cano_rodriguez
06/21/2022, 5:10 PMmeltano invoke dbt-postgres:run with an apparently well configured transform on my PostgreSQL target using the analytics schema:
2022-06-21T16:50:25.279019Z [info ] Environment 'dev' is active
16:50:28 Running with dbt=1.0.8
16:50:28 Found 1 model, 0 tests, 0 snapshots, 0 analyses, 165 macros, 0 operations, 0 seed files, 1 source, 0 exposures, 0 metrics
16:50:28
16:50:29 Concurrency: 2 threads (target='dev')
16:50:29
16:50:29 1 of 1 START view model analytics.events_per_day................................ [RUN]
16:50:29 1 of 1 OK created view model analytics.events_per_day........................... [CREATE VIEW in 0.28s]
16:50:29
16:50:29 Finished running 1 view model in 1.01s.
16:50:29
16:50:29 Completed successfully
16:50:29
16:50:29 Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1
and here is my model:
$ cat transform/models/tap_postgres/events_per_day.sql
SELECT
CAST("timestamp" AS date) AS "timestamp"
, event
, distinct_id
, COUNT(*) as "count"
FROM {{ source('tap_postgres', 'telemetry_events') }}
GROUP BY
CAST("timestamp" AS date)
, event
, distinct_id
however, I don't see any new tables in the target. I would have expected this query to run for much longer by the way, since the source table is quite big. any way to debug what's happening here?
(edit: solved βοΈ )visch
06/21/2022, 5:12 PM16:50:29 1 of 1 OK created view model analytics.events_per_day........................... [CREATE VIEW in 0.28s]
Created a view so no processing needed, that's why it's fast. Lots of debug options with DBT, check out ./transform/logs if you'd like to really dig
You have an analytics schema in postgresjuan_luis_cano_rodriguez
06/21/2022, 5:14 PMYou have an analytics schema in postgresyep, that one is present, but apparently empty. I'll check the logs
visch
06/21/2022, 5:14 PMselect * from analytics.events_per_dayvisch
06/21/2022, 5:15 PMjuan_luis_cano_rodriguez
06/21/2022, 5:20 PMselect * from analytics.events_per_day returns stuff, but I was confused because there were no tables listed in SELECT * FROM <http://pg_catalog.pg|pg_catalog.pg>_tables with that name, nor select * from pg_matviews. I was missing "views" (which are not "materialized views"), hence select * from information_schema.views). glad I sorted this out quickly, thanks!visch
06/21/2022, 5:20 PMjuan_luis_cano_rodriguez
06/21/2022, 5:26 PMcesar_garcia_saez
06/21/2022, 5:42 PMchristoph
06/22/2022, 1:58 AMoh well, I think I might be missing some key PSQL knowledge hereYes, default relation type in DBT is a view, not a table. You can quickly list your views in
psql with the \dv command. (e.g. \dv analytics.*visch
06/22/2022, 2:02 AM\dv is nice πchristoph
06/22/2022, 2:06 AMjuan_luis_cano_rodriguez
06/22/2022, 6:25 AMjuan_luis_cano_rodriguez
06/22/2022, 6:25 AM