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

Athena query cost #4077

Merged
merged 1 commit into from
May 27, 2020
Merged

Athena query cost #4077

merged 1 commit into from
May 27, 2020

Conversation

ialeinikov
Copy link
Contributor

@ialeinikov ialeinikov commented Aug 17, 2019

What type of PR is this? (check all applicable)

  • Feature

Description

Shows a price for an Athena query

Screen Shot 2019-08-17 at 6 31 44 pm

Screen Shot 2019-08-17 at 6 32 49 pm

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Thanks! See comments.

@@ -280,6 +280,9 @@ <h3>
<span class="query-metadata__property" ng-if="queryResult.query_result.data.metadata.data_scanned">Data Scanned
<strong>{{ queryResult.query_result.data.metadata.data_scanned | prettySize}}</strong>
</span>
<span class="query-metadata__property" ng-if="queryResult.query_result.data.metadata.query_cost">Query cost in USD
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<span class="query-metadata__property" ng-if="queryResult.query_result.data.metadata.query_cost">Query cost in USD
<span class="query-metadata__property" ng-if="queryResult.query_result.data.metadata.query_cost">Cost (USD)

schema['properties'].update({
'cost_per_tb': {
'type': 'number',
'title': 'Athena cost per Tb scanned',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'title': 'Athena cost per Tb scanned',
'title': 'Athena cost per Tb scanned (USD)',

@@ -238,6 +249,9 @@ def run_query(self, query, user):
'athena_query_id': athena_query_id
}
}
if EXPOSE_COST:
price = self.configuration.get('cost_per_tb', 5)
data['metadata'].update({'query_cost': '${0:.2f}'.format(price * qbytes * 10e-12)})
Copy link
Member

Choose a reason for hiding this comment

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

Let's store it as a number and format it in view, in case someone would like to run calculations on it.

@arikfr
Copy link
Member

arikfr commented Jan 21, 2020

Hi,

(This is a template message, but I mean every word of it. Also you're welcome to reply)

Thank you for making this contribution. While we couldn't bring it to completion and merge, it's still very much appreciated. 🙇

In the past year the Redash code base gone under massive updates: on the backend we moved to Python 3 & RQ instead of Celery and on the frontend we replaced Angular with React. It's very likely this makes this PR irrelevant without significant changes. :-(

I'm closing this PR now. But if you're still interested in making it happen, let me know and I will reopen.

Thanks.

@arikfr arikfr closed this Jan 21, 2020
Paritosh-Anand pushed a commit to makemytrip/redash that referenced this pull request Jan 22, 2020
@arikfr arikfr reopened this Mar 19, 2020
@restyled-io restyled-io bot mentioned this pull request Mar 19, 2020
@arikfr arikfr merged commit d1044c1 into getredash:master May 27, 2020
@arikfr
Copy link
Member

arikfr commented May 27, 2020

@ialeinikov merged. Thank you for your patience.

@jychen7
Copy link

jychen7 commented Jul 21, 2020

[Question] sorry, I just upgrade to Docker Tag: redash/redash:9.0.0-beta.b42121, however, still didn't see "Cost" in UI

I can confirm from developer console that "query_cost" is in response body "query_result.data.metadata"
However, the editor UI still shows "Data Scanned xxx MB" without query cost (I also try hard refresh my tab in browser)

@gabrieldutra
Copy link
Member

🤔, just noticed this was merged only with backend code. @arikfr, is that so, or should we add the Metadata in query source page?

jychen7 added a commit to jychen7/redash that referenced this pull request Aug 10, 2020
@jychen7
Copy link

jychen7 commented Aug 10, 2020

I create a PR #5098, but waiting for CI

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.

4 participants