josh_lloyd
07/26/2022, 9:40 PMmeltano --log-level=debug invoke --dump catalog tap-sumologic
:
[2022-07-26 15:10:33,498] [40074|MainThread|meltano.cli.utils] [DEBUG] Could not dump catalog: Catalog discovery failed: invalid catalog: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/meltano/core/plugin/singer/tap.py", line 302, in discover_catalog
catalog = json.load(catalog_file)
File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
josh_lloyd
07/26/2022, 9:42 PM{'type': 'object', 'properties': {'_sourcecategory': {'type': ['null', 'string']}, '_count': {'type': ['null', 'string', 'integer']}}, 'key_properties': ['_sourcecategory']}
christoph
07/26/2022, 9:50 PMTraceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/meltano/core/plugin/singer/tap.py", line 302, in discover_catalog
Why is the SDK installed in a global location? (/usr/local/lib
)?
The reason I'm asking this, is because what I would normally do in these situations is to quickly fire up the python debugger (pdb
) by adding a quick import pdb; pdb.set_trace()
line just before the line where the trace gets thrown in order to force a debugger breakpoint.
But, I wouldn't want to do that for a globally installed library (i.e. something that is shared across everything on your computer by being installed in /usr/local/lib
)
Normally, the Meltano SDK should be in a virtualenv that is managed by meltano inside the .meltano
folder in your meltano project folder, which therefore makes editing the source .py
files and throwing in a quick import pdb; pdb.set_trace()
a no-brainer to do.josh_lloyd
07/26/2022, 9:53 PMpoetry install
. I would have thought that it would have avoided that for mechristoph
07/26/2022, 9:58 PMpoetry install
would also manage a virtualenv for you that has the SDK in it. The global location could be a historical remnant on the machine you're working on.
Anyway, in case you can just run your tap directly (without meltano cli), you could also just fire up pdb
directly (something like python -m pdb -c tap-sumologic --config ....
should do the trick, I think) and the debugger should throw you into an interactive shell as soon as your tap raises that JSONDecodeError exception and then you can have a look around.
Quickstart for pdb
in case you're not super familiar with it yet
https://realpython.com/lessons/getting-started-pdb/christoph
07/26/2022, 10:01 PMpython -m pdb -c tap-sumologic --discover
in your case, I suppose, since that's where the problem occursjosh_lloyd
07/26/2022, 10:13 PMgetopt.GetoptError: option --discover not recognized
josh_lloyd
07/26/2022, 10:16 PMmeltano invoke tap-sumologic --discover
just fine thoughchristoph
07/26/2022, 10:27 PMpdb
and not to the python script ....josh_lloyd
07/26/2022, 10:28 PMbreakpoint()
led me to the properties.json
file where I discovered that a lazy print
statement had accidentally inserted bogus info into the file. testing the removal of that print statement now …josh_lloyd
07/26/2022, 10:32 PMchristoph
07/26/2022, 10:34 PMimport logging
logging.debug()
will be much safer and won't clobber your stdout.josh_lloyd
07/26/2022, 10:35 PM