guenp commented on code in PR #27908: URL: https://github.com/apache/superset/pull/27908#discussion_r1558239950
########## superset/db_engine_specs/duckdb.py: ########## @@ -38,9 +45,208 @@ COLUMN_DOES_NOT_EXIST_REGEX = re.compile("no such column: (?P<column_name>.+)") -class DuckDBEngineSpec(BaseEngineSpec): +class DuckDBURI( + util.namedtuple( # type: ignore + "DuckDBURI", + [ + "password", + "database", + "motherduck_token", + "query", + ], + ) +): + drivername = "duckdb" + + def __str__(self) -> str: + query = "" + if self.motherduck_token: + query += f"?motherduck_token={self.motherduck_token}" + else: + query += "?" + query += "&".join([f"{key}={value}" for key, value in self.query.items()]) + return f"{DuckDBEngineSpec.engine}:///{self.database}{query}" + + @classmethod + def from_str(cls, name: str) -> DuckDBURI: + pattern = re.compile( Review Comment: I'm also not sure if we need this function, let me try to refactor this. -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org