codeant-ai-for-open-source[bot] commented on code in PR #44279:
URL: https://github.com/apache/superset/pull/44279#discussion_r4171051353
##########
superset/db_engine_specs/druid.py:
##########
@@ -162,6 +212,44 @@ def alter_new_orm_column(cls, orm_col: TableColumn) ->
None:
if orm_col.column_name == "__time":
orm_col.is_dttm = True
+ @classmethod
+ def build_sqlalchemy_uri(
+ cls,
+ parameters: BasicParametersType,
+ encrypted_extra: dict[str, str] | None = None,
+ ) -> str:
+ query = parameters.get("query", {}).copy()
+ # `druid+https` selects pydruid's TLS dialect; the bare `druid` driver
+ # connects over plain HTTP.
+ driver = "https" if parameters.get("encryption") else
cls.default_driver
+
+ # SQLAlchemy 2.0 hides the password from `URL.__str__()`, so render it
+ # explicitly since this URI is used to connect, not just displayed.
+ return URL.create(
+ f"{cls.engine}+{driver}".rstrip("+"),
+ username=parameters.get("username"),
+ password=parameters.get("password"),
+ host=parameters["host"],
+ port=parameters["port"],
+ database=cls.sqlalchemy_uri_database,
+ query=query,
+ ).render_as_string(hide_password=False)
+
+ @classmethod
+ def get_parameters_from_uri(
+ cls, uri: str, encrypted_extra: dict[str, Any] | None = None
+ ) -> BasicParametersType:
+ url = make_url_safe(uri)
+ return BasicParametersType(
+ username=url.username,
+ password=url.password,
+ host=url.host,
+ port=url.port,
+ database=url.database or cls.sqlalchemy_uri_database,
+ query=dict(url.query),
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `c08094a`.
Added Marshmallow Meta configuration with `unknown = EXCLUDE`, allowing the
`database` value returned from URI parsing to be ignored during dynamic-form
validation.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
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]