-
Notifications
You must be signed in to change notification settings - Fork 20
Description
In a recent office hours conversation with @visch, we discussed the process of adding custom plugins and how this (currently) requires the entire repo to be forked - since python code needs to be altered in order to provide new shortcut functions.
Then, I realized, Python is flexible enough to accept the following:
{
"python_imports": {
// from copy import deepcopy as "fn_copy"
"copy": {
"fn_copy": "deepcopy"
}
},
"stream_maps": {
{
"my_stream": {
// takes all fields from the record and puts them in a single object column:
"record_data": "fn_copy(record)",
"__else__": None
}
}
}
}
Obviously there are security implications and this could only be feasible in environments when the config can be trusted.
Also, there's the prerequisite of needing to install the related libraries, but there are plenty of ways to get python libraries installed and accessible for the virtual environment.
If using meltano for instance, a user could simply alter the pip_url from pip_url: meltano-map-transform
to pip_url: meltano-map-transform my_custom_lib
and then the mapper would have access to the installed library.
Another "install" option without actually building a full pip-installable module would be to set PYTHONPATH
to something that includes a local python script file.