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

Scheduled queries google dbm #158

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

benoitbazouin
Copy link
Contributor

The goal of this PR is to enable the creation of scheduled reports for Google DBM reader.

To do so, I added a function that creates the "schedule" body of the query depending on the query request type.

Moreover, I added the the possible values for the timezone codes and the frequencies in cli.py

@@ -33,7 +33,8 @@
@click.option("--dbm-request-type", type=click.Choice(POSSIBLE_REQUEST_TYPES), required=True)
@click.option("--dbm-query-id")
@click.option("--dbm-query-title")
@click.option("--dbm-query-frequency", default="ONE_TIME")
@click.option("--dbm-query-frequency", type=click.Choice(POSSIBLE_FREQUENCIES), default="ONE_TIME")
@click.option("--dbm-query-timezone-code", type=click.Choice(POSSIBLE_TIMEZONE_CODES), default="America/New_York")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add this new option to the documentation ? A small guide on how to use sphinx is available here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes thank you

ack/readers/google_dbm/config.py Outdated Show resolved Hide resolved
docs/source/readers.rst Show resolved Hide resolved
scheduled_start_date: date, scheduled_end_date: date, frequency: str, date_range: str
):

if not date_range:
Copy link
Contributor

@pol-defont-reaulx pol-defont-reaulx Jul 26, 2021

Choose a reason for hiding this comment

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

From what I see it's almost the same code as check_date_range_definition_conformity, is it possible to call this function from the new one by doing the new tests before calling check_date_range_definition_conformity? It should avoid code duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic is not the same for a scheduled report and for a normal report.
In a normal report, we shouldn't have both a date range and a couple of dates.
In a scheduled report, it is needed.

I could indeed use check_date_range_definition_conformity(scheduled_start_date, scheduled_end_date, None) after my else, but it seems to me that it is a "hack" just to avoid code deduplication that doesn't explain the logic behind the check.

What do you think @AlexisVLRT ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems logical to me, thanks for the explanation

Copy link
Contributor

@pol-defont-reaulx pol-defont-reaulx left a comment

Choose a reason for hiding this comment

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

lgtm

@benoitbazouin benoitbazouin marked this pull request as draft September 10, 2021 06:52
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.

3 participants