visualize raw output of SQL Lab query in superset


I run a simple query in SQL Lab and get the following output

SELECT timestamp, nav from account_info

enter image description here

I would like to visualize this "raw" output simply as a timeseries line chart.

However, when I click the visualize button, the only options I have are to perform some aggregation (counting, summing, avging, etc.).

I do not want to aggregate, I simply want to visualize the output of the sql query. Is there a way to do this?

Asked By: evariste galois



I believe an aggregation is indeed typically – if not always – required.

That being said, the workaround is to do a meaningless aggregation:
In your case, after clicking Visualize, check both timestamp and nav as is_dimension, check timestamp as is_date, and define agg_func as MIN(x) for nav.

Click Visualize, select Visualization Type as Time Series - Line Chart, set Metrics as min__nav and remove the Group By.

Query and you should get what I think you’re looking for.

Answered By: David Tobiano

When working with time series related visualization you will need to set up a default DATETIME field from your database table before processing.
To add main DATETIME column in superset you simply go to

Sources->tables->edit table    

then set a default DATETIME column from your table.
For this you do not need to write a SQL query. Just choose the columns you want the visualization on in the table while creating slice.You can also choose time column and grain of time.

Answered By: Sushant