-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# ------------------------------------------------------------------------ | ||
# Creates the examples database and repective user. This database location | ||
# and access credentials are defined on the environment variables | ||
# ------------------------------------------------------------------------ | ||
set -e | ||
|
||
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" <<-EOSQL | ||
CREATE USER ${EXAMPLES_USER} WITH PASSWORD '${EXAMPLES_PASSWORD}'; | ||
CREATE DATABASE ${EXAMPLES_DB}; | ||
GRANT ALL PRIVILEGES ON DATABASE ${EXAMPLES_DB} TO ${EXAMPLES_USER}; | ||
EOSQL | ||
|
||
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" -d "${EXAMPLES_DB}" <<-EOSQL | ||
GRANT ALL ON SCHEMA public TO ${EXAMPLES_USER}; | ||
EOSQL |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,11 +65,7 @@ def get_or_create_db( | |
|
||
|
||
def get_example_database() -> Database: | ||
db_uri = ( | ||
current_app.config.get("SQLALCHEMY_EXAMPLES_URI") | ||
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 commentThe 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 commentThe 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 |
||
|
||
|
||
def get_main_database() -> Database: | ||
|
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?