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

Support downloading files as a zip file #4

Open
buremba opened this issue Jun 25, 2021 · 4 comments
Open

Support downloading files as a zip file #4

buremba opened this issue Jun 25, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@buremba
Copy link
Member

buremba commented Jun 25, 2021

We will call this library from our web app and let people generate LookML projects locally if they wish so. In order to integrate with the web app, the users need to be able to download the LookML files as a zip file. Here is how it looks like: https://cln.sh/wVY9s9

We can have a command-line argument called --stdout that outputs a zip file to stdout so that we can call the Python library from our application or the users can run the following command:

metriql-looker --stdout > files.zip
@buremba buremba added the enhancement New feature or request label Jun 25, 2021
@UmarMajeed-Rana
Copy link
Collaborator

If the app is run by the web app how will you make sure that the folder / Zipfile created is unique? The caller will have responsibility of assigning unique name? When you say "outputs a zip file to stdout" you mean it will output the zip file to root folder?

@buremba
Copy link
Member Author

buremba commented Jun 29, 2021

We should not be creating any files, instead, the Python script will print out the zip file content to stdout so that we read the content in our web app and stream it to the web browser.

Here is an example in Python: https://stackoverflow.com/questions/55514745/how-to-stream-from-zipfile-how-to-zip-on-the-fly

When we build the project, it will work just like gzip command in bash: https://serverfault.com/questions/366388/how-to-zip-the-standard-output-of-a-process

Our app will create a subprocess by running this Python library, and reads the output:

  1. If it writes to stdout, the app reads the contents, creates a zip file on the file with a name and lets the browser download the file.
  2. If the script runs into an error, it will write to stderr so that our app understands that there is an error and reads the content to show the error message to the end-user.

@buremba
Copy link
Member Author

buremba commented Jul 3, 2021

We have already done something similar for our Tableau integration so I'm re-assigning this one to myself.

@buremba buremba assigned buremba and unassigned UmarMajeed-Rana Jul 3, 2021
@buremba
Copy link
Member Author

buremba commented Jul 6, 2021

waiting for #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants