diff --git a/singer_sdk/typing.py b/singer_sdk/typing.py index 845f1dcd0..a21447a49 100644 --- a/singer_sdk/typing.py +++ b/singer_sdk/typing.py @@ -1216,6 +1216,12 @@ def to_sql_type( # noqa: PLR0911, C901 Returns: The SQL type. """ + if _jsonschema_type_check(jsonschema_type, ("object",)): + return sa.types.VARCHAR() + + if _jsonschema_type_check(jsonschema_type, ("array",)): + return sa.types.VARCHAR() + if _jsonschema_type_check(jsonschema_type, ("string",)): datelike_type = get_datelike_property_type(jsonschema_type) if datelike_type: @@ -1236,10 +1242,4 @@ def to_sql_type( # noqa: PLR0911, C901 if _jsonschema_type_check(jsonschema_type, ("boolean",)): return sa.types.BOOLEAN() - if _jsonschema_type_check(jsonschema_type, ("object",)): - return sa.types.VARCHAR() - - if _jsonschema_type_check(jsonschema_type, ("array",)): - return sa.types.VARCHAR() - return sa.types.VARCHAR() diff --git a/tests/core/test_typing.py b/tests/core/test_typing.py index 25d9c68df..219c9a587 100644 --- a/tests/core/test_typing.py +++ b/tests/core/test_typing.py @@ -345,6 +345,10 @@ def test_conform_primitives(): sa.types.DATETIME, ), ({"anyOf": [{"type": "integer"}, {"type": "null"}]}, sa.types.INTEGER), + ( + {"type": ["array", "object", "boolean", "null"]}, + sa.types.VARCHAR, + ), ], ) def test_to_sql_type(jsonschema_type, expected):