david_tout
04/26/2021, 7:09 AMmeltano invoke dbt deps but still no worky.
My log:
bt | Running with dbt=0.16.1
dbt | Found 4 models, 0 tests, 0 snapshots, 0 analyses, 127 macros, 0 operations, 0 seed files, 0 sources
dbt |
dbt | 07:04:05 | Concurrency: 2 threads (target='postgres')
dbt | 07:04:05 |
dbt | 07:04:05 | 1 of 4 START table model analytics.site_metrics...................... [RUN]
dbt | 07:04:05 | 2 of 4 START table model analytics.sites............................. [RUN]
dbt | 07:04:06 | 1 of 4 OK created table model analytics.site_metrics................. [SELECT 106 in 0.22s]
dbt | 07:04:06 | 3 of 4 START table model analytics.project_metrics................... [RUN]
dbt | 07:04:06 | 2 of 4 OK created table model analytics.sites........................ [SELECT 65 in 0.22s]
dbt | 07:04:06 | 4 of 4 START table model analytics.projects.......................... [RUN]
dbt | 07:04:06 | 4 of 4 ERROR creating table model analytics.projects................. [ERROR in 0.07s]
dbt | 07:04:06 | 3 of 4 OK created table model analytics.project_metrics.............. [SELECT 27 in 0.09s]
dbt | 07:04:06 |
dbt | 07:04:06 | Finished running 4 table models in 0.53s.
dbt |
dbt | Completed with 1 error and 0 warnings:
dbt |
dbt | Database Error in model projects (models/base/projects.sql)
dbt | column "project_group_id" does not exist
dbt | LINE 22: project_group_id
dbt | ^
dbt | compiled SQL at target/run/tap_s3_csv/base/projects.sql
"project_group_id" should actually be project_id
If I look in <meltano-project>/transform/target/compiled/<my_tap>/base/projects.sql it appears to tbe hte latest version:
WITH sites AS (
SELECT * FROM "postgres"."analytics"."sites"
),
projects AS (
SELECT
project_id,
...
Any ideas?prratek_ramchandani
04/26/2021, 12:58 PM<meltano-project>/transform/target/run/<my_tap>/base/projects.sql?david_tout
04/26/2021, 11:14 PMdouwe_maan
04/26/2021, 11:18 PM.meltano/transformers/dbt/target/run/...?douwe_maan
04/26/2021, 11:19 PMmeltano invoke dbt clean ahead of meltano invoke dbt deps, does that fix it?david_tout
04/26/2021, 11:19 PMssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ cd .meltano/transformers/dbt
ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql/.meltano/transformers/dbt$ ls
venvdouwe_maan
04/26/2021, 11:20 PMdavid_tout
04/26/2021, 11:22 PMdbt clean?
.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano invoke dbt clean
Running with dbt=0.16.1
Encountered an error:
Compilation Error
Env var required but not provided: 'DBT_TARGET'
(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano invoke dbt clean --target tap_s3_csv
Running with dbt=0.16.1
Encountered an error while reading profiles:
ERROR Runtime Error
The profile 'meltano' does not have a target named 'tap_s3_csv'. The valid target names for this profile are:
- snowflake
- postgres
- bigquery
Defined profiles:
- meltano
For more information on configuring profiles, please consult the dbt docs:
<https://docs.getdbt.com/docs/configure-your-profile>
Encountered an error:
Runtime Error
Could not run dbt
(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano invoke dbt clean --target postgres
Running with dbt=0.16.1
Encountered an error:
Compilation Error
Env var required but not provided: 'PG_ADDRESS'
That almost sounds like it's going to clean out the target database?douwe_maan
04/26/2021, 11:24 PMdouwe_maan
04/26/2021, 11:24 PMis a utility function that deletes all folders specified in thedbt cleanlist specified inclean-targets. This is useful for deleting thedbt_project.ymlanddbt_modulesdirectories.target
david_tout
04/26/2021, 11:24 PMdouwe_maan
04/26/2021, 11:24 PMdavid_tout
04/26/2021, 11:24 PMdavid_tout
04/26/2021, 11:25 PMmeltano.yml, or maybe I am better off doing a bunch of export PG_ADDRESS manually...douwe_maan
04/26/2021, 11:25 PMdavid_tout
04/26/2021, 11:25 PMexports it isdouwe_maan
04/26/2021, 11:25 PMmeltano elt, it takes the configuration context from the loader, but meltano invoke doesn't know how to do that yetdavid_tout
04/26/2021, 11:26 PMdouwe_maan
04/26/2021, 11:26 PMdbt clean and dbt deps are both run as part of meltano elt ... --transform=rundavid_tout
04/26/2021, 11:26 PMdouwe_maan
04/26/2021, 11:26 PMmeltano elt tap target --transform=onlydouwe_maan
04/26/2021, 11:27 PMdavid_tout
04/26/2021, 11:28 PMdavid_tout
04/26/2021, 11:28 PMdbt deps now, and if that fails can retry with --transform=onlydavid_tout
04/26/2021, 11:29 PMdavid_tout
04/26/2021, 11:30 PM(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano invoke dbt clean --target postgres
Running with dbt=0.16.1
Checking compile_targets/*
Cleaned compile_targets/*
Checking dbt_modules/*
Cleaned dbt_modules/*
Checking logs/*
Cleaned logs/*
Finished cleaning all paths.
Note compile_targets in there? Originally i was being too clever for my own good and messing around with paths.
I've just seen that my dbt_project.yml file in my meltano project has:
clean-targets:
- compile_targets
- dbt_modules
- logs
target-path: target
modules-path: dbt_modules
log-path: logs
D'ohdouwe_maan
04/26/2021, 11:31 PMdavid_tout
04/26/2021, 11:32 PMdavid_tout
04/26/2021, 11:32 PM(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano elt tap-s3-csv target-postgres --transform=only
meltano | Extract & load skipped.
meltano | Running transformation...
dbt | Running with dbt=0.16.1
dbt | Checking target/*
dbt | Cleaned target/*
dbt | Checking dbt_modules/*
dbt | Cleaned dbt_modules/*
dbt | Checking logs/*
dbt | Cleaned logs/*
dbt | Finished cleaning all paths.
dbt | Running with dbt=0.16.1
dbt | WARNING: The git package "<mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git" is not pinned.
dbt | This can introduce breaking changes into your project without warning!
dbt |
dbt | See <https://docs.getdbt.com/docs/package-management#section-specifying-package-versions>
dbt | WARNING: The git package "<mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git" is not pinned.
dbt | This can introduce breaking changes into your project without warning!
dbt |
dbt | See <https://docs.getdbt.com/docs/package-management#section-specifying-package-versions>
dbt | Installing <mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git@master
dbt | Installed from revision master
dbt |
dbt | Running with dbt=0.16.1
dbt | Found 4 models, 0 tests, 0 snapshots, 0 analyses, 127 macros, 0 operations, 0 seed files, 0 sources
dbt |
dbt | 23:31:44 | Concurrency: 2 threads (target='postgres')
dbt | 23:31:44 |
dbt | 23:31:44 | 1 of 4 START table model analytics.site_metrics...................... [RUN]
dbt | 23:31:44 | 2 of 4 START table model analytics.sites............................. [RUN]
dbt | 23:31:44 | 2 of 4 OK created table model analytics.sites........................ [SELECT 65 in 0.13s]
dbt | 23:31:44 | 1 of 4 OK created table model analytics.site_metrics................. [SELECT 107 in 0.13s]
dbt | 23:31:44 | 3 of 4 START table model analytics.projects.......................... [RUN]
dbt | 23:31:44 | 4 of 4 START table model analytics.project_metrics................... [RUN]
dbt | 23:31:44 | 3 of 4 ERROR creating table model analytics.projects................. [ERROR in 0.04s]
dbt | 23:31:44 | 4 of 4 OK created table model analytics.project_metrics.............. [SELECT 27 in 0.07s]
dbt | 23:31:44 |
dbt | 23:31:44 | Finished running 4 table models in 0.40s.
dbt |
dbt | Completed with 1 error and 0 warnings:
dbt |
dbt | Database Error in model projects (models/base/projects.sql)
dbt | column "project_group_id" does not exist
dbt | LINE 22: project_group_id
dbt | ^
dbt | compiled SQL at target/run/tap_s3_csv/base/projects.sql
dbt |
dbt | Done. PASS=3 WARN=0 ERROR=1 SKIP=0 TOTAL=4
meltano | Transformation failed (1): Done. PASS=3 WARN=0 ERROR=1 SKIP=0 TOTAL=4
meltano | ELT could not be completed: `dbt run` failed
ELT could not be completed: `dbt run` faileddavid_tout
04/26/2021, 11:33 PMdbt deps as well. Same issue:
(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano invoke dbt deps --target postgres
Running with dbt=0.16.1
WARNING: The git package "<mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git" is not pinned.
This can introduce breaking changes into your project without warning!
See <https://docs.getdbt.com/docs/package-management#section-specifying-package-versions>
WARNING: The git package "<mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git" is not pinned.
This can introduce breaking changes into your project without warning!
See <https://docs.getdbt.com/docs/package-management#section-specifying-package-versions>
Installing <mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git@master
Installed from revision masterdouwe_maan
04/26/2021, 11:34 PMproject_group_id ? It may be under some other hidden . directorydouwe_maan
04/26/2021, 11:46 PMdavid_tout
04/26/2021, 11:46 PMdavid_tout
04/26/2021, 11:46 PMdouwe_maan
04/26/2021, 11:47 PMdouwe_maan
04/26/2021, 11:47 PMdouwe_maan
04/26/2021, 11:48 PMclean-targets back to what it was in https://gitlab.com/meltano/files-dbt/-/blob/master/bundle/transform/dbt_project.yml#L20? Maybe that ../.meltano bit is importantdouwe_maan
04/26/2021, 11:48 PMdavid_tout
04/26/2021, 11:48 PMaaronsteers
04/26/2021, 11:56 PMtarget/run/tap_s3_csv/base/projects.sql that has a syntax or code error? Agreed with Douwe, making sure the clean-targets is set and working correctly makes sense. And you should also be able to go in and manually delete any offending files if the clean doesnโt seem to work due to relative paths or similar issue.
Do I understand correctly this is a sql transform you wrote and have since updated or deleted, or is this one of the out-of-box transforms?david_tout
04/26/2021, 11:57 PMdavid_tout
04/26/2021, 11:58 PMdbt_project.yml file back to the ../.meltano... path, and re-run thr transform:
(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ meltano elt tap-s3-csv target-postgres --transform=only
meltano | Extract & load skipped.
meltano | Running transformation...
dbt | Running with dbt=0.16.1
dbt | Checking ../.meltano/transformers/dbt/target/*
dbt | ERROR: not cleaning ../.meltano/transformers/dbt/target/* because it is protected
dbt | Checking dbt_modules/*
dbt | Cleaned dbt_modules/*
dbt | Checking logs/*
dbt | Cleaned logs/*
dbt | Finished cleaning all paths.
dbt | Running with dbt=0.16.1
dbt | WARNING: The git package "<mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git" is not pinned.
dbt | This can introduce breaking changes into your project without warning!
dbt |
dbt | See <https://docs.getdbt.com/docs/package-management#section-specifying-package-versions>
dbt | WARNING: The git package "<mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git" is not pinned.
dbt | This can introduce breaking changes into your project without warning!
dbt |
dbt | See <https://docs.getdbt.com/docs/package-management#section-specifying-package-versions>
dbt | Installing <mailto:git@gitlab.com|git@gitlab.com>:nghyway/data/dbt-tap-s3-csv-prototype.git@master
dbt | Installed from revision master
dbt |
dbt | Running with dbt=0.16.1
dbt | Found 4 models, 0 tests, 0 snapshots, 0 analyses, 127 macros, 0 operations, 0 seed files, 0 sources
dbt |
dbt | 23:58:14 | Concurrency: 2 threads (target='postgres')
dbt | 23:58:14 |
dbt | 23:58:14 | 1 of 4 START table model analytics.site_metrics...................... [RUN]
dbt | 23:58:14 | 2 of 4 START table model analytics.sites............................. [RUN]
dbt | 23:58:14 | 1 of 4 OK created table model analytics.site_metrics................. [SELECT 107 in 0.12s]
dbt | 23:58:14 | 2 of 4 OK created table model analytics.sites........................ [SELECT 65 in 0.12s]
dbt | 23:58:14 | 3 of 4 START table model analytics.project_metrics................... [RUN]
dbt | 23:58:14 | 4 of 4 START table model analytics.projects.......................... [RUN]
dbt | 23:58:15 | 4 of 4 ERROR creating table model analytics.projects................. [ERROR in 0.04s]
dbt | 23:58:15 | 3 of 4 OK created table model analytics.project_metrics.............. [SELECT 27 in 0.08s]
dbt | 23:58:15 |
dbt | 23:58:15 | Finished running 4 table models in 0.40s.
dbt |
dbt | Completed with 1 error and 0 warnings:
dbt |
dbt | Database Error in model projects (models/base/projects.sql)
dbt | column "project_group_id" does not exist
dbt | LINE 22: project_group_id
dbt | ^
dbt | compiled SQL at ../.meltano/transformers/dbt/target/run/tap_s3_csv/base/projects.sql
dbt |
dbt | Done. PASS=3 WARN=0 ERROR=1 SKIP=0 TOTAL=4
meltano | Transformation failed (1): Done. PASS=3 WARN=0 ERROR=1 SKIP=0 TOTAL=4
meltano | ELT could not be completed: `dbt run` failed
ELT could not be completed: `dbt run` faileddavid_tout
04/26/2021, 11:59 PMERROR: not cleaning ../.meltano/transformers/dbt/target/* because it is protected
However, the files in there are updated and correct...david_tout
04/27/2021, 12:01 AM.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ cat .meltano/transformers/dbt/target/compiled/tap_s3_csv/base/projects.sql
WITH sites AS (
SELECT * FROM "postgres"."analytics"."sites"
),
projects AS (
SELECT
project_id,
sum(contract_sum) AS contract_sum,
avg(latitude) AS latitude,
avg(longitude) AS longitude,
sum(opportunity_sum) AS opportunity_sum,
max(updated_at) AS updated_at
FROM
sites
GROUP BY
project_group_id
)
SELECT * FROM projects
(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ cat .meltano/transformers/dbt/target/compiled/tap_s3_csv/basels /projects.sql run/tap_s3_csv/base/projects.sql source ../.venv/bin/activate^C
(.venv) ssm-user@ip-10-47-105-208:~/dev/meltano-prototype/s3-to-psql$ cat .meltano/transformers/dbt/target/run/tap_s3_csv/base/projects.sql
create table "postgres"."analytics"."projects__dbt_tmp"
as (
WITH sites AS (
SELECT * FROM "postgres"."analytics"."sites"
),
projects AS (
SELECT
project_id,
sum(contract_sum) AS contract_sum,
avg(latitude) AS latitude,
avg(longitude) AS longitude,
sum(opportunity_sum) AS opportunity_sum,
max(updated_at) AS updated_at
FROM
sites
GROUP BY
project_group_id
)
SELECT * FROM projectsaaronsteers
04/27/2021, 12:07 AMproject_group_id column in the table projects ?aaronsteers
04/27/2021, 12:08 AMdavid_tout
04/27/2021, 12:23 AMdavid_tout
04/27/2021, 12:25 AMpostgres.analytics.sites has:
site_id | project_id |
--------------------------------------+------------+
0461ea55-2fe5-4417-8558-5429a9f59976 | 102553 |david_tout
04/27/2021, 12:27 AMsites.sql file in the model has:
WITH source AS (
SELECT * FROM {{var('schema')}}.projects
),
sites AS (
SELECT
__sdc_primary_key AS site_id,
projectgroupid AS project_id,
contract_sum,
latitude,
longitude,
opportunity_sum,
postcode AS post_code,
updated_at,
zoom_level
FROM
source
)
SELECT * FROM sites
The mistake is that originally I was going to call it project_group_id but renamed to just project_id to be simpler, and now it's stuck on the original name... ๐david_tout
04/27/2021, 12:30 AMdavid_tout
04/27/2021, 12:33 AMSELECT
project_id,
sum(contract_sum) AS contract_sum,
avg(latitude) AS latitude,
avg(longitude) AS longitude,
sum(opportunity_sum) AS opportunity_sum,
max(updated_at) AS updated_at
FROM
sites
GROUP BY
project_group_id
Oopsie!david_tout
04/27/2021, 12:42 AMdbt | 00:37:29 | Concurrency: 2 threads (target='postgres')
dbt | 00:37:29 |
dbt | 00:37:29 | 1 of 4 START table model analytics.site_metrics...................... [RUN]
dbt | 00:37:29 | 2 of 4 START table model analytics.sites............................. [RUN]
dbt | 00:37:30 | 1 of 4 OK created table model analytics.site_metrics................. [SELECT 107 in 0.15s]
dbt | 00:37:30 | 3 of 4 START table model analytics.project_metrics................... [RUN]
dbt | 00:37:30 | 2 of 4 OK created table model analytics.sites........................ [SELECT 65 in 0.16s]
dbt | 00:37:30 | 4 of 4 START table model analytics.projects.......................... [RUN]
dbt | 00:37:30 | 4 of 4 OK created table model analytics.projects..................... [SELECT 4 in 0.06s]
dbt | 00:37:30 | 3 of 4 OK created table model analytics.project_metrics.............. [SELECT 27 in 0.08s]
dbt | 00:37:30 |
dbt | 00:37:30 | Finished running 4 table models in 0.41s.
dbt |
dbt | Completed successfully
Just confirming for all that it works now ๐douwe_maan
04/27/2021, 3:01 PM