-
Notifications
You must be signed in to change notification settings - Fork 121
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
Cannot run dbt docs generate with JSON logs #115
Comments
@ueshin @allisonwang-db I can repro this on my laptop, too. |
@jtcohen6 Could you help take a look at this issue? Seems like >>> json.dumps(SparkRelation.create(schema='a', identifier='b'))
...
TypeError: Object of type SparkRelation is not JSON serializable
>>> json.dumps(BaseRelation.create(schema='a', identifier='b'))
Traceback (most recent call last):
...
TypeError: Object of type BaseRelation is not JSON serializable Thanks. |
Seems like it tries to show more logs in |
I'm able to reproduce this locally with the latest
>>> import json
>>> from dbt.adapters.base import BaseRelation
>>> json.dumps(BaseRelation.create(schema='a', identifier='b').to_dict())
'{"path": {"database": null, "schema": "a", "identifier": "b"}, "type": null, "quote_character": "\\"", "include_policy": {"database": true, "schema": true, "identifier": true}, "quote_policy": {"database": true, "schema": true, "identifier": true}, "dbt_created": false}' |
I found a simple fix for this, but I'd be curious to get @nathaniel-may's take on it before merging |
@jtcohen6 any update on this? I'd love to close this out in the next point release. |
@bilalaslamseattle Thanks for flagging this again. We've seen multiple issues in this category, across multiple adapters, and we think there exists a general-purpose solution that will be the right move longer-term: dbt-labs/dbt-core#5436 The work for that is definitely on our radar. If it appears that the general-purpose resolution will be too complex, we can put a one-off patch for this in (cc @nathaniel-may) |
Hiya people on the thread. Per this core PR, this JSON serialization bug should be solved across all adapters. There's a lot of layers of indirection in the logger call stack, so finding the root cause of this error took us some concerted time. I also threw on our PRs backlog tags, so in theory, you should be able to "seamlessly" integrate the fix into your env on the new release. (it's also live in main) I'd love to close this if (🤞) people report things working here. |
Describe the bug
When running dbt docs generate with JSON logs enabled I receive an error:
Encountered an error while generating catalog: Object of type DatabricksRelation is not JSON serializable
.This occurs when using dbt-databricks 1.1.0 on all of locally (Windows), Docker (Linux) and the preview Databricks dbt task type.
It does not occur in earlier versions.
It does not occur with the default log format.
Steps To Reproduce
dbt --log-format json docs generate
Expected behavior
Doc site generates correctly, with JSON logs.
Screenshots and log output
System information
Windows:
The operating system you're using:
Windows/Linux/Databricks
The output of
python --version
:Windows:
Python 3.9.0
Additional context
The text was updated successfully, but these errors were encountered: