diff --git a/tests/target_test_streams/schema_updates_no_key_props.singer b/tests/target_test_streams/schema_updates_no_key_props.singer new file mode 100644 index 0000000..bb6533c --- /dev/null +++ b/tests/target_test_streams/schema_updates_no_key_props.singer @@ -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}} diff --git a/tests/test_impl.py b/tests/test_impl.py index 7ccdf78..1ec2d08 100644 --- a/tests/test_impl.py +++ b/tests/test_impl.py @@ -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}", ) @@ -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): @@ -368,6 +376,7 @@ def validate(self) -> None: SnowflakeTargetRecordMissingKeyProperty, SnowflakeTargetSchemaNoProperties, SnowflakeTargetSchemaUpdates, + SnowflakeTargetSchemaUpdatesNoKeyProps, TargetSpecialCharsInAttributes, # Implicitly asserts that special chars are handled SnowflakeTargetReservedWords, SnowflakeTargetReservedWordsNoKeyProps,