-
Notifications
You must be signed in to change notification settings - Fork 14k
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
chore: isolate examples database by default #25003
Conversation
/testenv up |
@john-bodley Ephemeral environment creation is currently limited to committers. |
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.
Looks good, i just left a question about #23399. I think it could be good to have the examples DB with DML and file uploads enabled, for a better initial experience with Superset.
or current_app.config["SQLALCHEMY_DATABASE_URI"] | ||
) | ||
return get_or_create_db("examples", db_uri) | ||
return get_or_create_db("examples", current_app.config["SQLALCHEMY_EXAMPLES_URI"]) |
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.
Regarding #23399, should we have the examples DB have DML on and with file uploads enabled?
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.
left a comment on #23399, no strong opinions about allowing DML/upload on the examples db, yet I do see this as a readonly db
(cherry picked from commit 269c992)
Someone in Slack reported that they are trying to follow the docker-compose setup instructions and are getting the error message:
I was surprised to see zero hits for EXAMPLES_USER in Superset GitHub issues, so went looking to see if there was a recent PR that related to this variable, and found this one. Do folks think this could have broken the default deployment in that way? |
@dpgaspar @sfirke @betodealmeida The problem is because when running with |
I don't feel strongly but think it would be nice to offer admins the option of examples or not. So add the necessary values to the .env file. Not sure if the examples should default to enabled or not for that deployment. |
Just tried to go with docs and got the same issue when running :
|
Did this PR from @sebastianliebscher and merged 2 hours ago by @michael-s-molina address this problem? |
@sfirke @misiekofski #25055 fixes the reported error. |
@@ -1452,7 +1452,7 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument | |||
|
|||
# URI to database storing the example data, points to | |||
# SQLALCHEMY_DATABASE_URI by default if set to `None` | |||
SQLALCHEMY_EXAMPLES_URI = None | |||
SQLALCHEMY_EXAMPLES_URI = "sqlite:///" + os.path.join(DATA_DIR, "examples.db") |
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.
@dpgaspar are we supporting sqlite as a valid examples db in production?
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.
same as before since our default for the metadata db is also sqlite https://github.com/apache/superset/blob/master/superset/config.py#L187
The difference is before this PR both schemas were on the same sqlite db
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.
We have an approved SIP to drop support for SQL Lite. I've added a ticket to the 4.0 board to ensure we execute this in the next major release.
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.
We do discourage people to use sqlite, though, so I'm wondering if we should put something in UPDATING.md that encourage people to change this value to a different db type?
SUMMARY
This PR places the examples database on it's own database, previously the examples database tables were being created on Superset's metadata database by default.
Setting the examples database on it's own database will stop giving users access to Superset's metadata database through SQLLab avoiding several possible attack vectors.
By default without using docker-compose, the examples database will be set on it's own SQLite db. Using docker-compose the postgres container will create a specific user for the examples db and the db itself.
Removed the default that set's the
SQLALCHEMY_EXAMPLES_URI
to be equal toSQLALCHEMY_DATABASE_URI
when not set.Before:
After:
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION