question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

select query builder

See original GitHub issue

I’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:closed
  • Created 10 years ago
  • Reactions:2
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
connor4312commented, Apr 26, 2017

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.

0reactions
stale[bot]commented, Sep 27, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found