-
Notifications
You must be signed in to change notification settings - Fork 42
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
Support a restricted SQL subset for querying timeseries #4475
Conversation
16ef0c5
to
085b376
Compare
3511e0b
to
4d644f7
Compare
This one has been hanging around for a while, so I'm not sure if folks have any feedback about it. On one hand, there is basically zero risk right now. SQL support is only available through the internal |
- Add methods for querying oximeter timeseries using a limited subset of SQL. The raw string is heavily validated, and only simple SELECT queries are currently supported, with a limited subset of ClickHouse functions. Still, this allows running many different kinds of queries, including aggregations, window functions, and joins. - Adds a few types for reading out tabular data from the query result, and parsing basic metadata for understanding resource usage of the queries. - Add a barebones SQL shell for running oximeter SQL queries, using the new `Client::query` method. - Include a bunch of tests for the restricted SQL subset as well as correctness of the actual returned queries against the DB. - Add a small README for the SQL shell
} | ||
let SetExpr::Select(select) = &mut *query.body else { | ||
return unsupported!("Only SELECT queries are currently supported"); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was not aware of let/else. that is handy!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, might be my favorite syntax enhancement from the last few Rust releases!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, been busy! I think this looks great, and it will be very helpful to exercise it as a dev tool to inform the much harder decision about whether to incorporate it into the API somehow.
Client::query
method.