Ability to customize _link_main values used #76
-
|
I am using flatterer to flatten a large quantity of json files that share the same schema to ingest into a database. By default, flatterer uses a generic incrementing integer starting at zero, but I would like to use the filename or one of the top level fields within the files. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
The option to solve this issue was the I have added docs now here: https://docs.flatterer.dev/options.html#id-prefix I hope this covers your use case, it prepends whatever string you specify in this option to all You might also want to look at the evolve option documentation and could consider this if inserting into a postgres or sqlite database. It will automatically add a random string if no |
Beta Was this translation helpful? Give feedback.
@sarahbehrens-cognite if using the streaming method, flatterer would not be aware of any filenames as you are only supplying it each JSON item, and no other context. For this case, for each entire stream, the
_linkvalues would start from 0 and not reset every file. So as long as for each stream (each use ofarray_item_generator) had a unique value forid-prefixthen you would not get id conflicts. So something like makingid-prefixbedatetime.datetime.now().isoformat() + '_'would mean you would never have to worry about the link IDs ever clashing.