Skip to content

Problem creating "AS" for string name with spaces. #33557

Open
@OlegEgoism

Description

@OlegEgoism

Bug description

I am using version 4.1.2.
I encountered an issue!

In SQL Lab, I write the query:
SELECT
TO_DATE('01.' || on_period, 'DD.MM.YYYY') AS "Дата отчетного периода",
CASE
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '01' THEN 'Январь'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '02' THEN 'Февраль'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '03' THEN 'Март'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '04' THEN 'Апрель'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '05' THEN 'Май'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '06' THEN 'Июнь'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '07' THEN 'Июль'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '08' THEN 'Август'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '09' THEN 'Сентябрь'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '10' THEN 'Октябрь'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '11' THEN 'Ноябрь'
WHEN SUBSTRING(on_period FROM 1 FOR 2) = '12' THEN 'Декабрь'
END AS "Месяц",
SUBSTRING(on_period FROM 4 FOR 4) AS "Год",
revocable_deposits AS "Отзывные поля 1",
irrevocable_deposits_1_6 AS "Безотзывные поля 1",
credits_legal AS "Новые поля 2",
credits_individuals AS "Старые поля 2"
FROM dd11_rvsr.dd11405_dinamica_rvsr;

The query is executed, the database returns the data. I execute "Save or Overwrite Dataset"
Image

After switching to "Chart Source" I get the error -
"Unexpected error
Custom SQL fields cannot contain subqueries"
Image
Image

I noticed that there is a problem when adding "AS" in a column that has text with multiple spaces..
How to fix this problem?

Screenshots/recordings

No response

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sqllabNamespace | Anything related to the SQL Lab

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions