Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 256be35

Browse files
nezdivanovyordan
authored andcommitted
Change the timestamp format
The format of the date and time was changed as string from datetime. We were receiving wrong dates (like dates B.C.) and we want to keep the original value without getting errors.
1 parent 1d96f47 commit 256be35

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

tap_postgres/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def schema_for_column_datatype(c):
123123
if data_type in ('date', 'timestamp without time zone', 'timestamp with time zone'):
124124
schema['type'] = nullable_column('string', c.is_primary_key)
125125

126-
schema['format'] = 'date-time'
127126
return schema
128127

129128
if data_type in FLOAT_TYPES:
@@ -181,7 +180,7 @@ def schema_for_column(c):
181180
elif c.sql_data_type == 'citext[]':
182181
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_string_array'}
183182
elif c.sql_data_type == 'date[]':
184-
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_timestamp_array'}
183+
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_string_array'}
185184
elif c.sql_data_type == 'numeric[]':
186185
scale = post_db.numeric_scale(c)
187186
precision = post_db.numeric_precision(c)
@@ -208,9 +207,9 @@ def schema_for_column(c):
208207
elif c.sql_data_type == 'text[]':
209208
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_string_array'}
210209
elif c.sql_data_type == 'timestamp without time zone[]':
211-
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_timestamp_array'}
210+
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_string_array'}
212211
elif c.sql_data_type == 'timestamp with time zone[]':
213-
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_timestamp_array'}
212+
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_string_array'}
214213
elif c.sql_data_type == 'time[]':
215214
column_schema['items'] = {'$ref': '#/definitions/sdc_recursive_string_array'}
216215
elif c.sql_data_type == 'uuid[]':
@@ -312,7 +311,7 @@ def write_sql_data_type_md(mdata, col_info):
312311
'sdc_recursive_number_array' : {'type' : ['null', 'number', 'array'], 'items' : {'$ref': '#/definitions/sdc_recursive_number_array'}},
313312
'sdc_recursive_string_array' : {'type' : ['null', 'string', 'array'], 'items' : {'$ref': '#/definitions/sdc_recursive_string_array'}},
314313
'sdc_recursive_boolean_array' : {'type' : ['null', 'boolean', 'array'], 'items' : {'$ref': '#/definitions/sdc_recursive_boolean_array'}},
315-
'sdc_recursive_timestamp_array' : {'type' : ['null', 'string', 'array'], 'format' : 'date-time', 'items' : {'$ref': '#/definitions/sdc_recursive_timestamp_array'}},
314+
'sdc_recursive_timestamp_array' : {'type' : ['null', 'string', 'array'], 'items' : {'$ref': '#/definitions/sdc_recursive_timestamp_array'}},
316315
'sdc_recursive_object_array' : {'type' : ['null', 'object', 'array'], 'items' : {'$ref': '#/definitions/sdc_recursive_object_array'}}}
317316

318317
def include_array_schemas(columns, schema):

0 commit comments

Comments
 (0)