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

"Custom SQL fields cannot contain sub-queries" when using certain SQL keywords in columns #25072

Closed
2 of 3 tasks
fmannhardt opened this issue Aug 24, 2023 · 3 comments
Closed
2 of 3 tasks

Comments

@fmannhardt
Copy link
Contributor

fmannhardt commented Aug 24, 2023

When using the table chart and adding a derived column by using "Custom SQL" and using certain syntax that uses keywords that may be mistaken for a subquery I am unable to use the custom SQL.

How to reproduce the bug

  1. Add any PostgreSQL datasource with a INTERVAL column (duration)
  2. Add a table chart
  3. Add a column with Customer SQL option and the following query:
    extract(epoch FROM duration) * 1000
  4. See error:
    afbeelding

Expected results

The column should have been calculated since there is no subquery involved.

Actual results

See step 3.

Environment

(please complete the following information):

  • browser type and version: Firefox 116.0.3
  • superset version: 2.1.0
  • python version: 3.8.16
  • any feature flags active:
FEATURE_FLAGS = {
    "EMBEDDED_SUPERSET": True,
    "DASHBOARD_NATIVE_FILTERS": True,
    "DYNAMIC_PLUGINS": True,
    "DASHBOARD_CROSS_FILTERS": True,
    "THUMBNAILS": False,
    "DRILL_TO_DETAIL": False,
    "VERSIONED_EXPORT": True,
    "ENABLE_TEMPLATE_PROCESSING": True,
    "DASHBOARD_RBAC": True,
    "GENERIC_CHART_AXES": True
}

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
    (according to the 2.1.1 changelog this has not been fixed)
  • I have checked the issue tracker for the same issue and I haven't found one similar.
@michael-s-molina
Copy link
Member

Does the ALLOW_ADHOC_SUBQUERY feature flag resolves your issue?

@iercan
Copy link
Contributor

iercan commented Sep 1, 2023

Does the ALLOW_ADHOC_SUBQUERY feature flag resolves your issue?

This is solved issue for me. I was getting this error for druid connection.

@michael-s-molina
Copy link
Member

Closing this issue as the feature flag seems to resolve it. @fmannhardt feel free to reopen the issue if that's not the case. I authored #25161 to include a note in UPDATING.md about the feature flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants