fr-ser / grafana-sqlite-datasource

Grafana Plugin to enable SQLite as a Datasource
Apache License 2.0
123 stars 17 forks source link

Can not convert to wide series, expected long format series input but got not series #105

Closed mammuthus closed 1 year ago

mammuthus commented 1 year ago

Describe the bug Getting an error: "can not convert to wide series, expected long format series input but got not series", while settings seems to be valid. No error description was found.

Dataset:

timestamp|message
2023-02-23 09:26:59|115
2023-01-28 10:22:07|113
2023-01-05 23:38:38|113.5
2022-11-11 09:33:43|112
2022-10-05 11:03:23|112.3
2022-09-17 10:27:43|112.6

Query:

SELECT
timestamp,
message as value

FROM messages
ORDER BY timestamp

To Reproduce Steps to reproduce the behavior:

  1. Make a new time-series widget using my query with my dataset
  2. Receive an error

Screenshots image image

Versions (please complete the following information):

fr-ser commented 1 year ago

"2023-02-23 09:26:59" does not seem like a particularly ISO compliant string format (more info about time formats here).

Can you try to make sure that the timestamp is actually recognized as such correctly?

For example. Could you run the same query against unix timestamps (integer numbers) and see what you get?

mammuthus commented 1 year ago

You mean like image ?

fr-ser commented 1 year ago

I am not sure if having multiple values for a single timestamp is a problem.

I will take a look in a bit. 👌

mammuthus commented 1 year ago

By the way, I converted the timestamp to Unix Epoch, so it should be native for the plugin now, and the result is the same

New dataset: image

Result: image

mammuthus commented 1 year ago

@fr-ser LMAO, I'm dumb. message was a string, so obviously it won't work until I convert it to numeric.

SELECT timestamp as time, CAST(message AS INTEGER) as value
FROM messages 
ORDER BY timestamp ASC

Thank you for your time.

fr-ser commented 1 year ago

Let me reopen the issue so I will remember to take a look later if the error message can be improved

DhanushDK17 commented 1 year ago

What should be the timestamp's datatype in the table schema? I'm trying to visualize something similar but the data in the timestamp column disappears as soon as I add that column as a time formatted column.

image
fr-ser commented 1 year ago

@DhanushDK17 you can have a look at this section: https://github.com/fr-ser/grafana-sqlite-datasource#support-for-time-formatted-columns

If that does not answer the question please open a new issue and we can have a look

fr-ser commented 1 year ago

It is tricky to improve the error message without analyzing the data frame in depth. Currently, I make use of the standard Grafana method to check the validity of the series.

Unless there are more problems with similar issues in the future I'll leave it at that.