Skip to content
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

fix: msgpack strict map key #9974

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/

# Distribution / packaging
.Python
.venv/
env*/
dbt_env/
build/
Expand Down
11 changes: 10 additions & 1 deletion core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from itertools import chain
import time

import agate

from dbt.context.manifest import generate_query_header_context
from dbt.contracts.graph.semantic_manifest import SemanticManifest
from dbt_common.events.base_types import EventLevel
Expand Down Expand Up @@ -157,12 +159,17 @@ def extended_msgpack_encoder(obj):
elif type(obj) is datetime.datetime:
datetime_bytes = msgpack.ExtType(2, obj.isoformat().encode())
return datetime_bytes
elif isinstance(obj, agate.Table):
agate_bytes = msgpack.ExtType(3, "".encode())
return agate_bytes

return obj


def extended_mashumuro_decoder(data):
return msgpack.unpackb(data, ext_hook=extended_msgpack_decoder, raw=False)
return msgpack.unpackb(
data, ext_hook=extended_msgpack_decoder, raw=False, strict_map_key=False
)


def extended_msgpack_decoder(code, data):
Expand All @@ -172,6 +179,8 @@ def extended_msgpack_decoder(code, data):
elif code == 2:
dt = datetime.datetime.fromisoformat(data.decode())
return dt
elif code == 3:
return ""
else:
return msgpack.ExtType(code, data)

Expand Down
Loading