-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-2286] [Bug] return behaves in unexpected ways when used within a call tag / block #7144
Comments
Thanks for reaching out @darist ! You found a true (not so hidden) gem in our codebase with the Could you tell me more about what you are trying to do? I can't really tell, so I rewrote it a bit to try to do some similar things. Could you try this and see how it works for you?
|
Thanks for taking a look, @dbeatty10 !
Sure! I'm trying to create mocks for unit testing macros: EqualExperts/dbt-unit-testing#123. One of the ideas is to create mock implementations on-the-fly using the ... However, now I'm even more confused. I was able to Any idea what's causing this behavior? possible workarounds? Thanks! |
Sure thing @darist 👍 I took a look -- that's some impressive dark magic you are working on 🧙 I think Anyways, I don't think is a bug -- we expect macros to be able to return values, but we don't expect the same for call blocks. I don't have any great suggestions for workarounds, but have faith that you'll figure out something clever now that you know how it's expected to behave. 🧠 I'm going to close this as "not planned" since we don't plan on adding this ability to call blocks. |
oh no! I'm having to do a lot of business logic in jinja, which is pretty painful. Being able to define anonymous macros "on the fly" and associate them with the data they manipulate (so we can program like we do with structs or objects) would be helpful. Would you be open to contributions to enable support of Actually, I'd prefer to be able to implement macros in Python. Jinja is not really designed as a programming language, but I'm using (abusing?) it that way because dbt locks us out of the Python side of the jinja context. Are there any plans or discussions around supporting Python implementations of macros? Cheers! |
Is this a new bug in dbt-core?
Current Behavior
When I try to use
return()
from within acall
block, I get an error.Example:
dbt compile
Observed:
TypeError: sequence item 9: expected str instance, list found
Expected Behavior
I expect the value passed to
return()
to be returned by the call tocaller()
. In this particular case, I expect it to print[1, 2, 3]
Steps To Reproduce
dbt compile
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
postgres, bigquery
Additional Context
This part in the code looks suspicious :)
https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/exceptions.py#L18
The text was updated successfully, but these errors were encountered: