betodealmeida commented on a change in pull request #14653:
URL: https://github.com/apache/superset/pull/14653#discussion_r634571418



##########
File path: superset/db_engine_specs/base.py
##########
@@ -1292,6 +1303,36 @@ def get_column_spec(
             )
         return None
 
+    """
+    Abstract classmethods to allow us to write custom parameters
+    functions for specific db engines
+    """
+
+    @classmethod
+    def build_sqlalchemy_url(cls, parameters: Any) -> str:
+        raise NotImplementedError("build_sqlalchemy_url is not implemented")

Review comment:
       This was renamed to `build_sqlalchemy_uri`: 
https://github.com/apache/superset/blob/3a81e6aee8a081dd2c422e451733781d92cf11f4/superset/databases/commands/validate.py#L85
   
   ```suggestion
       def build_sqlalchemy_uri(cls, parameters: Any) -> str:
           raise NotImplementedError("build_sqlalchemy_uri is not implemented")
   ```

##########
File path: superset/db_engine_specs/base.py
##########
@@ -291,6 +291,17 @@ class BaseEngineSpec:  # pylint: 
disable=too-many-public-methods
         Pattern[str], Tuple[str, SupersetErrorType, Dict[str, Any]]
     ] = {}
 
+    # schema describing the parameters used to configure the DB
+    parameters_schema: Schema = None

Review comment:
       ```suggestion
       parameters_schema: Optional[Schema] = None
   ```

##########
File path: superset/models/core.py
##########
@@ -236,6 +237,17 @@ def backend(self) -> str:
         sqlalchemy_url = make_url(self.sqlalchemy_uri_decrypted)
         return sqlalchemy_url.get_backend_name()  # pylint: disable=no-member
 
+    @property
+    def parameters(self) -> Optional[Dict[str, Any]]:

Review comment:
       ```suggestion
       def parameters(self) -> Dict[str, Any]:
   ```

##########
File path: superset/db_engine_specs/base.py
##########
@@ -1353,8 +1364,8 @@ def build_sqlalchemy_uri(cls, parameters: 
BasicParametersType) -> str:
             )
         )
 
-    @staticmethod
-    def get_parameters_from_uri(uri: str) -> BasicParametersType:
+    @classmethod
+    def get_parameters_from_uri(cls, uri: str) -> BasicParametersType:

Review comment:
       ```suggestion
       def get_parameters_from_uri(cls, uri: str) -> 
Optional[BasicParametersType]:
   ```

##########
File path: superset/db_engine_specs/base.py
##########
@@ -140,7 +140,7 @@ class LimitMethod:  # pylint: disable=too-few-public-methods
     FORCE_LIMIT = "force_limit"
 
 
-class BaseEngineSpec:  # pylint: disable=too-many-public-methods
+class BaseEngineSpec:  # pylint: disable=too-many-public-methods, 
abstract-method

Review comment:
       This can go, right?
   
   ```suggestion
   class BaseEngineSpec:  # pylint: disable=too-many-public-methods
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to