diff --git a/target_postgres/connector.py b/target_postgres/connector.py index c0c12da6..68932df0 100644 --- a/target_postgres/connector.py +++ b/target_postgres/connector.py @@ -345,6 +345,7 @@ def create_empty_table( property_name, self.to_sql_type(property_jsonschema), primary_key=is_primary_key, + autoincrement=False, # See: https://github.com/MeltanoLabs/target-postgres/issues/193 # noqa: E501 ) ) if as_temp_table: diff --git a/target_postgres/tests/data_files/large_numeric_primary_key.singer b/target_postgres/tests/data_files/large_numeric_primary_key.singer new file mode 100644 index 00000000..dbd7bf2a --- /dev/null +++ b/target_postgres/tests/data_files/large_numeric_primary_key.singer @@ -0,0 +1,2 @@ +{"type": "SCHEMA", "stream": "test_large_numeric_primary_key", "schema": {"properties": {"active": {"type": "boolean"}, "address1": {"type": ["string", "null"]}, "address2": {"type": ["string", "null"]}, "city": {"type": ["string", "null"]}, "country": {"type": ["string", "null"]}, "country_code": {"type": ["string", "null"]}, "created_at": {"type": ["string", "null"]}, "id": {"type": "number"}, "legacy": {"type": "boolean"}, "name": {"type": ["string", "null"]}, "phone": {"type": ["string", "null"]}, "province": {"type": ["string", "null"]}, "province_code": {"type": ["string", "null"]}, "updated_at": {"type": ["string", "null"]}, "zip": {"type": ["string", "null"]}, "localized_country_name": {"type": ["string", "null"]}, "localized_province_name": {"type": ["string", "null"]}}, "type": "object"}, "key_properties": ["id"]} +{"type": "RECORD", "stream": "test_large_numeric_primary_key", "record": {"id": 34639314995, "name": "111 Main St", "address1": "111 Main St", "address2": null, "city": "Sterling Heights", "zip": "48312", "province": "Michigan", "country": "US", "phone": "", "created_at": "2019-11-05T21:31:25-05:00", "updated_at": "2019-11-05T21:31:29-05:00", "country_code": "US", "province_code": "MI", "legacy": false, "active": true, "localized_country_name": "United States", "localized_province_name": "Michigan"}, "time_extracted": "2023-09-15T19:33:01.841018+00:00"} diff --git a/target_postgres/tests/test_standard_target.py b/target_postgres/tests/test_standard_target.py index 5bf3c497..4a5068b7 100644 --- a/target_postgres/tests/test_standard_target.py +++ b/target_postgres/tests/test_standard_target.py @@ -242,6 +242,16 @@ def test_schema_no_properties(postgres_target): singer_file_to_target(file_name, postgres_target) +# TODO test that data is correct +def test_large_numeric_primary_key(postgres_target): + """Check that large numeric (jsonschema: number) pkeys don't cause failure. + + See: https://github.com/MeltanoLabs/target-postgres/issues/193 + """ + file_name = "large_numeric_primary_key.singer" + singer_file_to_target(file_name, postgres_target) + + # TODO test that data is correct def test_schema_updates(postgres_target): file_name = "schema_updates.singer"