mirror of
https://github.com/apache/superset.git
synced 2026-05-21 15:55:10 +00:00
Add to DB without sqlglot dialect
This commit is contained in:
@@ -23,6 +23,7 @@ from sqlalchemy import types
|
||||
|
||||
from superset.constants import TimeGrain
|
||||
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from superset.connectors.sqla.models import TableColumn
|
||||
@@ -68,6 +69,8 @@ class CrateEngineSpec(BaseEngineSpec):
|
||||
TimeGrain.YEAR: "DATE_TRUNC('year', {col})",
|
||||
}
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
@classmethod
|
||||
def epoch_to_dttm(cls) -> str:
|
||||
return "{col} * 1000"
|
||||
|
||||
@@ -39,6 +39,7 @@ from superset.db_engine_specs.base import (
|
||||
)
|
||||
from superset.db_engine_specs.exceptions import SupersetDBAPIDatabaseError
|
||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||
from superset.sql.parse import RLSMethod
|
||||
from superset.utils.core import GenericDataType
|
||||
from superset.utils.hashing import hash_from_str
|
||||
from superset.utils.network import is_hostname_valid, is_port_open
|
||||
@@ -55,6 +56,8 @@ class DatabendBaseEngineSpec(BaseEngineSpec):
|
||||
time_secondary_columns = True
|
||||
time_groupby_inline = True
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
_time_grain_expressions = {
|
||||
None: "{col}",
|
||||
TimeGrain.SECOND: "DATE_TRUNC('SECOND', {col})",
|
||||
|
||||
@@ -26,6 +26,7 @@ from superset.db_engine_specs.base import (
|
||||
DatabaseCategory,
|
||||
)
|
||||
from superset.errors import SupersetErrorType
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
|
||||
# Internal class for defining error message patterns (for translation)
|
||||
@@ -58,6 +59,8 @@ class DenodoEngineSpec(BaseEngineSpec, BasicParametersMixin):
|
||||
engine = "denodo"
|
||||
engine_name = "Denodo"
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
default_driver = "psycopg2"
|
||||
sqlalchemy_uri_placeholder = (
|
||||
"denodo://user:password@host:port/dbname[?key=value&key=value...]"
|
||||
|
||||
@@ -21,12 +21,15 @@ from sqlalchemy import types
|
||||
|
||||
from superset.constants import TimeGrain
|
||||
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
|
||||
class DynamoDBEngineSpec(BaseEngineSpec):
|
||||
engine = "dynamodb"
|
||||
engine_name = "Amazon DynamoDB"
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
metadata = {
|
||||
"description": (
|
||||
"Amazon DynamoDB is a serverless NoSQL database with SQL via PartiQL."
|
||||
|
||||
@@ -28,6 +28,7 @@ from superset.db_engine_specs.exceptions import (
|
||||
SupersetDBAPIOperationalError,
|
||||
SupersetDBAPIProgrammingError,
|
||||
)
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
@@ -39,6 +40,7 @@ class ElasticSearchEngineSpec(BaseEngineSpec): # pylint: disable=abstract-metho
|
||||
allows_joins = False
|
||||
allows_subqueries = True
|
||||
allows_sql_comments = False
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
metadata = {
|
||||
"description": (
|
||||
|
||||
@@ -18,6 +18,7 @@ from typing import Any, Optional
|
||||
|
||||
from superset.constants import TimeGrain
|
||||
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
|
||||
class ExasolEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
|
||||
@@ -26,6 +27,7 @@ class ExasolEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
|
||||
engine = "exa"
|
||||
engine_name = "Exasol"
|
||||
max_column_name_length = 128
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
metadata = {
|
||||
"description": (
|
||||
|
||||
@@ -21,7 +21,7 @@ from sqlalchemy import types
|
||||
|
||||
from superset.constants import TimeGrain
|
||||
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.sql.parse import LimitMethod
|
||||
from superset.sql.parse import LimitMethod, RLSMethod
|
||||
|
||||
|
||||
class FirebirdEngineSpec(BaseEngineSpec):
|
||||
@@ -53,6 +53,8 @@ class FirebirdEngineSpec(BaseEngineSpec):
|
||||
# Firebird uses FIRST to limit: `SELECT FIRST 10 * FROM table`
|
||||
limit_method = LimitMethod.FETCH_MANY
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
_time_grain_expressions = {
|
||||
None: "{col}",
|
||||
TimeGrain.SECOND: (
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
from .db2 import Db2EngineSpec
|
||||
|
||||
|
||||
@@ -28,6 +30,8 @@ class IBMiEngineSpec(Db2EngineSpec):
|
||||
engine_name = "IBM Db2 for i"
|
||||
max_column_name_length = 128
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
@classmethod
|
||||
def epoch_to_dttm(cls) -> str:
|
||||
return "(DAYS({col}) - DAYS('1970-01-01')) * 86400 + MIDNIGHT_SECONDS({col})"
|
||||
|
||||
@@ -28,7 +28,7 @@ from superset.db_engine_specs.exceptions import (
|
||||
SupersetDBAPIOperationalError,
|
||||
SupersetDBAPIProgrammingError,
|
||||
)
|
||||
from superset.sql.parse import LimitMethod
|
||||
from superset.sql.parse import LimitMethod, RLSMethod
|
||||
from superset.utils.core import GenericDataType
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class KustoSqlEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
|
||||
allows_joins = True
|
||||
allows_subqueries = True
|
||||
allows_sql_comments = False
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
metadata = {
|
||||
"description": (
|
||||
|
||||
@@ -21,6 +21,7 @@ from sqlalchemy import types
|
||||
|
||||
from superset.constants import TimeGrain
|
||||
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
|
||||
class KylinEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
|
||||
@@ -29,6 +30,8 @@ class KylinEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
|
||||
engine = "kylin"
|
||||
engine_name = "Apache Kylin"
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
metadata = {
|
||||
"description": "Apache Kylin is an open-source OLAP engine for big data.",
|
||||
"logo": "apache-kylin.png",
|
||||
|
||||
@@ -39,6 +39,7 @@ from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.errors import SupersetErrorType
|
||||
from superset.models.core import Database
|
||||
from superset.models.sql_lab import Query
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
# Regular expressions to catch custom errors
|
||||
|
||||
@@ -227,6 +228,8 @@ class OcientEngineSpec(BaseEngineSpec):
|
||||
force_column_alias_quotes = True
|
||||
max_column_name_length = 30
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
allows_cte_in_subquery = False
|
||||
# Ocient does not support cte names starting with underscores
|
||||
cte_alias = "cte__"
|
||||
|
||||
@@ -28,7 +28,7 @@ class SolrEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
|
||||
time_groupby_inline = False
|
||||
allows_joins = False
|
||||
allows_subqueries = False
|
||||
rls_method = RLSMethod.AS_PREDICATE
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
metadata = {
|
||||
"description": "Apache Solr is an open-source enterprise search platform.",
|
||||
|
||||
@@ -22,6 +22,7 @@ from urllib import parse
|
||||
from sqlalchemy.engine.url import make_url, URL # noqa: F401
|
||||
|
||||
from superset.db_engine_specs.base import BaseEngineSpec, DatabaseCategory
|
||||
from superset.sql.parse import RLSMethod
|
||||
|
||||
|
||||
class TDengineEngineSpec(BaseEngineSpec):
|
||||
@@ -29,6 +30,8 @@ class TDengineEngineSpec(BaseEngineSpec):
|
||||
engine_name = "TDengine"
|
||||
max_column_name_length = 64
|
||||
default_driver = "taosws"
|
||||
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
sqlalchemy_uri_placeholder = (
|
||||
"taosws://user:******@host:port/dbname[?key=value&key=value...]"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user