Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Support multi-type values. #43

Open
SamProtas opened this issue Apr 7, 2021 · 0 comments
Open

Support multi-type values. #43

SamProtas opened this issue Apr 7, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@SamProtas
Copy link

Is your feature request related to a problem? Please describe.

I'd like this target to support arbitrary sets of types for a value.

This target doesn't fully support the shopify tap. Specifically the JSON schema with a value like this:

"value": {
    "type": [
      "null",
      "integer",
      "object",
      "string"
    ],
    "properties": {}
 },

This target makes this column jsonb and handles this fine if the value is "null", "integer", or "object" because the syntax of all of them directly translates to JSON.

When this target receives a string value and tries to insert this directly, it says something like :

invalid input syntax for type json
Token "Our" is invalid

(Where "Our" is a portion of a longer string it received such as "Our coffee is the best".)

Describe the solution you'd like
I'd like this target to treat any subset of types (length 2 or more) including integer, string, boolean, object as jsonb. I'd like received string values to be properly quoted.

The python string 'Our coffee is the best' would be json.dumps into '"Our coffee is the best"' before insert. json.dumps would also correctly handle escaping.

Describe alternatives you've considered
For now I plan to fork the tap and add a flag to json.dumps these values before emitting them, simply because that's the easier change to make ASAP.

Additional context
While I can work around this temporarily, this seems like a general purpose feature request that would equally improve compatibility with any number of taps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant