Easy Chart Database pens error: t_stamp is not a date


I’m getting an error when trying to create a database pen on the Easy Chart directly from one of the standard tag history tables (sqlt_data_x_yyyy_mm). How should I be doing this when using the database pens with unix epoch timestamps?



You’ll need to create a view of each sqlt table that has the milliseconds UTC converted into a proper timestamptz or similar.

I’m just curious, any particular reason you’re using a DB pen instead of a Tag Pen?

Also, it’s a bit wonky, but any of those DB fields you can add additional query logic and it will execute. You could type into the Time Column field (I’m using MySQL syntax):

FROM_UNIXTIME(t_stamp / 1000)

Note: If I remember correctly, t_stamp typically has an index defined on it. So if it’s a really large table, this will likely kill performance due to the query optimizer not being able to utilize the index.

It was more as a test. I was testing using the tag history splitter for a local and remote database, where local is short-term storage and remote is long-term, and testing the query cutoff point. It wasn’t working so I wanted to query the tables directly (could have just used a table as well or the individual history providers). I was more curious if I was actually able to use the epoch t_stamp field more than anything when I ran into the issue. Bit sad that I can’t nicely :frowning: