dosubot[bot] commented on issue #32429:
URL: https://github.com/apache/superset/issues/32429#issuecomment-2691197118
<!-- Greeting -->
Hey @scriptbotprime! I'm here to help you with any bugs, questions, or
contributions. Let's tackle this together!
<!-- Answer -->
To resolve the issue in Superset 4.1.1 where updating a dataset query
connected to Trino DB results in the error "Error 400 Bad Request: Schema is
set but catalog is not," you need to ensure that both the catalog and schema
are specified in the connection URL. The error indicates that a schema is
provided without a corresponding catalog, which is required by Trino.
The `adjust_engine_params` method in the `TrinoEngineSpec` class handles
this by adjusting the engine parameters to include both catalog and schema if
they are not fully qualified in the URL. Here is how you can adjust the
connection URL:
```python
from sqlalchemy.engine.url import make_url
from superset.db_engine_specs.trino import TrinoEngineSpec
# Example URL with only schema set
url = make_url("trino://user:pass@localhost:8080/system")
# Adjust the URL to include both catalog and schema
uri = TrinoEngineSpec.adjust_engine_params(
url,
{},
catalog="your_catalog", # Set your catalog here
schema="your_schema", # Set your schema here
)[0]
print(str(uri)) # This should print the adjusted URL with both catalog and
schema
```
Ensure that your connection URL in Superset is correctly configured to
include both the catalog and schema. If you are setting these values
dynamically, make sure they are passed correctly to the `adjust_engine_params`
function
<sup>[[1]](https://github.com/apache/superset/blob/master/tests/unit_tests/db_engine_specs/test_trino.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/41f74285-8a3f-405b-835d-2a11d5acf270?feedback_type=other)</sup>
--
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]