influxdata / influxdata/influxdb-client-csharp

Flux query builder fluent API

Open
#187 24 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
C#
Stars
377
Forks
93
Avg merge
9m
Merged PRs (30d)
2

Description

Currently, the queries have to be built manually in a string. It would be great to have a fluent API to build a query.

I know you guys are working on another library to query by using LINQ, but that requires having the data modeled and annotated in C# classes, which is not always possible due to the nature of dynamic data and metrics.

I'm proposing an API that can do things like the following:

```csharp
var query = influxDb.GetQueryBuilder()
.From("bucket")
.Filter(r => r["_measurement"] == "cpu")
.Filter(r => r["_field"] == "temperature")
.Filter(r => r["some-tag"] == "some-value")
.AggregateWindow(every: TimeSpan.FromSeconds(10), fn: InfluxDb.Functions.Mean, createEmpty: false)
.Yield("mean")
.ToString();
```

This way we could be writing queries in a .NET idiomatic way and ensuring the resulting strings are valid Flux queries.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by surveying the existing manual Flux query construction and the separate LINQ-based query library mentioned in the issue, then determine the scope and API shape for dynamic data and metrics; done means an agreed fluent API can produce valid Flux queries like the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend-api-design, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.