Skip to content

Commit

Permalink
enforce lower case headers from airtable
Browse files Browse the repository at this point in the history
  • Loading branch information
floptical committed Feb 9, 2024
1 parent bb16efb commit 8d8b84a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion databridge_etl_tools/airtable/airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def get_fieldnames(self):

for fieldname in record_fieldnames:
if fieldname not in fieldnames:

fieldnames.append(fieldname)

# Enforce lower-case headers because
# we're going into postgres and don't want mixed case.
fieldnames = [x.lower() for x in fieldnames]

return fieldnames

Expand Down Expand Up @@ -86,7 +91,11 @@ def process_row(self, row: Dict) -> Dict:
# be jsonified to be inserted and displayd properly.
if isinstance(value, list):
row[key] = json.dumps(value)
return row

# lowercase all fields, we don't want mixed case in postgres
row_lower = {k.lower(): v for k, v in row.items()}

return row_lower

def load_to_s3(self):
s3 = boto3.resource('s3')
Expand Down

0 comments on commit 8d8b84a

Please sign in to comment.