-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Athena query cost #4077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! See comments.
client/app/pages/queries/query.html
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<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) |
redash/query_runner/athena.py
Outdated
schema['properties'].update({ | ||
'cost_per_tb': { | ||
'type': 'number', | ||
'title': 'Athena cost per Tb scanned', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'title': 'Athena cost per Tb scanned', | |
'title': 'Athena cost per Tb scanned (USD)', |
redash/query_runner/athena.py
Outdated
@@ -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)}) |
There was a problem hiding this comment.
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.
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. |
@ialeinikov merged. Thank you for your patience. |
[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" |
🤔, just noticed this was merged only with backend code. @arikfr, is that so, or should we add the Metadata in query source page? |
I create a PR #5098, but waiting for CI |
What type of PR is this? (check all applicable)
Description
Shows a price for an Athena query
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)