Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow Superset to recognize that a string is a datetime?

I am using Superset as a data visualizer with an SQLite database. Because SQLite doesn't have DATETIME type, I use the type TEXT to add a date and an hour.

Nevertheless, Superset then doesn't recognize that this "TEXT" or String is a date !

This is my data :

CREATE TABLE TEST(
    TEST_ID int PRIMARY KEY NOT NULL,
    VEHICLE_ID int NULL,
    TEST_TYPE_ID int NULL,
    CHECK_TYPE_ID int NULL,
    NUM_TEST int NULL,
    TEST_DATE TEXT NOT NULL
);

INSERT INTO TEST (TEST_ID, VEHICLE_ID, TEST_TYPE_ID, CHECK_TYPE_ID, NUM_TEST, TEST_DATE) VALUES (844, 504, 3, 1, 3, '2007-01-01 10:00:00');

Then in Superset I have the following message :

"Datetime column not provided as part table configuration and is required by this type of chart"

With the details :

  Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/superset/viz.py", line 234, in get_payload
    df = self.get_df()
  File "/usr/lib/python2.7/site-packages/superset/viz.py", line 78, in get_df
    self.results = self.datasource.query(query_obj)
  File "/usr/lib/python2.7/site-packages/superset/connectors/sqla/models.py", line 538, in query
    qry = self.get_sqla_query(**query_obj)
  File "/usr/lib/python2.7/site-packages/superset/connectors/sqla/models.py", line 370, in get_sqla_query
    "Datetime column not provided as part table configuration "
Exception: Datetime column not provided as part table configuration and is required by this type of chart

I tried to replace TEXT by TEXT AS DATETIME creating the table but it's a syntax error.

Do you have any solution ?

like image 525
LaPalme Avatar asked Apr 25 '17 08:04

LaPalme


1 Answers

There is a setting in the Datasource editor. On the Columns tab, change the Is Temporal flag to checked (true)

like image 179
Damon Cool C Avatar answered Sep 27 '22 19:09

Damon Cool C