superset icon indicating copy to clipboard operation
superset copied to clipboard

fix: Allow clickhouse dbs with timestamps to visualize queries

Open hughhhh opened this issue 2 years ago • 2 comments

SUMMARY

Clickhouse queries would fail with timestamps since we duck typing the columns types. This PR fixes this issue, but currently looking into a more robust solution for standardizing columns in side this ExploreMixin

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen Shot 2022-09-12 at 3 09 16 PM

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • [ ] Has associated issue:
  • [ ] 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

hughhhh avatar Sep 12 '22 22:09 hughhhh

Codecov Report

Merging #21446 (75dc403) into master (18ec294) will decrease coverage by 0.00%. The diff coverage is 0.00%.

:exclamation: Current head 75dc403 differs from pull request most recent head 19a0688. Consider uploading reports for the commit 19a0688 to get more accurate results

@@            Coverage Diff             @@
##           master   #21446      +/-   ##
==========================================
- Coverage   66.71%   66.70%   -0.01%     
==========================================
  Files        1796     1796              
  Lines       68716    68720       +4     
  Branches     7313     7313              
==========================================
  Hits        45843    45843              
- Misses      21011    21015       +4     
  Partials     1862     1862              
Flag Coverage Δ
hive 52.90% <0.00%> (-0.01%) :arrow_down:
mysql 78.20% <0.00%> (-0.01%) :arrow_down:
postgres 78.27% <0.00%> (-0.01%) :arrow_down:
presto 52.80% <0.00%> (-0.01%) :arrow_down:
python 81.39% <0.00%> (-0.01%) :arrow_down:
sqlite 76.76% <0.00%> (-0.01%) :arrow_down:
unit 50.91% <0.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/models/helpers.py 39.04% <0.00%> (-0.18%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Sep 12 '22 22:09 codecov[bot]

@hughhhh Could you post both SQL that changes before and after? Thanks!

zhaoyongjie avatar Sep 19 '22 07:09 zhaoyongjie

/testenv up

jinghua-qa avatar Sep 26 '22 16:09 jinghua-qa

@jinghua-qa Ephemeral environment spinning up at http://34.220.56.32:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Sep 26 '22 20:09 github-actions[bot]

Tested in preset workspace, able to see date column in chart-power query in explore. LGTM

jinghua-qa avatar Sep 28 '22 00:09 jinghua-qa

Is the problem that the Clickhouse driver is returning columns that are dictionaries instead of ColumnTable objects? If so you can override the get_columns method of the Clickhouse DB engine spec to return and object instead of a dict.

betodealmeida avatar Sep 28 '22 22:09 betodealmeida

@betodealmeida the implementation for columns in the Query model returns dict I'm working on another PR to standardize this for all Query.columns object in another PR that i'm currently working on. This is a patch to unblock people using clickhouse and want to explore using Query

hughhhh avatar Sep 28 '22 23:09 hughhhh

/testenv up

yousoph avatar Sep 30 '22 17:09 yousoph

@yousoph Ephemeral environment creation failed. Please check the Actions logs for details.

github-actions[bot] avatar Sep 30 '22 17:09 github-actions[bot]

/testenv up

yousoph avatar Sep 30 '22 17:09 yousoph

@yousoph Ephemeral environment spinning up at http://35.90.3.173:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Sep 30 '22 17:09 github-actions[bot]

Ephemeral environment shutdown and build artifacts deleted.

github-actions[bot] avatar Oct 03 '22 18:10 github-actions[bot]

🏷️ preset:2022.39

sadpandajoe avatar Oct 03 '22 18:10 sadpandajoe