Skip to content

Commit

Permalink
fix: Address missing type in for SDK-based type conforming
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 28, 2023
1 parent f7bea2b commit 11c22d1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
13 changes: 12 additions & 1 deletion tap_postgres/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This includes PostgresStream and PostgresConnector.
"""

from __future__ import annotations

import datetime
Expand Down Expand Up @@ -123,7 +124,17 @@ def to_jsonschema_type(
type_name = type(sql_type).__name__

if type_name is not None and type_name in ("JSONB", "JSON"):
return {}
return {
"type": [
"string",
"number",
"integer",
"object",
"array",
"boolean",
"null",
],
}

if (
type_name is not None
Expand Down
15 changes: 13 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,19 @@ def test_jsonb_json():
"stream" in schema_message
and schema_message["stream"] == altered_table_name
):
assert schema_message["schema"]["properties"]["column_jsonb"] == {}
assert schema_message["schema"]["properties"]["column_json"] == {}
all_types = {
"string",
"number",
"integer",
"object",
"array",
"boolean",
"null",
}
jsonb_schema = schema_message["schema"]["properties"]["column_jsonb"]
json_schema = schema_message["schema"]["properties"]["column_json"]
assert set(jsonb_schema["type"]) == all_types
assert set(json_schema["type"]) == all_types
assert test_runner.records[altered_table_name][0] == {
"column_jsonb": {"foo": "bar"},
"column_json": {"baz": "foo"},
Expand Down

0 comments on commit 11c22d1

Please sign in to comment.