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

Normalization: handle non-object top-level schemas; treat binary data as string #22165

Merged
merged 8 commits into from
Jan 31, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,15 @@ def build_stream_processor(
primary_key = get_field(configured_stream, "primary_key", f"Undefined primary key for stream {stream_name}")

message = f"'json_schema'.'properties' are not defined for stream {stream_name}"
properties = get_field(get_field(stream_config, "json_schema", message), "properties", message)
schema = get_field(stream_config, "json_schema", f"'json_schema' is not defined for stream {stream_name}")
if "properties" in schema:
properties = get_field(schema, "properties", message)
elif "oneOf" in schema:
options = filter(lambda option: "properties" in option, schema["oneOf"])
if len(options) == 0:
raise KeyError(f"Stream {stream_name} does not have any properties")
# If there are multiple oneOf options, just pick the first one - we don't really support oneOf to begin with
properties = options[0]["properties"]

from_table = dbt_macro.Source(schema_name, raw_table_name)

Expand Down