Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from transferwise/AP-221
Browse files Browse the repository at this point in the history
Remove undesired _SDC columns
  • Loading branch information
koszti authored Jun 7, 2019
2 parents ec07ac6 + 8f79a60 commit b06579e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name="pipelinewise-target-snowflake",
version="1.0.0",
version="1.0.1",
description="Singer.io target for loading data to Snowflake - PipelineWise compatible",
author="TransferWise",
url='https://github.com/transferwise/pipelinewise-target-snowflake',
Expand Down
14 changes: 3 additions & 11 deletions target_snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ def add_metadata_columns_to_schema(schema_message):
Metadata columns gives information about data injections
"""
extended_schema_message = schema_message
extended_schema_message['schema']['properties']['_sdc_batched_at'] = { 'type': ['null', 'string'], 'format': 'date-time' }
extended_schema_message['schema']['properties']['_sdc_deleted_at'] = { 'type': ['null', 'string'] }
extended_schema_message['schema']['properties']['_sdc_extracted_at'] = { 'type': ['null', 'string'], 'format': 'date-time' }
extended_schema_message['schema']['properties']['_sdc_primary_key'] = {'type': ['null', 'string'] }
extended_schema_message['schema']['properties']['_sdc_received_at'] = { 'type': ['null', 'string'], 'format': 'date-time' }
extended_schema_message['schema']['properties']['_sdc_sequence'] = {'type': ['integer'] }
extended_schema_message['schema']['properties']['_sdc_table_version'] = {'type': ['null', 'string'] }
extended_schema_message['schema']['properties']['_sdc_batched_at'] = { 'type': ['null', 'string'], 'format': 'date-time' }
extended_schema_message['schema']['properties']['_sdc_deleted_at'] = { 'type': ['null', 'string'], 'format': 'date-time' }

return extended_schema_message

Expand All @@ -56,13 +52,9 @@ def add_metadata_values_to_record(record_message, stream_to_sync):
The location of the required attributes are fixed in the stream
"""
extended_record = record_message['record']
extended_record['_sdc_extracted_at'] = record_message.get('time_extracted')
extended_record['_sdc_batched_at'] = datetime.now().isoformat()
extended_record['_sdc_deleted_at'] = record_message.get('record', {}).get('_sdc_deleted_at')
extended_record['_sdc_extracted_at'] = record_message.get('time_extracted')
extended_record['_sdc_primary_key'] = stream_to_sync.stream_schema_message['key_properties']
extended_record['_sdc_received_at'] = datetime.now().isoformat()
extended_record['_sdc_sequence'] = int(round(time.time() * 1000))
extended_record['_sdc_table_version'] = record_message.get('version')

return extended_record

Expand Down
8 changes: 2 additions & 6 deletions tests/integration/test_target_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@


METADATA_COLUMNS = [
'_SDC_BATCHED_AT',
'_SDC_DELETED_AT',
'_SDC_EXTRACTED_AT',
'_SDC_PRIMARY_KEY',
'_SDC_RECEIVED_AT',
'_SDC_SEQUENCE',
'_SDC_TABLE_VERSION'
'_SDC_BATCHED_AT',
'_SDC_DELETED_AT'
]


Expand Down

0 comments on commit b06579e

Please sign in to comment.