Henning Holgersen
01/14/2023, 2:10 PMmeltano-map-transform), and while it wasn’t difficult, it still made me wonder how it could be easier to add a custom transformation.
In my solution, I had to subclass two classes from meltano_sdk: Both PluginMapper and CustomStreamMap, because the additional feature I wanted to modify was in CustomStreamMap, but that class is instantiated in PluginMapper.
Basically, I posit that common modifications to the map transform is in modifying the CustomStreamMap class, and it makes sense to make that class more accessible.
I have doodled a possible way to do this by letting PluginMapper accept a mapper_class argument that defaults to the SDKs CustomStreamMap, but can be changed without altering PluginMapper. In other words, anyone who wants to alter the mapper can fork it, create a subclass of CustomStreamMap with the added functionality and pass it in to PluginMapper.
The code: https://github.com/radbrt/meltano-map-transform/tree/pluggable_mapper
Any thoughts are welcome.aaronsteers
01/14/2023, 2:42 PMptd
01/14/2023, 4:20 PMHenning Holgersen
01/14/2023, 5:50 PMaaronsteers
01/14/2023, 6:00 PMos or os.environ).
• Custom libraries that would presumably need to be appended to the Pip URL.
• Local paths/modules with custom code.
The third option could get us close to something like your proposal, @ptd. But mappers are somewhat unique in being able to greatly benefit from arbitrary grafts from local code or other already-existing modules. Taps and targets generally require the dedicated repo/library install source, but I guess even those could use local project-relative install sources if/when it's preferable to keep code in the project repo...
Wdyt?Henning Holgersen
01/14/2023, 6:19 PMmappers:
- name: meltano-map-transformer
variant: meltano
pip_url: git+<https://github.com/meltanolabs/meltano-map-transform.git>
mappings:
- name: some-transform
config:
stream_maps:
some-stream:
_batch_id:
library: git+<https://github.com/radbrt/hennings-transforms>
method: my_super_transform
input: record["my-untransformed-column"]aaronsteers
01/14/2023, 7:19 PMaaronsteers
01/14/2023, 7:20 PMaaronsteers
01/14/2023, 7:24 PMaaronsteers
01/14/2023, 7:25 PMHenning Holgersen
01/14/2023, 8:00 PMashish
02/13/2023, 4:54 PMRECORDS. Its like exploding the array.
I am going through the code, I have identified transform method in CustomStreamMap to modify.
Your thoughts are welcome.