New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data.service.js vs postgres sql query error #16
Comments
Please open issue in sql adapter. Should be there. |
No, it should be somewhere else ... it seems that "options.start" is correctly a number (ms), but options.end is a "Date". Currently the history adapters are not checking this and so this problem ocurs. |
Thanks for your swift answer. I'll look into the sql adapter! |
Stop. Please see my last comment. It comes from this adapter. |
Understood, but I thought while it’s true that different data types are thrown at the sql adapter, the common opinion is that the sql adapter needs to be able to handle different date objects/formats. |
Thw definition of the API "getHistory" is that Timestamps are accepted :-) Yes Error handling is missing there ... that would be worth a sql issue :-) |
should be solved with PR#19 |
v0.3.2 of habpanel is on npm |
Still the same with 0.3.2: |
Ok, please set sql to Debug log mode and show the graph again and send the log from sql please |
Here you are: 2019-01-31 16:36:00.207 - info: phantomjs.0 Create 1200px*800px in 10000ms - "http://192.168.178.63:8082/vis/index.html#Wetter_Ext" => "/opt/iobroker/node_modules/iobroker.phantomjs/wetter-ext.png"2019-01-31 16:36:00.197 - info: javascript.0 script.js.common.Wetter_Ext: exec: wput -nc /opt/iobroker/node_modules/iobroker.phantomjs/wetter-ext.png ftp://u82798514-iobroker:iobroker@home598621085.1and1-data.host ` |
There you can see interestingly some requests with correct "timestamp numbers" (maybe from other sources/stats?) and some with a incorrect data string ... @foxthefox |
@holger05 |
@foxthefox |
You could close habpanel and other visus dat use sql to get data, then set debug log and open the object history settings in admin, go to the "table" tab and then you see in the sql Ligs the queries ... and the ID in there :-) |
Im Log siehst Du dann die Queries und da ist dann die ID drin. Du kannst zeitlich dann sehen was du im Admin siehst und welche ID in der Query steht |
Hallo.
Kann ich irgendwo den ganzen Query anzeigen? im SQL-Server selbst? |
Debug log in sql nutzen. Dann steht die komplette Query direkt davor im Log |
Meinst du die Config der Instanz sql.0 ? |
Instanz sql.0 Loglevel auf debug |
Keine Ahnung wo das geht. in den Adapter - Einstellungen kann ich nichts dergleichen finden. |
ok ... so klappts: Ich denke, das Datum muss in Hochkommas oder als timestamp angegeben werden. Danke! |
muss timestamp sein |
Also nach https://github.com/ioBroker/ioBroker.sql/blob/master/lib/postgresql.js#L90 sollte es "options.start" sein. options.end passt (oder ist nicht gesetzt und daher automatisch gesetzt) |
Hallo. Es gibt noch keine Lösung, oder? |
idealerweise später heute fixed by #21 |
0.3.4 on npm |
Danke! Funktioniert! |
Gefixt habens andere aber Danke. Wenn Du was spenden willst dann am besten ans ioBroker Projekt :-) |
Vanilla habpanel install on iobroker.
postgres as history adapter
tried to configure the charting widget with some time series data (tried temperature and power consumption)
fails because of malformed query:
SQL log:
error: syntax error at or near "T22"
SQL statement generated:
STATEMENT: SELECT ts, val FROM ts_number WHERE ts_number.id=1753 AND ts_number.ts < 1548719200089 AND ts_number.ts >= 2019-01-27T22:23:18.947Z UNION ( SELECT ts, val FROM ts_number WHERE ts_number.id=1753 AND ts_number.ts < 2019-01-27T22:23:18.947Z ORDER BY ts_number.ts DESC LIMIT 1) UNION ( SELECT ts, val FROM ts_number WHERE ts_number.id=1753 AND ts_number.ts >= 1548719200089 ORDER BY ts_number.ts ASC LIMIT 1) ORDER BY ts ASC;
obviously postgres is expecting a timestamp (i.e. 1548719200089) and the query generated generates a datestring (i.e. 2019-01-27T22:23:18.947Z)
I am not familiar "who's" in charge for generating the correct query? Is this the sql adapters fault? or should the data.service.js call the history service with a timestamp rather a datetime string?
Thanks for looking into this!
The text was updated successfully, but these errors were encountered: