Skip to content

Jinja dataset macro doesn't work for Oracle databases #30700

Open
@kron82

Description

@kron82

Bug description

The error is that the Jinja macro "Dataset" is replaced by a subquery using an alias with the keyword "as" in the "from" clause. In SQL syntax, the keyword "as" is optional in the "from" clause and Oracle DB does not support it at all. This leads to the inability to use the "Dataset" macro with Oracle DB.
Steps to reproduce:

  1. Create a SQL query and set Oracle DB as the source database in SQLLab.
  2. Set the SQL text "select * from dual"
  3. Save this query as a dataset with the name "DUAL"
  4. Find the dataset_id of the created dataset (in URL for example)
  5. Create and execute a new query with the text "select * from {{dataset(X)}}", where X should be replaced with the dataset_id from step 4.

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

Not applicable

Node version

Not applicable

Browser

Not applicable

Additional context

  1. Set feature flag ENABLE_TEMPLATE_PROCESSING to True
  2. Use any Oracle Database for queries.
    log.txt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions