Merged
Conversation
erezrokah
approved these changes
Nov 20, 2024
kodiakhq bot
pushed a commit
that referenced
this pull request
Nov 20, 2024
🤖 I have created a release *beep* *boop* --- ## [1.0.3](plugins-transformer-jsonflattener-v1.0.2...plugins-transformer-jsonflattener-v1.0.3) (2024-11-20) ### Bug Fixes * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.68.3 ([#19604](#19604)) ([3d378ea](3d378ea)) * Ignore utf8 keys. ([#19643](#19643)) ([411474a](411474a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes https://github.com/cloudquery/cloudquery-issues/issues/2763
(internal issue)
Normally, the JSON Flattener will attempt to flatten JSON objects to the first level, e.g.:
But the TypeSchema notation had a special case that the JSON Flattener wasn't aware of:
{ "name": "freeform_tags", "type": "json", "type_schema": "{\"utf8\":\"utf8\"}" },In this case, the
utf8key is not a literal string, but a special value that means "any string key". This should be ignored by the flattener, because it's meant to contain different keys on different rows, and table schemas are fixed.The only way to implement this would be to do a linear pass over all rows and learn all possible keys, then do another pass and create nullable columns on all non-supplied columns for each row. We definitely don't want to support this.
Instead, this PR simply ignores keys with this special literal string.
The practice is common on the Oracle source plugin; here's a flattened Oracle table that was suffering from this issue, now fixed: