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

fix(ingest): redshift usage properly count queries #3370

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

treff7es
Copy link
Contributor

Introducing a couple of fixes for the usage query:

  • Using stl_query instead of stl_queryytext because it does not split queries at 200 characters (https://docs.aws.amazon.com/redshift/latest/dg/r_STL_QUERYTEXT.html) and it also contains information about if the query was aborted or not
  • using start date from stl_query instead of stl_scan table to make sure the distinct works well
  • changing end time comparison to use start time and not with end time as the other usage queries work the same way and to not miss a query
  • Removing uri_opts=self.options from get_sql_alchemy_url to make consistent with redshift ingest and to be able to set sqlalchemy options like connect_args

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@treff7es treff7es changed the title fix(ingest): redshift usage properly counting sqls fix(ingest): redshift usage properly count queries Oct 12, 2021
Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

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

LGTM!

@shirshanka shirshanka added the hacktoberfest-accepted Acceptance for hacktoberfest https://hacktoberfest.com/participation/ label Oct 12, 2021
Copy link
Collaborator

@hsheth2 hsheth2 left a comment

Choose a reason for hiding this comment

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

LGTM!

@treff7es treff7es force-pushed the redshift_usage_fixes branch from 694886a to 761dc1e Compare October 12, 2021 18:04
@treff7es
Copy link
Contributor Author

I have updated the test query to fix the build.
It should pass now.

@shirshanka shirshanka merged commit 4c8105e into datahub-project:master Oct 12, 2021
@treff7es treff7es deleted the redshift_usage_fixes branch February 8, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Acceptance for hacktoberfest https://hacktoberfest.com/participation/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants