Hey guys, getting this problem in all my meltnao s...
# troubleshooting
s
Hey guys, getting this problem in all my meltnao sdk taps this morning:
Copy code
cannot import name 'Sink' from 'singer_sdk.target_base'
What could be the cause of this?
v
I think there was an sdk release last night? probably tied to that, maybe pin your sdk version to one back and see if it works
If you could post the stack trace it'll probably help us track this down to see if it's an sdk issue or a target thing
s
Copy code
[2023-03-30, 13:17:12 UTC] {subprocess.py:92} INFO - [2m2023-03-30T13:17:12.373885Z[0m [[32m[1minfo     [0m] [1m  File "/project/.meltano/loaders/target-bigquery/venv/bin/target-bigquery", line 5, in <module>[0m [36mcmd_type[0m=[35melb[0m [36mconsumer[0m=[35mTrue[0m [36mname[0m=[35mtarget-bigquery--wrike[0m [36mproducer[0m=[35mFalse[0m [36mstdio[0m=[35mstderr[0m [36mstring_id[0m=[35mtarget-bigquery--wrike[0m
[2023-03-30, 13:17:12 UTC] {subprocess.py:92} INFO - [2m2023-03-30T13:17:12.374077Z[0m [[32m[1minfo     [0m] [1m    from target_bigquery.target import TargetBigQuery[0m [36mcmd_type[0m=[35melb[0m [36mconsumer[0m=[35mTrue[0m [36mname[0m=[35mtarget-bigquery--wrike[0m [36mproducer[0m=[35mFalse[0m [36mstdio[0m=[35mstderr[0m [36mstring_id[0m=[35mtarget-bigquery--wrike[0m
[2023-03-30, 13:17:12 UTC] {subprocess.py:92} INFO - [2m2023-03-30T13:17:12.374251Z[0m [[32m[1minfo     [0m] [1m  File "/project/.meltano/loaders/target-bigquery/venv/lib/python3.8/site-packages/target_bigquery/target.py", line 18, in <module>[0m [36mcmd_type[0m=[35melb[0m [36mconsumer[0m=[35mTrue[0m [36mname[0m=[35mtarget-bigquery--wrike[0m [36mproducer[0m=[35mFalse[0m [36mstdio[0m=[35mstderr[0m [36mstring_id[0m=[35mtarget-bigquery--wrike[0m
[2023-03-30, 13:17:12 UTC] {subprocess.py:92} INFO - [2m2023-03-30T13:17:12.374421Z[0m [[32m[1minfo     [0m] [1m    from singer_sdk.target_base import Sink, Target[0m [36mcmd_type[0m=[35melb[0m [36mconsumer[0m=[35mTrue[0m [36mname[0m=[35mtarget-bigquery--wrike[0m [36mproducer[0m=[35mFalse[0m [36mstdio[0m=[35mstderr[0m [36mstring_id[0m=[35mtarget-bigquery--wrike[0m
[2023-03-30, 13:17:12 UTC] {subprocess.py:92} INFO - [2m2023-03-30T13:17:12.374593Z[0m [[32m[1minfo     [0m] [1mImportError: cannot import name 'Sink' from 'singer_sdk.target_base' (/project/.meltano/loaders/target-bigquery/venv/lib/python3.8/site-packages/singer_sdk/target_base.py)[0m [36mcmd_type[0m=[35melb[0m [36mconsumer[0m=[35mTrue[0m [36mname[0m=[35mtarget-bigquery--wrike[0m [36mproducer[0m=[35mFalse[0m [36mstdio[0m=[35mstderr[0m [36mstring_id[0m=[35mtarget-bigquery--wrike[0m
[2023-03-30, 13:17:12 UTC] {subprocess.py:92} INFO - [2m2023-03-30T13:17:12.440556Z[0m [[31m[1merror    [0m] [1mLoader failed
Ouh that's gross, but it seems to be the target @alexander_butler
e
Yeah, the target is importing that from the wrong module 😬. I'll send him a PR.
v
imo the target should probably be pinned to an sdk version as well!
e
Yup, that too
v
@Stéphane Burwash reinstalling the targets every run is a bit dangerous due to dependency changes like this, if you had a container host these that would prevent this as well 🤷 Just an fyi!
s
@visch we have it setup on a CI/CD pipeline in a docker image, so everytime we push to main we make a fresh
meltano install --clean
. I'll look into putting some checks on that, but I feel that still falls under good practices (if the versions of our taps are pinned)
v
That's a perfect setup, but it sounded like in production your job failed. If so then presumably the container isn't working? Maybe this just failed on a new MR or something on your end if so that's perfect! if it failed in an MR/PR that's a success story in my book!
s
Yes no sadly it merged in prod; I have no tests curretnly before merging to see if a tap / target is functional, only on the dbt side. What kind of tests could I put in place to validate meltano? That would definitely help with my deployments 😄
v
If costs for tap/target data aren't a concern during your CI you can run
meltano --environment=ci run tap-name target-name
the environment could point you to a special target schema just for that CI environment. If you need to optimize more you can but some iteration of that!
c
Newbie question: What’s the best way to fix this until the PR is merged (other than a fork)? Is there a setting in the
meltano.yml
to overwrite tap/target dependencies (for an earlier SDK version)?
w
You can specify an earlier version of the tap/target/plugin in the
pip_url
using the same syntax as you would for a
pip install
command.
You can also add additional dependencies to the
pip_url
, for instance to pin an earlier version of the SDK
e
Yup, something like
Copy code
pip_url: git+<https://github.com/z3z1ma/target-bigquery.git> singer-sdk==0.22.0
c
neat, ty!
s
Great question @christian_hollinger, was wondering that myself 😅
e
Change has landed in
main
so going back to
Copy code
pip_url: git+<https://github.com/z3z1ma/target-bigquery.git>
should work
a
Thanks for the PR. I will be pinning an exact version of the SDK moving forward. I will set up dependabot instead to open PRs where I can trigger, minimally, the unit tests. That should be solid. thankyou
a
Thanks, @alexander_butler. We've seen dependabot working well for us so far - and we also have a similar challenge efficiently maintaining SDK version bumps for the MeltanoLabs variants.
c
Seeing this with the quote transformation enabled:
Copy code
Invalid field name "`search_name`". Fields must contain the allowed characters, and be at most 300 characters long.
Wondering if there’s another dependency that broke here. This doesn’t seem like normal behavior for BQ.
a
@christian_hollinger That looks unrelated to this thread. It could be worth popping an issue over on GH though? I would also say that the quote transformation is probably unnecessary since bq is case sensitive anyway IIRC. But in either case, the quote thing is very straightforward so not sure whats up. Would need more informtion
Copy code
>>> transform_column_name("search_name", quote=True)
'`search_name`'
>>> transform_column_name("`search_name`", quote=True)
'`search_name`'
>>>
c
I’ll do you one better and give you a PR: https://github.com/z3z1ma/target-bigquery/pull/22 🙂 There are two remaining issues I briefly mentioned in that ticket, I believe I found some more rather obscure corner cases. But I guess that can be discussed on GH.