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 get_query_executions generating DataFrames from Athena query executions detail #1676

Merged
merged 10 commits into from
Oct 18, 2022

Conversation

KhueNgocDang
Copy link
Contributor

@KhueNgocDang KhueNgocDang commented Oct 11, 2022

Feature or Bugfix-

  • Feature

Detail

  • Add list_query_executions to Athena module for fetching list query execution IDs.
  • Add get_query_executions to Athena module for returning DataFrames contain query executions details

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…utions detail (#1)

* Added list_query_executions to Athena module

* Modified doc string for Athena's list_query_executions

* Added get_query_executions for Athena module

* Added typing for list_query_executions

* Reduced complexity

* Added test

* Fixed incompatible type raise by mypy for try_it
Fixed E501 from flake8
@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: 1730739
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@KhueNgocDang KhueNgocDang marked this pull request as ready for review October 11, 2022 06:18
query_executions += response["QueryExecutions"]
unprocessed_query_execution += response["UnprocessedQueryExecutionIds"]

return pd.json_normalize(query_executions), pd.json_normalize(unprocessed_query_execution)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of two dataframes, perhaps we can consider having a single one with an additional column indicating the state of the query execution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jaidisido
I misunderstood the boto3 explanation on UnprocessedQueryExecutionIds, thus the doc string for get_query_executions is wrong .UnprocessedQueryExecutionIds actually contains query ids that the IAM user did not have access to when they called BatchGetQueryExecution (https://docs.aws.amazon.com/athena/latest/ug/workgroups-troubleshooting.html).
Still, I think that merging two dataframes into one would make it hard for the user to know if there are some query_id that they don't have access to.

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: 5eaa5ac
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: 8d2ca8a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: 44baa9d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@malachi-constant malachi-constant left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jaidisido jaidisido left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution

@jaidisido jaidisido merged commit 3e49124 into aws:main Oct 18, 2022
@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: 6a26fe6
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@kukushking kukushking added this to the 2.18.0 milestone Dec 2, 2022
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.

None yet

4 participants