korbit-ai[bot] commented on code in PR #32506:
URL: https://github.com/apache/superset/pull/32506#discussion_r1980415307


##########
superset/db_engine_specs/postgres.py:
##########
@@ -411,7 +411,9 @@ def get_table_names(
         )
 
     @staticmethod
-    def get_extra_params(database: Database) -> dict[str, Any]:
+    def get_extra_params(
+        database: Database, source: QuerySource | None = None
+    ) -> dict[str, Any]:

Review Comment:
   ### Unused QuerySource Parameter <sub>![category 
Design](https://img.shields.io/badge/Design-0d9488)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The new `source` parameter in `get_extra_params` is added but never used in 
the method implementation.
   
   ###### Why this matters
   Unused parameters can lead to confusion about the method's functionality and 
expected behavior, especially since the intent was to make user agents 
customizable based on the query source.
   
   ###### Suggested change ∙ *Feature Preview*
   Either utilize the `source` parameter to customize the user agent in the 
returned extra params, or remove it if not needed. Example implementation:
   ```python
   @staticmethod
   def get_extra_params(
       database: Database, source: QuerySource | None = None
   ) -> dict[str, Any]:
       try:
           extra = json.loads(database.extra or "{}")
       except json.JSONDecodeError as ex:
           raise SupersetException("Unable to parse database extras") from ex
   
       if database.server_cert:
           engine_params = extra.get("engine_params", {})
           connect_args = engine_params.get("connect_args", {})
           connect_args["sslmode"] = connect_args.get("sslmode", "verify-full")
           path = utils.create_ssl_cert_file(database.server_cert)
           connect_args["sslrootcert"] = path
           
           # Customize user agent based on source
           if source:
               connect_args["application_name"] = 
f"superset_{source.name.lower()}"
               
           engine_params["connect_args"] = connect_args
           extra["engine_params"] = engine_params
       return extra
   ```
   
   
   </details>
   
   <sub>
   
   [![Report a problem with this 
comment](https://img.shields.io/badge/Report%20a%20problem%20with%20this%20comment-gray.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmNWVjMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10cmlhbmdsZS1hbGVydCI+PHBhdGggZD0ibTIxLjczIDE4LTgtMTRhMiAyIDAgMCAwLTMuNDggMGwtOCAxNEEyIDIgMCAwIDAgNCAyMWgxNmEyIDIgMCAwIDAgMS43My0zIi8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4=)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/76364535-4fa9-4d68-8731-040896b014a2?suggestedFixEnabled=true)
   
   💬 Chat with Korbit by mentioning @korbit-ai.
   </sub>
   
   <!--- korbi internal id:c2064ca7-8fc0-48fe-b173-7b2b914b23a1 -->
   



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

To unsubscribe, e-mail: [email protected]

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