From 2b84d6a2ea77f0c68ae4896ddc5e0dfc2b9d3899 Mon Sep 17 00:00:00 2001 From: hughhhh Date: Fri, 28 Apr 2023 14:57:25 -0500 Subject: [PATCH] rm get_schema_from_engine_params from base class --- superset/db_engine_specs/postgres.py | 34 ---------------------------- 1 file changed, 34 deletions(-) diff --git a/superset/db_engine_specs/postgres.py b/superset/db_engine_specs/postgres.py index 4c71bfe59fa9c..e809187af66a9 100644 --- a/superset/db_engine_specs/postgres.py +++ b/superset/db_engine_specs/postgres.py @@ -166,40 +166,6 @@ class PostgresBaseEngineSpec(BaseEngineSpec): ), } - @classmethod - def get_schema_from_engine_params( - cls, - sqlalchemy_uri: URL, - connect_args: Dict[str, Any], - ) -> Optional[str]: - """ - Return the configured schema. - - While Postgres doesn't support connecting directly to a given schema, it allows - users to specify a "search path" that is used to resolve non-qualified table - names; this can be specified in the database ``connect_args``. - - One important detail is that the search path can be a comma separated list of - schemas. While this is supported by the SQLAlchemy dialect, it shouldn't be used - in Superset because it breaks schema-level permissions, since it's impossible - to determine the schema for a non-qualified table in a query. In cases like - that we raise an exception. - """ - options = re.split(r"-c\s?", connect_args.get("options", "")) - for option in options: - if "=" not in option: - continue - key, value = option.strip().split("=", 1) - if key.strip() == "search_path": - if "," in value: - raise Exception( - "Multiple schemas are configured in the search path, which means " - "Superset is unable to determine the schema of unqualified table " - "names and enforce permissions." - ) - return value.strip() - return None - @classmethod def fetch_data( cls, cursor: Any, limit: Optional[int] = None