Skip to content

Commit

Permalink
json dump is necessary for carto arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
floptical committed Feb 7, 2024
1 parent b9774d4 commit a56dc51
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions databridge_etl_tools/airtable/airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ def get_records(self):

def process_row(self, row: Dict) -> Dict:
for key, value in row.items():
# De-list-ify list into a comma separated string.
# Not sure why prior author did a json dumps. -Roland
# This is necessary to convert list type items to json so it can be inserted as an array/list properly.
# Specifically for carto data type "array" (shows as "jsonb" in the web gui), when we get lists from airflow they'll need to
# be jsonified to be inserted and displayd properly.
if isinstance(value, list):
#row[key] = json.dumps(value)
row[key] = ','.join([str(x) for x in value])

row[key] = json.dumps(value)
return row

def load_to_s3(self):
Expand Down

0 comments on commit a56dc51

Please sign in to comment.