-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
[SIP-23] Move SQL Lab storage out of browser localStorage #7748
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Some notes:
|
Thoughts...
|
I also agree that adding a json blob would make it difficult to make updates to the store, especially since the state structure can change as often as we want it to. |
I'm not sure what's the best way of handling this. Currently the last edit is persisted, but not propagated to other open tabs. The implementation proposed would preserve that behavior. We could use
Good point, thanks! |
I suggest keeping the narrative clean, stick to the general principle of this SIP, and NOT use local storage. What about?
The last 3 bullets make a foundational assumption that a user will not be simultaneously editing in 2 windows. They may have 2 windows open, even side by side on the same screen, but they will only have focus and be actively typing in one of them. EDIT to note: thie TL;DR of this is that when you are typing, if another editor window is open and visible, it will update at the polling frequency to reflect what you are typing in the focus window. |
Why are both of |
|
[SIP] Proposal for moving SQL Lab storage out of browser localStorage
Motivation
Currently, we store SQL Lab state in the browser
localStorage
, including tabs, their queries and results. The redux state is persisted tolocalStorage
using theredux-localstorage
library.While the implementation is clean, it provides a few drawbacks:
At Lyft we're currently migrating from BigQuery to Superset, and the project requires querying tables with nested fields (see the work on #7625, #7627 and #7693). Here's what we see when querying the first 100 rows from one of our tables:
In this case, the query is running automatically for the data preview when the user selects the table in the table browser (left of SQL Lab) in order to inspect it. This makes the browser extremely sluggish, even crashing it.
Proposed Change
I propose moving the persistence of SQL Lab's state from the browser
localStorage
to the metadata database. State would be synced the following way:backend -> frontend
frontend -> backend
These changes should be transparent to the user, with the exception that there will be an additional latency from having to request the state from the server, instead of having it in
localStorage
.New or Changed Public Interfaces
For this work, we need to create the following models:
These will be exposed via automatically generated views by FAB.
Note that since we're loading the query results from the server, for synchronous queries we need to store the results in a results backend. We can fallback to a simple results backend (
werkzeug.contrib.cache.BaseCache
, eg) when none is set.Optionally, we can store results ourselves in the database with a simple model:
New dependencies
None.
Migration Plan and Compatibility
We should implement logic that moves the state from
localStorage
to the backend when we detect that it's stored in the browser.Rejected Alternatives
None.
The text was updated successfully, but these errors were encountered: