Hello dears, Hope you're having a good start of th...
# troubleshooting
c
Hello dears, Hope you're having a good start of the week. When installing my custom extractor, the python tap file extractor>tap>venv>bin is initialized to use the cli.
#!/project/.meltano/extractors/tap-whise/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from tap_whise.tap import Tapwhise
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(Tapwhise.cli())
However, I want it to use the main. Such as:
from tap_whise import main
[...]
sys.exit(main())
Can you guide me please?
Found the issue: the pyproject.toml was implying the cli as the entry point. I removed the file 🙂 The only issue left is
Copy code
ELT could not be completed: Cannot start extractor: Executable 'tap-whise' could not be found. Extractor 'tap-whise' may not have been installed yet using `meltano install extractor tap-whise`, or the executable name may be incorrect.
Obviously, I've tried the
meltano install extractor tap-whise
a
@charley_guillaume - If not using the poetry/shell approach from the SDK defaults, you'll probably need to pip-install with editable mode during testing. To do this, you can specify your pip_url prefixed with
-e
. The two options for local dev/test of taps using meltano are: (1) specify an executable and no
pip_url
, and (2) specify an 'editable mode' pip_url with the
-e
flag.
Does this help at all?
c
This seems complicated tbh. Tap is working correctly when I am using the
meltano invoke
! I'll check your method in a few minutes
a
This seems complicated tbh.
Appreciate your feedback. And others have shared similar feedback so it's definitely something we are thinking about. The SDK was built with the smoothest onramp being via pyproject.toml and poetry. We have more info here: https://sdk.meltano.com/en/latest/python_tips.html#tip-1-intro-to-virtual-environments-poetry-and-pipx Others have noted that they are used to using pip and pre-PEP-517/518 install methods, and we may add additional guidance in the future on how to get this working without poetry and pyproject.toml. (Although it's generally harder and more steps to do so.)
c
At first I tried to use the SDK as it seemed to be easier. But I found it too complicated for my usecase. I can try it back as I handle a bit more the idea of building a tap, if it helps getting things ready at a higher pace
a
Thanks for sharing your experience. And sorry to hear it was not more intuitive for you. We also have #C01QS0RV78D if it's ever helpful to come chat about what you are seeing and how to build out what you need to given your use cases.
c
I'll have a look! Thanks for your insights!
@aaronsteers in order to dig a bit further into the SDK option, do you have an example where the tap loops inside a stream to get the data for different ids (which are gather from a token and then authorize via a bearer jwt) or something alike?
a
I think so - can you clarify a bit on the requirement? Do I understand correctly that you are calling a list-type endpoint followed by a describe endpoint on each entity? And that the list endpoint doesn't contain sufficient detail on it's own? If you don't mind sharing the API name or endpoint docs url, those would also be helpful. Thanks!
c
We need a top level authentication( pw+id generating the token) to then create lower level authentication for each offices( token + office id to generate the jwt).
a
I'm looking into the list option. The auth piece is also interesting though. We do have JWT support but most of our examples get a single tJWT token for all subsequent calls (with allowance for timeouts, etc.). Do I understand correctly the same extract process needs multiple tokens? Is there any option to simply request the needed scopes in the initial Auth flow?
One thing I'm noticing is that it looks like you have many parent-child relationships between stream types. This is a handled case, and rather than looping them yourself, you can use the capability described here: Parent-Child Streams — Meltano SDK 0.2.0 documentation
I also noticed in your code that I do not see the default JWT authenticator. By chance do you remember if you answered the auth question in the cookiecutter to specify the authentication as JWT or "None / Custom?"
c
The same extract process need on token for each office indeed! I'll definitely have a look at the parent-child stream. I think I used the None/ Custom in order to recreate the jwt token for each office
a
What's the approx. order of magnitude of offices are you dealing with? 10, 100, 1000+?
c
Nowadays more like 10. In the near future could be hundreds
a
This isn't a supported pattern as of now, and I'm not sure how you would implement it. Do you mind logging an issue on this within the SDK repo so we can discuss and explore options for future?: SDK Issue Tracker
If ~10 offices, you could in theory run this parameterized once for each office, and use a distinct auth/office for each, but this is far from ideal.
c
Excellent! Thanks for your feedback and your insights. I'll do that and keep you posted with my answer 🙂
a
Much appreciated!
If you find that you can solve with a single JWT and multiple scopes, that of course would bring this back into what we considered as the standard use cases.
Good luck and do keep us posted! 👍
c
The multiple JWT are needed because of the role we have over the offices 🙂 Thank you ! 😄
I've been trying your first option, with the -e flag. I keep having the error Could not detect requirement name for 'git+https://github.com/we-invest-real-estate/tap-whise.git', please specify one with #egg=your_package_name. I generated the egg info via the command
python setup.py bdist_egg
and pushed it to github. Do you know how this could be resolved?
a
Can you double-check the url? The above only has a partial org id but maybe that's just in what you pasted here.
You pasted previously a longer org name: https://github.com/we-invest-real-estate/tap-whise
c
Sorry, Was trying to do it by heart 😔
a
Thanks for confirming. I don't have any other ideas unfortunately. I always find the setup.py process tricky to debug.
One thing to test is whether you can install using just "regular" pip or pipx
c
really appreciate all the help you've provided! Thanks and have a good afternoon 🙂
Maybe a last question: in which folder should the pip be done in meltano?
a
Happy to help! If testing using "regular pip/pipx", the idea was just to ignore meltano in order to test first if the install itself is working. Once you know the pip install is working, then you would use the
meltano add --custom extractor ...
which would run the pip instructions as you specify in the prompts.
c
Hello @aaronsteers, I was able to pip install my tap on my machine and it worked like a charm. But i'm still not able to install it with meltano 😕
Small update: I've finally taken the latest docker image and it works like a charm! I still don't get it but there we go
a
Okay, cool. Glad to hear it!
If you do run into further issues on this front, it might make sense to put all the logs into a formal issue so we can repro on our side as well. 👍