Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset loses catalog when updating query #32429

Open
3 tasks done
scriptbotprime opened this issue Feb 28, 2025 · 5 comments
Open
3 tasks done

Dataset loses catalog when updating query #32429

scriptbotprime opened this issue Feb 28, 2025 · 5 comments
Assignees
Labels
data:connect:trino Related to Trino validation:required A committer should validate the issue

Comments

@scriptbotprime
Copy link

Bug description

In Superset 4.1.1 I have a problems when updating the query of a dataset which is connected to Trino DB.
After the update the connected chart gives me this error message:
Error: error 400: b'Error 400 Bad Request: Schema is set but catalog is not'

When going back to the editing window I can see that the catalog and schema is missing:
Image

My workaround is to update the catalog in the superset database:

UPDATE tables SET catalog = 'clickhouse' WHERE table_name = 'test_template';

This fixes the schema as well. Maybe because it is the only schema in this catalog.

Screenshots/recordings

No response

Superset version

4.1.1

Python version

I don't know

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented Feb 28, 2025

Hey @scriptbotprime! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

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:

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 [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot dosubot bot added the data:connect:trino Related to Trino label Feb 28, 2025
@rusackas
Copy link
Member

Can you check master or the 5.0.0 release candidate to see if it happens there? We have a hunch this might be resolved already, but I'll ping @betodealmeida and @sadpandajoe in case they have interest in validating/fixing.

@rusackas rusackas added validation:required A committer should validate the issue review:checkpoint Last PR reviewed during the daily review standup labels Feb 28, 2025
@annikovk
Copy link

annikovk commented Mar 3, 2025

Same here (Schema is set but catalog is not) while changing the calculated column of a dataset.
All the dashboards with this dataset start showing "Unexpected error"
Is there a workaround for the versions <5.0.0? I can hardly imagine my company updating BI to a pre-release version.

@rusackas rusackas removed the review:checkpoint Last PR reviewed during the daily review standup label Mar 3, 2025
@betodealmeida
Copy link
Member

I'll take a look! Thanks for the report!

@scriptbotprime
Copy link
Author

scriptbotprime commented Mar 4, 2025

Can you check master or the 5.0.0 release candidate to see if it happens there? We have a hunch this might be resolved already, but I'll ping @betodealmeida and @sadpandajoe in case they have interest in validating/fixing.

I used the docker image: apache/superset:15cf066, created another dataset, created a chart on top of it and then changed the dataset. The catalog information was lost again. The error message is different and less informative:

Network Error: Check your network connection

Image

P.S.
I pip installed pillow because the container log was complaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:connect:trino Related to Trino validation:required A committer should validate the issue
Projects
None yet
Development

No branches or pull requests

4 participants