paul_tiplady
08/12/2020, 5:27 PMtransform/* is pretty much empty). Any pointers here?
Looking at https://gitlab.com/meltano/dbt-tap-gitlab/-/tree/master/models/base, I see a bunch of .sql files -- is it possible to autogenerate these, or do they need to be built by hand? (I'm expecting they can be autogenerated as singer taps handle schema extraction, but it's not obvious to me how to do that)douwe_maan
08/12/2020, 5:48 PMdouwe_maan
08/12/2020, 5:49 PMdouwe_maan
08/12/2020, 5:54 PMSELECT * FROM source_schema.source_table , which creates a transformed table that looks exactly like the source table. Meltano could hypothetically autogenerate those based on the names of the entities, but you'd still need to fill in any column-level transformations manually.
Autogenerating these DBT models listing all column names instead of * , for you to easily remove or otherwise edit, would be cool, but suffers from the same issue I described in https://gitlab.com/meltano/meltano/-/issues/2221:
Extractors outputmessages for the loader to use, but how exactly those are translated to database tables and columns depends on the specific target, and this behavior is not identical between the different variants of target-postgres and target-snowflake that exist (see #2134). To know the actual database schema generated by the loader, we'd need to somehow get the loader to tell us, which is not currently supported by the Singer spec, but could be added in theory.SCHEMA
douwe_maan
08/12/2020, 5:55 PMtransform/my_meltano_model , which will be executed automatically when you run meltano elt with --transform=run . The names of the model files match the created tables, and inside the model files you'd reference the "raw" extracted+loaded tables.douwe_maan
08/12/2020, 5:57 PMtransform/profile/profiles.yml with the same name as your loader's namespace , presumably bigquery , so that DBT will know how to connect to your warehouse: https://docs.getdbt.com/reference/warehouse-profiles/bigquery-profile
Inside that file, you can reference your target-bigquery 's config env vars, so that you don't have to repeat your secrets.douwe_maan
08/12/2020, 5:59 PMpaul_tiplady
08/12/2020, 8:26 PMsources.yml file for my raw DB sources (to be used in DBT models) that looks like this:
version: 2
sources:
- name: monolith
tables:
- name: users
This seems to be something that could be autogenerated from the tap's input schema, to allow users to cleanly say `{{ source("monolith", "users") }} (maybe the source name should be tap-mysql in this case to be clear about where it came from?)
But that is probably just syntactic sugar to someone who is familiar with DBT.paul_tiplady
08/12/2020, 8:27 PMpaul_tiplady
08/12/2020, 8:27 PMdouwe_maan
08/12/2020, 10:15 PMdbt-tap-gitlab), we just directly referenced the schema using {{ var('schema') }}, with vars: schema: "{{ env_var('DBT_SOURCE_SCHEMA') }}" in dbt_project.yml.
DBT_SOURCE_SCHEMA here refers to the dbt plugin's source_schema setting, which has a default value of $MELTANO_LOAD_SCHEMA , which itself refers to the loader's schema setting -- see https://meltano.com/docs/command-line-interface.html#pipeline-environment-variables
That works for packages, which specify the models but shouldn't hard-code source schemas, but using explicitly named sources is definitely much better for locally defined models.
Would you like to create an issue to discuss auto-populating that file some more? 🙂paul_tiplady
08/13/2020, 4:16 PMMELTANO_LOAD_SCHEMA set, which is preventing the schema from getting set as expected (log: meltano | DEBUG Variable MELTANO_LOAD_SCHEMA is missing from the environment.)
I'm suspect this means I've not configured something correctly on the bigquery loader, any thoughts on what to look for?paul_tiplady
08/13/2020, 4:17 PMmeltano add loader to create the target-bigquery loader, I haven't added extra config.douwe_maan
08/13/2020, 4:20 PMschema setting, which is where this assumption (that works for postgres and snowflake) falls apart 🙂 If you wanted to use the DBT_SOURCE_SCHEMA env var from your models, you'd need to set manually set it to target-bigquery's schema equivalent, by adding config: source_schema: $TARGET_BIGQUERY_DATASET (or using the alias: $MELTANO_LOAD_DATASET ) to dbt s definition in your meltano.yml .douwe_maan
08/13/2020, 4:21 PMdouwe_maan
08/13/2020, 4:21 PM