-
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
[Pre-regression] Error when serializing RunResults (variable results) with to_dict() during the on-run-end #10098
Comments
Thanks for reporting this @DmytroSly ! I was able to see the same difference as you between 1.7 and 1.8 (see "reprex" below for details). I didn't confirm or deny, but it might be related to the changes in #9744.
|
Thanks for the report @DmytroSly, and for the quick follow-up @dbeatty10! I can confirm that updating this line to remove the conditional For context, here is where we're adding Line 470 in fb6dbc8
Alternative ideas:
|
@jtcohen6 It looks like agate_table is already excluded, in the sense that it always explicitly serializes to None, so it's unfortunate that mashumaro gets so upset that its annotated type isn't available. There's a variant of your second suggestion that might work. Instead of RunResult, we could provide instances of its base class NodeResult to on-run-end, which does include node, but not agate_table. |
@peterallenwebb and I agreed that:
|
* Add test case * Undo conditional agate import
Hi I'm the contributor of the original code that caused the mess. Wow! That's unfortunate. Good job finding the bug and its fix, and my apologies for introducing it. dbt-core is tricky sometimes. 😅 |
So I'm saying this without much knowledge of how this works (I've never used mashumaro), but maybe adding something like this works? That way you don't need to break the schema for @dataclass
class RunResult(NodeResult):
def __pre_serialize__(self, context: Optional[Dict] = None):
import agate
global agate
return self
@classmethod
def __pre_deserialize__(cls, d: Dict[Any, Any]) -> Dict[Any, Any]:
import agate
global agate
return d I'm pretty swamped at work (probably shouldn't even be messing around with this, lol), so cannot get to this until the weekend, but when I do, I will be able test this using @dbeatty10's reproduction. I'm also a little interested, for my own edification. Does dbt always serialize a run result? If so, this really isn't saving time except for like, |
Is this a new bug in dbt-core?
Current Behavior
I log RunResults into a database table by parsing the results variable this way:
After upgrading to dbt-core==1.8.0rc1 and dbt-snowflake==1.8.0b3 I get the following error:
Expected Behavior
No error happens, just like in the previous versions of dbt-core
Steps To Reproduce
Just try to serialize the results variable during the on-run-end in the below way:
Relevant log output
Environment
Which database adapter are you using with dbt?
dbt-snowflake==1.8.0b3
Additional Context
No response
The text was updated successfully, but these errors were encountered: