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

It is impossible to select table without selecting schema in "New Dataset" view. #31022

Open
3 tasks done
vgvoleg opened this issue Nov 21, 2024 · 2 comments
Open
3 tasks done
Assignees
Labels
data:dataset Related to dataset configurations

Comments

@vgvoleg
Copy link

vgvoleg commented Nov 21, 2024

Bug description

Hello everyone. I'm working on a new db_engine_spec and I've found it very difficult.
Dialect I'm trying to integrate with Superset does not support schemas. AFAIK it is not a "rare" scenario - but it is impossible to create physical dataset using table without selecting some schema (only virtual datasets based on queries are available).
What can I do to bypass this issue? If there is a good and easy hack - I'd like to use it!

It would be nice if db_engine_spec would have supports_schemas = True field that we could override in our custom spec. SQLAlchemy have this field already https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4/lib/sqlalchemy/engine/default.py#L72, so probably you can rely on it.

Screenshots/recordings

image

Superset version

master / latest-dev

Python version

3.9

Node version

16

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.
@dosubot dosubot bot added the data:dataset Related to dataset configurations label Nov 21, 2024
Copy link

dosubot bot commented Nov 21, 2024

Hello @vgvoleg! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's tackle this issue together!

To address the issue of creating a dataset without selecting a schema in Superset, you can consider the following approach:

  1. Custom DB Engine Spec: You can create a custom db_engine_spec for your database engine. In this custom spec, you can override methods to handle the absence of schemas. While Superset does not currently have a supports_schemas attribute in its db_engine_spec, you can implement logic in your custom spec to bypass schema requirements.

  2. Adjust Engine Parameters: Use the adjust_engine_params method in your custom db_engine_spec to modify the SQLAlchemy URI and connection arguments. This can help ensure that queries run correctly without requiring a schema.

  3. Modify Frontend Logic: If you have control over the frontend, you might consider modifying the logic in the DatabaseSelector component to handle cases where schemas are not applicable. This could involve conditionally rendering the schema selection UI based on the database engine's capabilities.

  4. SQLAlchemy's supports_schemas: Although Superset does not directly use SQLAlchemy's supports_schemas attribute, you can leverage this attribute in your custom spec to determine whether to enforce schema selection.

These steps should help you integrate a database engine that does not support schemas into Superset. If you need further customization, you might need to dive deeper into the Superset codebase to adjust how datasets are created and managed.

To continue talking to Dosu, mention @dosu.

@vgvoleg
Copy link
Author

vgvoleg commented Nov 21, 2024

More details were discussed in this thread: https://apache-superset.slack.com/archives/C014LS99C1K/p1732111768591139

@betodealmeida betodealmeida self-assigned this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:dataset Related to dataset configurations
Projects
None yet
Development

No branches or pull requests

2 participants