Skip to content
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

webread function #10

Closed
b00m18 opened this issue Dec 23, 2020 · 5 comments
Closed

webread function #10

b00m18 opened this issue Dec 23, 2020 · 5 comments

Comments

@b00m18
Copy link

b00m18 commented Dec 23, 2020

Hey @EnricSala ,

first, thanks for sharing!

I have a question about the webread function you are using in your script. I am trying to use the query:

'SELECT mean("Tmp") FROM "weather" WHERE ("sensor_" = ''Temperature_1'') AND time >= 1607868000000ms and time <= 1607925600000ms GROUP BY time(1m) fill(null);SELECT mean("Tmp") FROM "weather" WHERE ("sensor" = ''Temperature_2'') AND time >= 1607868000000ms and time <= 1607925600000ms GROUP BY time(1m) fill(null)'

The query is generated in Grafana. I should get two Signals, but in the struct 'response' is only one of the two signals. Do you know this problem or can matlab only get one?

I am using Matlab 2020b.

Best regards

@EnricSala
Copy link
Owner

Hi @b00m18, thanks for reporting the issue!

Seems to be related to encoding the ; character that separates queries.

Looks like the same issue also affected the Java client: influxdata/influxdb-java#214

Will try to find some time to fix it this week.

@b00m18
Copy link
Author

b00m18 commented Dec 23, 2020

Thanks for the fast reply!

It seems like Matlab doesnt encode ; in webread. When I am using urlencode() its replacing it with %3B.

@b00m18
Copy link
Author

b00m18 commented Jan 4, 2021

I've received the following solution from the Mathwork support: Matlab ist using the RFC 3986 specs in this syntax with webread:
r = webread('http://myServer:8086/query','db','mydb','q','SELECT * FROM cpu_load_short;SELECT * FROM cpu_load_short');

So it won't replace the ; with %3B

But this syntax:
r = webread('http://myServer:8086/query?db=mydb&q=SELECT * FROM cpu_load_short;SELECT * FROM cpu_load_short');

replaces ; with %3B because it provides backwards compatibility with older versions of 'webread', which was not entirely following the RFC specs.

@EnricSala
Copy link
Owner

Thanks for looking into a solution! Filed a PR with the suggested approach in #11.

@b00m18 would you be able to take a look to verify it makes sense?

@EnricSala
Copy link
Owner

Closing this issue, fixed in #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants