emre
07/06/2020, 2:19 PMcatalog.json , but meltano seems to recreate catalog.json for each run.
I couldn’t find a corresponding cli command in the docs, and tried the following command, to no avail:
meltano config <some-tap> set schema <some_table> properties <some_col>douwe_maan
07/06/2020, 3:24 PMemre
07/06/2020, 3:58 PMmetadata section of the corresponding catalog.json . Tried a couple different things but can’t change it. Let me describe in detail.douwe_maan
07/06/2020, 3:59 PMmetadata , not arbitrary properties. By design, I must add, because the rest of the file (the basic schema) is really the tap's responsibility and shouldn't need to be changed if the tap is behaving correctly. So if you'd like to make changes there, we might be looking in a bug in the tap instead...douwe_maan
07/06/2020, 4:00 PMemre
07/06/2020, 4:03 PM"anyOf": [
{
"type": "null"
},
{
"type": "number",
"multipleOf": 1e-15
},
{
"type": "string"
}
]
The multipleOf bit is causing errors, and my columns are integers anyways, so I want to swap with “type”: [“null”, “integer”]emre
07/06/2020, 4:06 PMstreams[x].schema.properties.<colname>douwe_maan
07/06/2020, 4:07 PMmultipleOf is causing errors in your target? What target may that be? I know versions exists of most if not all of them that have fixed that bug, e.g: https://github.com/meltano/target-postgres/pull/2emre
07/06/2020, 4:10 PMdecimal.DivisionImpossible error. Couldn’t pinpoint the exact culprit row yet. Didn’t want to move on to other targets before getting used to the basic ones.douwe_maan
07/06/2020, 4:11 PMdouwe_maan
07/06/2020, 4:12 PMdouwe_maan
07/06/2020, 4:12 PMdouwe_maan
07/06/2020, 4:13 PMtarget-jsonl already seems to incorporate the fix for target-postgres that was contributed in https://github.com/meltano/target-postgres/pull/2/files: https://github.com/andyh1203/target-jsonl/blob/master/target_jsonl.pydouwe_maan
07/06/2020, 4:14 PMmeltano elt output around the error message and failure? I'm sure we can figure out which row is causing trouble here 🙂emre
07/06/2020, 4:19 PMTraceback (most recent call last):
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/bin/target-jsonl", line 11, in <module>
load_entry_point('target-jsonl', 'console_scripts', 'target-jsonl')()
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/load/target-jsonl/target_jsonl.py", line 94, in main
state = persist_messages(input_messages, config.get('destination_path', ''), config.get('do_timestamp_file', True))
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/load/target-jsonl/target_jsonl.py", line 59, in persist_messages
validators[o['stream']].validate(float_to_decimal(o['record']))
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 129, in validate
for error in self.iter_errors(*args, **kwargs):
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 105, in iter_errors
for error in errors:
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/_validators.py", line 304, in properties_draft4
schema_path=property,
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 121, in descend
for error in self.iter_errors(instance, schema):
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 105, in iter_errors
for error in errors:
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/_validators.py", line 364, in anyOf_draft4
errs = list(validator.descend(instance, subschema, schema_path=index))
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 121, in descend
for error in self.iter_errors(instance, schema):
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 105, in iter_errors
for error in errors:
File "/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/_validators.py", line 127, in multipleOf
failed = instance % dB
decimal.InvalidOperation: [<class 'decimal.DivisionImpossible'>]
All the data in json are either integers or strings. The tap obviously parses integers as .0 floats.douwe_maan
07/06/2020, 4:26 PMmultipleOf was used (1e-38 ), which we fixed with decimal.getcontext().prec = 40 . In your case, 1e-15 doesn't look so bad though 😕douwe_maan
07/06/2020, 4:28 PMcatalog.json file yourself, which makes more sense when using taps with dynamic schemas, as opposed to those built for a very specific SaaS API.douwe_maan
07/06/2020, 4:29 PM/Users/emreakgun/Documents/meltano_sandbox/projects/sheets-snowflake/.meltano/loaders/target-jsonl/venv/lib/python3.7/site-packages/jsonschema/_validators.py at line 127 and adding some print-based debugging?emre
07/06/2020, 4:30 PMemre
07/06/2020, 6:50 PM<class 'decimal.Decimal'> # print(type(dB))
1E-15 # print(dB)
<class 'decimal.Decimal'> # print(type(instance))
21700000000000.0 # print(instance)
The odd thing is this value is supposed to be simply 217, it should never be that big, and isn’t throughout the sheet.emre
07/06/2020, 6:52 PMtarget-snowflake , see If the tap is producing the inflated value or the target is inflating as it parses.douwe_maan
07/06/2020, 7:23 PMmeltano invoke tap-google-sheets > records.jsonl, you may be able to find the offending record in that file by hand.
You can then pipe it into target-jsonl to reproduce the behavior of meltano elt : cat records.jsonl | meltano invoke target-jsonlemre
07/07/2020, 6:51 AM21700000000000 . For our case, 10**13 seems to be the largest integer value that the Decimal can take module of 1e-15 .emre
07/07/2020, 9:16 AMjsonschema .
Are there any plans to customize the underlying schema properties of streams as well, and not just metadata? I think it would be beneficial for taps that can be more “volatile”.douwe_maan
07/07/2020, 3:16 PMdouwe_maan
07/07/2020, 3:19 PMAre there any plans to customize the underlying schema properties of streams as well, and not just metadata? I think it would be beneficial for taps that can be more “volatile”.No concrete plans yet since you're the first to bring this up, but I'm not opposed in principle if this turns out to be a more common issue that can't always just be fixed by correcting the type hints on the source sheet/table side. If changing the cell from numeric to string fixed the problem, I'd argue that that's the more appropriate solution than explicitly telling Meltano to disregard and override the type inferred by the tap, so I wouldn't want to introduce that feature until it's clear there are cases where a more appropriate solution is not available 🙂
douwe_maan
07/07/2020, 3:20 PMemre
07/07/2020, 3:20 PMtap-google-sheets is using cell formats to attempt to determine data type. Setting the format to text let the tap assign a string type to the property.emre
07/07/2020, 3:22 PMDecimal , but it is the programmers responsibility to provide the right decimal precision.douwe_maan
07/07/2020, 3:22 PMdouwe_maan
07/07/2020, 3:22 PMdouwe_maan
07/07/2020, 3:23 PMemre
07/07/2020, 3:23 PMdivisionImpossibe error I have been getting. So this particular fix might be more suited at the target side.emre
07/07/2020, 3:23 PMdouwe_maan
07/07/2020, 3:24 PMdouwe_maan
07/07/2020, 3:24 PMemre
07/07/2020, 3:27 PMtarget-snowflake seems like it doesn’t accept anyOf statements as a data type. My tap isn’t assigning integers, and floats are assigned with an anyOf . I will either have to cast most of my columns to string in my sheets, or fork tap-google-sheets to eliminate anyOf statements.emre
07/07/2020, 3:28 PM--discover can be clunky depending on the source and robustness of tap, and I would very much appreciate an option to enforce my own data types, if I trust the underlying data and its schema, but can’t communicate this to the tap by the tools at my disposal.douwe_maan
07/07/2020, 3:38 PMtarget-snowflake not supporting anyOf is a very good point.
Overriding the types could cause trouble as well, though, since targets do actually validate the incoming RECORD messages against the schema, and changing the schema won't affect the actual values or how they're cast, so it could lead to unexpected errors in production too.
I agree this is something we'll want to address in Meltano though, even if it will come with some warnings. Would you be up for creating an issue in https://gitlab.com/meltano/meltano/-/issues so that we can discuss it some more and come up with the best way to have Meltano help out here?emre
07/07/2020, 7:52 PMdouwe_maan
07/07/2020, 7:57 PM