mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: Set isolation level to READ COMMITTED for testing et al. (#28628)
This commit is contained in:
@@ -196,6 +196,13 @@ SQLALCHEMY_DATABASE_URI = (
|
||||
# SQLALCHEMY_DATABASE_URI = 'mysql://myapp@localhost/myapp'
|
||||
# SQLALCHEMY_DATABASE_URI = 'postgresql://root:password@localhost/myapp'
|
||||
|
||||
# The default MySQL isolation level is REPEATABLE READ whereas the default PostgreSQL
|
||||
# isolation level is READ COMMITTED. All backends should use READ COMMITTED (or similar)
|
||||
# to help ensure consistent behavior.
|
||||
SQLALCHEMY_ENGINE_OPTIONS = {
|
||||
"isolation_level": "SERIALIZABLE", # SQLite does not support READ COMMITTED.
|
||||
}
|
||||
|
||||
# In order to hook up a custom password store for all SQLALCHEMY connections
|
||||
# implement a function that takes a single argument of type 'sqla.engine.url',
|
||||
# returns a password and set SQLALCHEMY_CUSTOM_PASSWORD_STORE.
|
||||
|
||||
@@ -20,6 +20,8 @@ import math
|
||||
from copy import copy
|
||||
from datetime import timedelta
|
||||
|
||||
from sqlalchemy.engine import make_url
|
||||
|
||||
from superset.config import * # noqa: F403
|
||||
from superset.config import DATA_DIR
|
||||
from tests.integration_tests.superset_test_custom_template_processors import (
|
||||
@@ -52,12 +54,15 @@ if "SUPERSET__SQLALCHEMY_EXAMPLES_URI" in os.environ: # noqa: F405
|
||||
if "UPLOAD_FOLDER" in os.environ: # noqa: F405
|
||||
UPLOAD_FOLDER = os.environ["UPLOAD_FOLDER"] # noqa: F405
|
||||
|
||||
if "sqlite" in SQLALCHEMY_DATABASE_URI:
|
||||
if make_url(SQLALCHEMY_DATABASE_URI).get_backend_name() == "sqlite":
|
||||
logger.warning( # noqa: F405
|
||||
"SQLite Database support for metadata databases will be "
|
||||
"removed in a future version of Superset."
|
||||
)
|
||||
|
||||
if make_url(SQLALCHEMY_DATABASE_URI).get_backend_name() in ("postgresql", "mysql"):
|
||||
SQLALCHEMY_ENGINE_OPTIONS["isolation_level"] = "READ COMMITTED" # noqa: F405
|
||||
|
||||
# Speeding up the tests.integration_tests.
|
||||
PRESTO_POLL_INTERVAL = 0.1
|
||||
HIVE_POLL_INTERVAL = 0.1
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# type: ignore
|
||||
from copy import copy
|
||||
|
||||
from sqlalchemy.engine import make_url
|
||||
|
||||
from superset.config import * # noqa: F403
|
||||
from superset.config import DATA_DIR
|
||||
|
||||
@@ -33,12 +35,15 @@ DEBUG = True
|
||||
if "SUPERSET__SQLALCHEMY_DATABASE_URI" in os.environ: # noqa: F405
|
||||
SQLALCHEMY_DATABASE_URI = os.environ["SUPERSET__SQLALCHEMY_DATABASE_URI"] # noqa: F405
|
||||
|
||||
if "sqlite" in SQLALCHEMY_DATABASE_URI:
|
||||
if make_url(SQLALCHEMY_DATABASE_URI).get_backend_name() == "sqlite":
|
||||
logger.warning( # noqa: F405
|
||||
"SQLite Database support for metadata databases will be removed \
|
||||
in a future version of Superset."
|
||||
)
|
||||
|
||||
if make_url(SQLALCHEMY_DATABASE_URI).get_backend_name() in ("postgresql", "mysql"):
|
||||
SQLALCHEMY_ENGINE_OPTIONS["isolation_level"] = "READ COMMITTED" # noqa: F405
|
||||
|
||||
SQL_SELECT_AS_CTA = True
|
||||
SQL_MAX_ROW = 666
|
||||
|
||||
|
||||
Reference in New Issue
Block a user