Skip to content

fix(sqllab):clickhouse result no column header#20325

Closed
wengieeee wants to merge 1 commit intoapache:masterfrom
wengieeee:fix/clickhouse-data-no-column-name
Closed

fix(sqllab):clickhouse result no column header#20325
wengieeee wants to merge 1 commit intoapache:masterfrom
wengieeee:fix/clickhouse-data-no-column-name

Conversation

@wengieeee
Copy link

@wengieeee wengieeee commented Jun 9, 2022

SUMMARY

version : superset 1.5.0
python : 3.8
connect db:clickhouse + http(8123)

if you run any clickhouse sql with "format" keyword, returned results have no column headers,the first row of results will be the column header。

image

In this case, if the first column has a null value, an error will be thrown directly。

After troubleshooting, the problem lies in the referenced package clickhouse_sqlalchemy/drivers/http/connector.py:112
image

Therefore, the SQL with format keyword needs to add format parameters “FORMAT TabSeparatedWithNamesAndTypes” manually

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before
image

after
image

TESTING INSTRUCTIONS

1、run any clickhouse sql with "format" keyword. like
select subtractDays(toDateTime(formatDateTime(now(),'%Y-%m-%d 00:00:00')),2) as t

ADDITIONAL INFORMATION

  • Has associated issue:
    Fixes Python Issue leaks to SQL Lab when querying Clickhouse #19253
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@save-my-heart
Copy link

I think it is not necessary to rewrite query in superset. Instead, fix it in clickhouse_sqlalchemy.
See: xzkostyan/clickhouse-sqlalchemy#180

@phpsxg
Copy link

phpsxg commented Jul 9, 2022

Why clickhouse result no column header when using formatDateTime function,Thanks~
abc
bcd

@villebro
Copy link
Member

Superseded by #21195, closing

@villebro villebro closed this Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python Issue leaks to SQL Lab when querying Clickhouse

4 participants