codeant-ai-for-open-source[bot] commented on code in PR #44279:
URL: https://github.com/apache/superset/pull/44279#discussion_r4210882860
##########
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 `2043403`.
Added `unknown = EXCLUDE` to `DruidParametersSchema.Meta`, so returned
`database` values are ignored during schema 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]