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

Set filename when calling the /results endpoint directly #3326

Closed
arikfr opened this issue Jan 23, 2019 · 3 comments
Closed

Set filename when calling the /results endpoint directly #3326

arikfr opened this issue Jan 23, 2019 · 3 comments

Comments

@arikfr
Copy link
Member

arikfr commented Jan 23, 2019

Probably by using the Content-Disposition header.

@aidarbek
Copy link
Member

Hi! I am new to the project, could you clarify few things? As far as I understood, the https://github.com/getredash/redash/blob/master/redash/handlers/query_results.py file (QueryResultResource class) should be changed and Content-Disposition header should be added to response containing xlsx, csv and json files. What the name of the file should be? Can it be query_result_id or query_id variables?

@arikfr
Copy link
Member Author

arikfr commented Jan 29, 2019

Hi @aidarbek, welcome :)

This is how we generate the filename on the frontend:

`${scope.query.name.replace(/ /g, '_') +
moment(scope.queryResult.getUpdatedAt()).format('_YYYY_MM_DD')}.${fileType}`,

Basically: query name (spaces replaced with _) + date of query result execution + file extension.

I guess we can do the same?

@arikfr
Copy link
Member Author

arikfr commented Jan 30, 2019

Implemented in #3359 by @aidarbek 🙇

@arikfr arikfr closed this as completed Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants