betodealmeida commented on issue #22862:
URL: https://github.com/apache/superset/issues/22862#issuecomment-1468432746
Actually, we would need the `apply_catalog_to_sqlalchemy_uri` to also pass
`schema`:
```python
@classmethod
def apply_catalog_to_sqlalchemy_uri(
cls,
database: Database,
catalog: Optional[str],
schema: Optional[str],
) -> URL:
return database.sqlalchemy_uri
```
For Postgres, this would look like this (untested):
```python
@classmethod
def apply_catalog_to_sqlalchemy_uri(
cls,
database: Database,
catalog: Optional[str],
schema: Optional[str],
) -> Tuple[URL, Dict[str, Any]]:
url = database.sqlalchemy_uri
try:
connect_args =
database.get_extra()["engine_params"]["connect_args"]
except KeyError:
connect_args = {}
if catalog:
# for Postgres a catalog is a database
url = url.set(database=catalog)
if schema:
connect_args = {"options": f"-csearch_path={schema}"}
return url, connect_args
```
See the discussion at https://github.com/apache/superset/pull/23356.
--
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]