Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions tests/target_test_streams/schema_updates_no_key_props.singer
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{"type": "SCHEMA", "stream": "test_schema_updates", "key_properties": [], "schema": {"type": "object", "properties": {"id": {"type": "integer"}, "a1": {"type": "number"}, "a2": {"type": "string"}}}}
{"type": "RECORD", "stream": "test_schema_updates", "record": {"id": 1, "a1": 101, "a2": "string1"}}
{"type": "SCHEMA", "stream": "test_schema_updates", "key_properties": [], "schema": {"type": "object", "properties": {"id": {"type": "integer"}, "a1": {"type": "number"}, "a2": {"type": "string"}, "a3": {"type": "boolean"}}}}
{"type": "RECORD", "stream": "test_schema_updates", "record": {"id": 2, "a1": 102, "a2": "string2", "a3": true}}
{"type": "SCHEMA", "stream": "test_schema_updates", "key_properties": [], "schema": {"type": "object", "properties": {"id": {"type": "integer"}, "a1": {"type": "number"}, "a2": {"type": "string"}, "a3": {"type": "boolean"}, "a4": {"type": "object", "properties": {"id": {"type": "integer"}, "value": {"type": "integer"}}}, "a5": {"type": "array", "items": {"type": "string"}}}}}
{"type": "RECORD", "stream": "test_schema_updates", "record": {"id": 3, "a1": 103, "a2": "string3", "a3": false, "a4": {"id": 1, "value": 1}, "a5": [ "banana", "apple" ]}}
{"type": "RECORD", "stream": "test_schema_updates", "record": {"id": 4, "a1": 104, "a2": "string4", "a3": true, "a4": {"id": 2, "value": 22}, "a5": [ "orange", "pear" ]}}
{"type": "SCHEMA", "stream": "test_schema_updates", "key_properties": [], "schema": {"type": "object", "properties": {"id": {"type": "integer"}, "a1": {"type": "number"}, "a2": {"type": "string"}, "a3": {"type": "boolean"}, "a4": {"type": "object", "properties": {"id": {"type": "integer"}, "value": {"type": "integer"}}}, "a5": {"type": "array", "items": {"type": "string"}}, "a6": {"type": "integer"}}}}
{"type": "RECORD", "stream": "test_schema_updates", "record": {"id": 5, "a1": 105, "a2": "string5", "a3": false, "a4": {"id": 3, "value": 33}, "a5": [ "apple" ], "a6": 985}}
{"type": "RECORD", "stream": "test_schema_updates", "record": {"id": 6, "a1": 106, "a2": "string6", "a3": true, "a4": {"id": 4, "value": 444}, "a5": [ "banana", "orange" ], "a6": 341}}
{"type": "STATE", "value": {"test_schema_updates": 6}}
11 changes: 10 additions & 1 deletion tests/test_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def validate(self) -> None:
class SnowflakeTargetSchemaUpdates(TargetSchemaUpdates):
def validate(self) -> None:
connector = self.target.default_sink_class.connector_class(self.target.config)
table = f"{self.target.config['database']}.{self.target.config['default_target_schema']}.test_schema_updates".upper()
table = f"{self.target.config['database']}.{self.target.config['default_target_schema']}.test_{self.name}".upper()
result = connector.connection.execute(
f"select * from {table}",
)
Expand All @@ -232,6 +232,14 @@ def validate(self) -> None:
assert column.name in expected_types
isinstance(column.type, expected_types[column.name])

class SnowflakeTargetSchemaUpdatesNoKeyProps(SnowflakeTargetSchemaUpdates):
name = "schema_updates_no_key_props"

@property
def singer_filepath(self) -> Path:
current_dir = Path(__file__).resolve().parent
return current_dir / "target_test_streams" / f"{self.name}.singer"


class SnowflakeTargetReservedWords(TargetFileTestTemplate):

Expand Down Expand Up @@ -368,6 +376,7 @@ def validate(self) -> None:
SnowflakeTargetRecordMissingKeyProperty,
SnowflakeTargetSchemaNoProperties,
SnowflakeTargetSchemaUpdates,
SnowflakeTargetSchemaUpdatesNoKeyProps,
TargetSpecialCharsInAttributes, # Implicitly asserts that special chars are handled
SnowflakeTargetReservedWords,
SnowflakeTargetReservedWordsNoKeyProps,
Expand Down