When using the Singer SDK for targets, what should...
# singer-target-development
h
When using the Singer SDK for targets, what should the CLI declaration be in the
pyproject.toml
? Currently when I run the target I see this:
Copy code
$ cat data.txt | target-mysql --config config.json
<Command cli>
My
pyproject.toml
looks like the following:
Copy code
[tool.poetry.scripts]
# CLI declaration
target-mysql = 'target_mysql.target:TargetMSSQL.cli'
`target.py`: https://github.com/hotgluexyz/target-mysql/blob/main/target_mysql/target.py
a
Hi, @hassan_syyid. We used to require the
cli =
declaration in the target.py or tap.py file, but this should no longer be needed. The
pyproject.toml
entry you pasted above looks correct even without the
cli
declaration in
target.py
.
Since
cli
is a (built-in) class method, it should be callable directly from within the pypoetry cli declaration.
h
@aaronsteers Sure, so I tried removing the CLI declaration in
target.py
and got the behavior I showed above
a
I see...
one sec...
h
What was the old declaration under
[tool.poetry.scripts]
?
a
I believe the old declaration was
Copy code
[tool.poetry.scripts]
# CLI declaration
target-mysql = 'target_mysql.target:cli'
which matched to the target.py declaration
Can you confirm the SDK version you are using now?
h
Copy code
$ pip show singer-sdk
Name: singer-sdk
Version: 0.3.9
Summary: A framework for building Singer taps
Home-page: 
Author: Meltano Team and Contributors
Author-email: 
License: Apache 2.0
Location: /Users/hassansyyid/env/target-mysql/lib/python3.7/site-packages
Requires: joblib, importlib-metadata, inflection, requests, jsonpath-ng, memoization, pipelinewise-singer-python, click, backoff, cryptography, pendulum, PyJWT
Required-by: target-mysql
I did notice the target seems to have overridden part of the SDK? https://github.com/hotgluexyz/target-mysql/tree/main/target_mysql/singer_sdk
Could that be causing this
a
Yes, I'm seeing that too. That repo does look like it has an older import. By moving the refs to the latest version of the SDK, it should hopefully resolve this issue. target-mysql/target.py at main · hotgluexyz/target-mysql · GitHub
v
Keith used some ideas from my target-mssql (which was not great but it does work) It doesn't use the sdk, the folder has two files and that's the "sdk"
h
Ahhh… okay.I got it to run with the CLI declaration you provided.