dean_morin
05/03/2021, 7:59 PMtarget-snowflake. I’m getting an error when running the elt, but if I fork that repo and add the unmodified version as a custom plugin, it works fine. I’m trying to confirm that I’m not somehow using an older version.visch
05/03/2021, 11:04 PMdouwe_maan
05/03/2021, 11:08 PMmeltano invoke and meltano select , not `meltano elt`: https://gitlab.com/meltano/meltano/-/issues/2627 🙂dean_morin
05/03/2021, 11:31 PMmeltano.yml is being passed to the plugin.
It looks like it’s converted to json, then passed to the plugin as a file: https://github.com/transferwise/pipelinewise-target-snowflake/blob/master/target_snowflake/__init__.py#L429
My meltano.yml looks like:
loaders:
- name: target-snowflake
variant: transferwise
pip_url: pipelinewise-target-snowflake==1.12.0
config:
account: my-account
dbname: MY_DATABASE
user: MY_USER
warehouse: MY_WAREHOUSE
file_format: MY_SCHEMA.CSV
role: MY_ROLE
schema_mapping:
public:
target_schema: RAW_PUBLIC
If I log the file being read in there, I get:
{
"account": "my-account",
"dbname": "MY_DATABASE",
"user": "MY_USER",
"password": "hunter2",
"warehouse": "MY_WAREHOUSE",
"file_format": "MY_SCHEMA.CSV",
"default_target_schema": "TAP_POSTGRES",
"batch_size_rows": 100000,
"flush_all_streams": false,
"parallelism": 0,
"parallelism_max": 16,
"schema_mapping": {
"public.target_schema": "RAW_PUBLIC",
"public": {
"target_schema": "RAW_PUBLIC"
}
},
"disable_table_cache": false,
"add_metadata_columns": false,
"hard_delete": false,
"data_flattening_max_level": 0,
"primary_key_required": true,
"validate_records": false,
"no_compression": false,
"role": "MY_ROLE"
}dean_morin
05/03/2021, 11:31 PM"public.target_schema": "RAW_PUBLIC",dean_morin
05/03/2021, 11:32 PMtarget-snowflake | Traceback (most recent call last):
target-snowflake | File "/Users/dean/dev/hi-meltano/.meltano/loaders/target-snowflake/venv/bin/target-snowflake", line 8, in <module>
target-snowflake | sys.exit(main())
target-snowflake | File "/Users/dean/dev/hi-meltano/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py", line 438, in main
target-snowflake | table_cache, file_format_type = get_snowflake_statics(config)
target-snowflake | File "/Users/dean/dev/hi-meltano/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py", line 79, in get_snowflake_statics
target-snowflake | table_schemas=stream_utils.get_schema_names_from_config(config))
target-snowflake | File "/Users/dean/dev/hi-meltano/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/stream_utils.py", line 43, in get_schema_names_from_config
target-snowflake | schema_names.append(target.get('target_schema'))
target-snowflake | AttributeError: 'str' object has no attribute 'get'dean_morin
05/03/2021, 11:33 PMdean_morin
05/03/2021, 11:37 PMloaders:
- name: target-snowflake
pip_url: git+<https://github.com/deanmorin/pipelinewise-target-snowflake.git>
capabilities:
- catalog
- discover
- state
config:
account: my-account
dbname: MY_DATABASE
user: MY_USER
warehouse: MY_WAREHOUSE
file_format: MY_SCHEMA.CSV
role: MY_ROLE
schema_mapping:
public:
target_schema: RAW_PUBLICdean_morin
05/03/2021, 11:37 PM{
"account": "my-account",
"password": "hunter2",
"role": "MY_ROLE",
"warehouse": "MY_WAREHOUSE",
"schema": "TAP_POSTGRES",
"batch_size": 5000,
"timestamp_column": "__loaded_at",
"dbname": "MY_DATABASE",
"user": "MY_USER",
"file_format": "MY_SCHEMA.CSV",
"schema_mapping": {
"public": {
"target_schema": "PROVIDER_PUBLIC"
}
}
}dean_morin
05/03/2021, 11:37 PMdouwe_maan
05/03/2021, 11:39 PMvariant: transferwise, so it gets all of the default values for settings listed under https://meltano.com/plugins/loaders/snowflake--transferwise.html, so it makes sense it has more properties than the custom plugin you created that doesn't have those settings and defaultsdouwe_maan
05/03/2021, 11:40 PMpublic.target_schema key shouldn't be there under schema_mapping, that looks like it could a be a bug 😬 It should only have public: {target_schema: "RAW_PUBLIC" }}, not the dot-separated versiondouwe_maan
05/03/2021, 11:41 PMdouwe_maan
05/03/2021, 11:41 PMschema_mapping? Or could you set default_target_schema?dean_morin
05/03/2021, 11:43 PMdean_morin
05/03/2021, 11:44 PMdouwe_maan
05/03/2021, 11:45 PMvariant: transferwise, it's not going to know what settings it supports and what default values it should usedean_morin
05/03/2021, 11:45 PMpipeline-target-snowflake : https://meltano.com/plugins/loaders/snowflake--transferwise.htmldean_morin
05/03/2021, 11:45 PMdouwe_maan
05/03/2021, 11:46 PMschema_mapping and adding default_target_schema: RAW_PUBLICdean_morin
05/03/2021, 11:49 PMpip_url from my fork to the regular one), then it works.dean_morin
05/03/2021, 11:50 PMmeltano provide defaults that aren’t necessarily the defaults for the singer tap/target?douwe_maan
05/03/2021, 11:50 PMdouwe_maan
05/03/2021, 11:50 PMdean_morin
05/03/2021, 11:51 PMdouwe_maan
05/03/2021, 11:51 PMdean_morin
05/04/2021, 12:07 AM