Skip to content

Commit

Permalink
allow get_fields to be None
Browse files Browse the repository at this point in the history
  • Loading branch information
floptical committed Feb 8, 2024
1 parent 2c891a2 commit 818237e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions databridge_etl_tools/airtable/airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, app_id:str, api_key:str, table_name:str, s3_bucket:str, s3_ke
self.s3_key = s3_key
self.offset = None
self.rows_per_page = 1000
self.get_fields = get_fields.split(',')
self.get_fields
self.csv_path = f'/tmp/{self.table_name}.csv'

def get_fieldnames(self):
Expand All @@ -28,7 +28,7 @@ def get_fieldnames(self):
request_stmt = f'https://api.airtable.com/v0/{self.app_id}/{self.table_name}?maxRecords={self.rows_per_page}'

if self.get_fields:
for field in self.get_fields:
for field in self.get_fields.split(','):
request_stmt = request_stmt + '&fields%5B%5D=' + field

print(f'Airtable endpoint: {request_stmt}')
Expand Down Expand Up @@ -59,7 +59,7 @@ def get_records(self, offset=None):
request_stmt = f'https://api.airtable.com/v0/{self.app_id}/{self.table_name}?maxRecords={self.rows_per_page}'

if self.get_fields:
for field in self.get_fields:
for field in self.get_fields.split(','):
request_stmt = request_stmt + '&fields%5B%5D=' + field


Expand Down

0 comments on commit 818237e

Please sign in to comment.