Skip to content

Commit

Permalink
fix: set metadata columns types
Browse files Browse the repository at this point in the history
  • Loading branch information
TyShkan committed Mar 27, 2023
1 parent 23c5deb commit 9fb807b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tap_csv/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,22 @@ def schema(self) -> dict:
break
break

for column in header:
# Set all types to string
# TODO: Try to be smarter about inferring types.
properties.append(th.Property(column, th.StringType()))

# If enabled, add file's metadata to output
if self.config.get("add_metadata_columns", False):
header = [
SDC_SOURCE_FILE_COLUMN,
SDC_SOURCE_FILE_MTIME_COLUMN,
SDC_SOURCE_LINENO_COLUMN,
] + header

for column in header:
# Set all types to string
# TODO: Try to be smarter about inferring types.
properties.append(th.Property(column, th.StringType()))

properties.append(th.Property(SDC_SOURCE_FILE_COLUMN, th.StringType))
properties.append(th.Property(SDC_SOURCE_FILE_MTIME_COLUMN, th.DateTimeType))
properties.append(th.Property(SDC_SOURCE_LINENO_COLUMN, th.IntegerType))

# Cache header for future use
self.header = header
Expand Down

0 comments on commit 9fb807b

Please sign in to comment.