superset icon indicating copy to clipboard operation
superset copied to clipboard

Add Ability to Save Results from Previous Queries Using S3

Open jefffeng opened this issue 9 years ago • 10 comments

Currently, we do not provide a way to save query results outside of CTAS (Create Table As). We should add a feature that allows a user to view/download the results of a previous query even after a new query is run, using S3 as the backend for holding those results.

jefffeng avatar Dec 08 '16 00:12 jefffeng

Is anyone assigned this issue?

rwsmith avatar Feb 10 '17 19:02 rwsmith

It was partially implemented here: https://github.com/airbnb/superset/pull/2113

bkyryliuk avatar Feb 10 '17 22:02 bkyryliuk

@bkyryliuk - it sounds like Ben did the work to implement the S3 cache. What's the remaining gap? Actually viewing/downloading the data?

jfeng15 avatar Feb 18 '17 08:02 jfeng15

Notice: this issue has been closed because it has been inactive for 429 days. Feel free to comment and request for this issue to be reopened.

mistercrunch avatar Apr 23 '18 15:04 mistercrunch

@mistercrunch I'd like to ask for this to be reopened.

Our use case is showing query results from today together with a "snapshot" of yesterdays data.

So like @jfeng15 asked, what's the remaining gap that needs to be developed? Is the S3 cache working? I couldn't find any examples in the documentation.

qyoz avatar May 16 '18 11:05 qyoz

s3 cache works as a place to hold SQL Lab results when the database is operating in async mode.

In async mode, the query is executed on a Superset worker, and the worker updates the state of the query and flushes the results to the "results backend" which can be s3, redis, or whatever else. It's documented in the installation docs.

mistercrunch avatar May 16 '18 14:05 mistercrunch

so it this the right issue for what we're asking? or should I open a feature request? this isn't about running in async mode, the use case here is saving the result and being able to slice it

qyoz avatar May 16 '18 16:05 qyoz

Why not creating a summary table (CREATE TABLE AS) and then slice/dicing the result set in that summary table?

mistercrunch avatar May 16 '18 18:05 mistercrunch

Because on a large scale, this would be abusive. Here is the use case in a little more detail. We have a database which stores user configurations. We want to know how many users have feature X enabled at this point in time, but we also want to compare it with how many users had feature X enabled yesterday (and a week ago, etc). This isn't an event database, its closer to a metadata database, so essentially, we want to query snapshots of its state.

Consider doing this using CTAS, the database would become bloated very quickly. We could also create dedicated snapshots of this DB, but for large instances this can become a costly operation.

My thought was to have a "save result" feature where you could slice on a saved results set. This way we could show and compare today's data with the saved results.

qyoz avatar May 17 '18 10:05 qyoz

Seems like a data engineering / data preparation would be best in this case. You'd ETL your user conf data into a data warehouse, while keeping track of the history/changes.

While Superset has caching features, there's no chart "snapshoting" feature and would make the cache saved as of a point in time for a specific chart.

I don't see that coming anytime soon, so your best bet is ETL.

mistercrunch avatar May 17 '18 16:05 mistercrunch