Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add date type processing #2

Merged
merged 5 commits into from
Nov 26, 2021
Merged

Conversation

AnastasiyaEsiunina
Copy link

No description provided.

Copy link

@ricardoatsouza ricardoatsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments.

@@ -100,6 +110,15 @@ def process_worksheet(gsheets_loader, sheet_name, worksheet, start_from_row, con
singer.write_record(stream_name, record_transformed)


def non_standard_date_execution(records):
for record in records:
for field in record:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, basically this is looping through every record and every field trying to parse the date, right?
How many records we have in there?

I am just a bit concerned, because this could be quite impactful in the performance.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative, it should be possible to look for a date column using only the first record. Would that work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll think about it. i believe that's this way incorrect. All date fields will be transformed to date_format. need to change whole logic

@@ -64,9 +70,13 @@ def process_worksheet(gsheets_loader, sheet_name, worksheet, start_from_row, con
else:
stream_name = tableize(parameterize(name_with_worksheet))

records = gsheets_loader.get_records_as_json(sheet_name, worksheet, start_from_row)

if gsheet_loader.date_format:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I followed the logic correctly, this field will always exist, right? If that is the case, then this if is unnecessary. 🙂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we need to transform date column we will set date template to this field otherwise it will empty all the time

Comment on lines 46 to 49
if "date_format" in sheet:
gsheet_loader.date_format = sheet["date_format"]
else:
gsheet_loader.date_format = ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this suggestion:

Suggested change
if "date_format" in sheet:
gsheet_loader.date_format = sheet["date_format"]
else:
gsheet_loader.date_format = ""
gsheet_loader.date_format = ""
if "date_format" in sheet:
gsheet_loader.date_format = sheet["date_format"]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can delete the second condition 'else'
because default value of this var it's none
https://github.com/miroapp/tap-gsheets/blob/add_date_type_processing/tap_gsheets/gsheet_loader.py#L10

@AnastasiyaEsiunina AnastasiyaEsiunina merged commit 89529b8 into master Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants