select query builder
See original GitHub issueI’m thinking about writing a select-query-builder. The function would receive an object defining which fields to select from the series and how to aggregate them.
Although the influx SQL syntax is pretty straight forward, I would find it more useful to define my dynamically built queries in json notation. I imagine it to be similar to the mongo query syntax.
e.g.
SELECT MEDIAN(my_col), PERCENTILE(my_col,95) FROM my_series WHERE time > NOW()-2h GROUP BY time(1m);
could be become something like this:
var query = {
select : [ {'median' : 'my_col'}, {'percentile' : ['my_col',95]}],
where : [{ time : { 'gt' : 'now()-2h'}]
group : [{time: '1m'}}
};
dbInflux.query('my_series',query,callback()}
This syntax is still far from perfect, but I hope you get the idea.
dbinflux.query()
could be tweaked to accept either a raw SQL string or an object.
If it’s not suitable for this module, it could also become a separate module which sits ontop of node-influx.
What do you think?
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Select using Query Builder - typeorm - GitBook
Select using Query Builder · QueryBuilder is one of the most powerful features of TypeORM - it allows you to build SQL queries...
Read more >Query Builder - Laravel - The PHP Framework For Web Artisans
Select Statements; Raw Expressions; Joins; Unions; Basic Where Clauses ... Laravel's database query builder provides a convenient, fluent interface to ...
Read more >How to select specific columns in typeorm querybuilder
When you want to select particular columns you have to use getRawOne like below, const user = await createQueryBuilder("user") .
Read more >TypeORM - Query Builder - Tutorialspoint
TypeORM - Query Builder, Query builder is used build complex SQL queries in an easy way. It is initialized from Connection method and...
Read more >The QueryBuilder - Doctrine Object Relational Mapper (ORM)
A QueryBuilder provides an API that is designed for conditionally constructing a DQL query in several steps. It provides a set of classes...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We do have an escaper that allows for safe insertion of external content, check out the escape object.
However, InfluxDB has added support for bound parameters for safer usage. We should definitely support that in this client.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.