2019-01-15 18:53:27 -05:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2020-04-04 16:23:18 -04:00
|
|
|
# type: ignore
|
2019-02-27 18:11:38 -05:00
|
|
|
from copy import copy
|
2019-10-18 17:44:27 -04:00
|
|
|
|
2020-04-04 16:23:18 -04:00
|
|
|
from superset.config import *
|
2020-04-07 16:00:42 -04:00
|
|
|
from tests.superset_test_custom_template_processors import CustomPrestoTemplateProcessor
|
2016-03-18 02:44:58 -04:00
|
|
|
|
2019-06-25 16:34:48 -04:00
|
|
|
AUTH_USER_REGISTRATION_ROLE = "alpha"
|
|
|
|
SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "unittests.db")
|
2016-03-18 02:44:58 -04:00
|
|
|
DEBUG = True
|
2016-11-10 02:08:22 -05:00
|
|
|
SUPERSET_WEBSERVER_PORT = 8081
|
2016-06-09 21:05:58 -04:00
|
|
|
|
2020-08-06 15:07:22 -04:00
|
|
|
# Allowing SQLALCHEMY_DATABASE_URI and SQLALCHEMY_EXAMPLES_URI to be defined as an env vars for
|
2016-06-09 21:05:58 -04:00
|
|
|
# continuous integration
|
2019-06-25 16:34:48 -04:00
|
|
|
if "SUPERSET__SQLALCHEMY_DATABASE_URI" in os.environ:
|
2019-10-18 17:44:27 -04:00
|
|
|
SQLALCHEMY_DATABASE_URI = os.environ["SUPERSET__SQLALCHEMY_DATABASE_URI"]
|
2016-08-30 00:55:31 -04:00
|
|
|
|
2020-08-06 15:07:22 -04:00
|
|
|
SQLALCHEMY_EXAMPLES_URI = SQLALCHEMY_DATABASE_URI
|
|
|
|
if "SUPERSET__SQLALCHEMY_EXAMPLES_URI" in os.environ:
|
|
|
|
SQLALCHEMY_EXAMPLES_URI = os.environ["SUPERSET__SQLALCHEMY_EXAMPLES_URI"]
|
|
|
|
|
2020-08-27 12:49:18 -04:00
|
|
|
if "UPLOAD_FOLDER" in os.environ:
|
|
|
|
UPLOAD_FOLDER = os.environ["UPLOAD_FOLDER"]
|
|
|
|
|
2020-04-28 17:28:09 -04:00
|
|
|
if "sqlite" in SQLALCHEMY_DATABASE_URI:
|
|
|
|
logger.warning(
|
2020-05-14 11:58:30 -04:00
|
|
|
"SQLite Database support for metadata databases will be "
|
|
|
|
"removed in a future version of Superset."
|
2020-04-28 17:28:09 -04:00
|
|
|
)
|
|
|
|
|
2020-08-27 12:49:18 -04:00
|
|
|
# Speeding up the tests.
|
|
|
|
PRESTO_POLL_INTERVAL = 0.1
|
|
|
|
HIVE_POLL_INTERVAL = 0.1
|
|
|
|
|
2016-08-30 00:55:31 -04:00
|
|
|
SQL_MAX_ROW = 666
|
2020-03-03 12:52:20 -05:00
|
|
|
SQLLAB_CTAS_NO_LIMIT = True # SQL_MAX_ROW will not take affect for the CTA queries
|
2020-02-19 12:51:50 -05:00
|
|
|
FEATURE_FLAGS = {"foo": "bar", "KV_STORE": True, "SHARE_QUERIES_VIA_KV_STORE": True}
|
2019-06-25 16:34:48 -04:00
|
|
|
|
|
|
|
|
2019-02-27 18:11:38 -05:00
|
|
|
def GET_FEATURE_FLAGS_FUNC(ff):
|
|
|
|
ff_copy = copy(ff)
|
2019-06-25 16:34:48 -04:00
|
|
|
ff_copy["super"] = "set"
|
2019-02-27 18:11:38 -05:00
|
|
|
return ff_copy
|
|
|
|
|
2016-08-30 00:55:31 -04:00
|
|
|
|
|
|
|
TESTING = True
|
|
|
|
WTF_CSRF_ENABLED = False
|
2020-08-28 05:49:10 -04:00
|
|
|
|
|
|
|
FAB_ROLES = {"TestRole": [["Security", "menu_access"], ["List Users", "menu_access"]]}
|
|
|
|
|
|
|
|
PUBLIC_ROLE_LIKE = "Gamma"
|
2019-06-25 16:34:48 -04:00
|
|
|
AUTH_ROLE_PUBLIC = "Public"
|
2017-01-24 21:11:51 -05:00
|
|
|
EMAIL_NOTIFICATIONS = False
|
2020-04-29 16:57:06 -04:00
|
|
|
ENABLE_ROW_LEVEL_SECURITY = True
|
2020-08-27 12:38:12 -04:00
|
|
|
ENABLE_REACT_CRUD_VIEWS = os.environ.get("ENABLE_REACT_CRUD_VIEWS", False)
|
2016-08-30 00:55:31 -04:00
|
|
|
|
2019-06-25 16:34:48 -04:00
|
|
|
CACHE_CONFIG = {"CACHE_TYPE": "simple"}
|
|
|
|
|
2017-02-08 14:52:58 -05:00
|
|
|
|
2020-05-14 11:58:30 -04:00
|
|
|
REDIS_HOST = os.environ.get("REDIS_HOST", "localhost")
|
|
|
|
REDIS_PORT = os.environ.get("REDIS_PORT", "6379")
|
|
|
|
REDIS_CELERY_DB = os.environ.get("REDIS_CELERY_DB", 2)
|
|
|
|
REDIS_RESULTS_DB = os.environ.get("REDIS_RESULTS_DB", 3)
|
2020-09-15 14:17:21 -04:00
|
|
|
REDIS_CACHE_DB = os.environ.get("REDIS_CACHE_DB", 4)
|
|
|
|
|
|
|
|
CACHE_CONFIG = {
|
|
|
|
"CACHE_TYPE": "redis",
|
|
|
|
"CACHE_DEFAULT_TIMEOUT": 60 * 60 * 24, # 1 day default (in secs)
|
|
|
|
"CACHE_KEY_PREFIX": "superset_cache",
|
|
|
|
"CACHE_REDIS_URL": f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CACHE_DB}",
|
|
|
|
}
|
2020-05-14 11:58:30 -04:00
|
|
|
|
|
|
|
|
2016-08-30 00:55:31 -04:00
|
|
|
class CeleryConfig(object):
|
2020-05-14 11:58:30 -04:00
|
|
|
BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
|
2019-06-25 16:34:48 -04:00
|
|
|
CELERY_IMPORTS = ("superset.sql_lab",)
|
2020-05-14 11:58:30 -04:00
|
|
|
CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_RESULTS_DB}"
|
2019-06-25 16:34:48 -04:00
|
|
|
CELERY_ANNOTATIONS = {"sql_lab.add": {"rate_limit": "10/s"}}
|
2016-08-30 00:55:31 -04:00
|
|
|
CONCURRENCY = 1
|
2017-11-10 20:52:34 -05:00
|
|
|
|
|
|
|
|
2016-08-30 00:55:31 -04:00
|
|
|
CELERY_CONFIG = CeleryConfig
|
2020-04-07 16:00:42 -04:00
|
|
|
|
|
|
|
CUSTOM_TEMPLATE_PROCESSORS = {
|
|
|
|
CustomPrestoTemplateProcessor.engine: CustomPrestoTemplateProcessor
|
|
|
|
}
|
2020-05-27 12:02:03 -04:00
|
|
|
|
|
|
|
PRESERVE_CONTEXT_ON_EXCEPTION = False
|