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



##########
File path: superset/db_engine_specs/bigquery.py
##########
@@ -282,3 +302,47 @@ def df_to_sql(
                 to_gbq_kwargs[key] = to_sql_kwargs[key]
 
         pandas_gbq.to_gbq(df, **to_gbq_kwargs)
+
+    @classmethod
+    def build_sqlalchemy_uri(
+        cls, _: BigQueryParametersType, encrypted_extra: Optional[Dict[str, 
str]] = None
+    ) -> str:
+        if encrypted_extra:
+            project_id = encrypted_extra.get("project_id")
+            return f"{cls.drivername}://{project_id}"
+
+        raise SupersetGenericDBErrorException(
+            message="Big Query encrypted_extra is not available",

Review comment:
       Nit, end error messages with a period:
   ```suggestion
               message="Big Query encrypted_extra is not available.",
   ```

##########
File path: superset/db_engine_specs/bigquery.py
##########
@@ -282,3 +302,47 @@ def df_to_sql(
                 to_gbq_kwargs[key] = to_sql_kwargs[key]
 
         pandas_gbq.to_gbq(df, **to_gbq_kwargs)
+
+    @classmethod
+    def build_sqlalchemy_uri(
+        cls, _: BigQueryParametersType, encrypted_extra: Optional[Dict[str, 
str]] = None
+    ) -> str:
+        if encrypted_extra:
+            project_id = encrypted_extra.get("project_id")
+            return f"{cls.drivername}://{project_id}"
+
+        raise SupersetGenericDBErrorException(
+            message="Big Query encrypted_extra is not available",
+        )
+
+    @classmethod
+    def get_parameters_from_uri(
+        cls, _: str, encrypted_extra: Optional[Dict[str, str]] = None
+    ) -> Any:
+        # BigQuery doesn't have parameters
+        if encrypted_extra:
+            return encrypted_extra
+
+        raise SupersetGenericDBErrorException(
+            message="Big Query encrypted_extra is not available",

Review comment:
       ```suggestion
               message="Big Query encrypted_extra is not available.",
   ```

##########
File path: superset/db_engine_specs/bigquery.py
##########
@@ -38,6 +44,16 @@
     + "permission in project (?P<project>.+?)"
 )
 
+ma_plugin = MarshmallowPlugin()
+
+
+class BigQueryParametersSchema(Schema):
+    credentials_info = EncryptedField(description="credentials.json file for 
BigQuery")

Review comment:
       ```suggestion
       credentials_info = EncryptedField(
           description="Contents of BigQuery JSON credentials.",
       )
   ```

##########
File path: superset/databases/api.py
##########
@@ -909,11 +908,15 @@ def available(self) -> Response:
                 "preferred": engine_spec.engine in preferred_databases,
             }
 
-            if issubclass(engine_spec, BasicParametersMixin):
-                payload["parameters"] = engine_spec.parameters_json_schema()
+            if hasattr(engine_spec, "parameters_json_schema") or hasattr(

Review comment:
       Just realized this needs to be `and`, otherwise we might get an 
`AttributeError`:
   
   ```suggestion
               if hasattr(engine_spec, "parameters_json_schema") and hasattr(
   ```




-- 
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