Skip to content

Add InfluxDB 2.x time-series database support#75

Merged
nnhy merged 5 commits intomasterfrom
copilot/support-influxdb-crud-operations
Feb 12, 2026
Merged

Add InfluxDB 2.x time-series database support#75
nnhy merged 5 commits intomasterfrom
copilot/support-influxdb-crud-operations

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

Implements full CRUD operations for InfluxDB 2.x, a time-series database widely used in IoT and industrial monitoring. InfluxDB uses Flux query language and Line Protocol (not SQL), requiring custom driver implementation.

Implementation

Driver Layer

  • ADO.NET Provider: InfluxDBFactory, InfluxDBConnection, InfluxDBCommand, InfluxDBDataReader, InfluxDBParameter
  • HTTP API Integration: Shared HttpClient instance with per-request Token authentication to avoid socket exhaustion
  • CSV Response Parsing: Automatic deserialization of InfluxDB's CSV-formatted query results

Database Adapter

  • InfluxDB: Extends RemoteDb with time-series specific formatting (nanosecond timestamps, quoted identifiers)
  • InfluxDBSession: Batch operations via Line Protocol format
    // Line Protocol: measurement,tag1=val1 field1=val1,field2=val2 timestamp
    "temperature,location=room1 value=23.5,humidity=45"
  • InfluxDBMetaData: Queries measurements (tables) using Flux's schema functions

API

Connection string format:

DAL.AddConnStr("InfluxDB", 
    "Server=http://localhost:8086;Token=xxx;Organization=org;Bucket=bucket",
    null, "InfluxDB");

Write (Line Protocol):

dal.Execute("temperature,location=room1 value=23.5");

Query (Flux):

var flux = "from(bucket:\"bucket\") |> range(start: -1h)";
var dt = dal.Query(flux);

Testing

8 integration tests covering initialization, connection, writes, queries, and batch operations (skipped by default, require running InfluxDB instance).

Framework Support

Compatible with net45 through net10. Uses HttpRequestMessage with SendAsync() for broad framework compatibility.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • crl.entrust.net
    • Triggering command: /usr/bin/dotnet dotnet build NewLife.XCode.sln --configuration Release (dns block)
  • ocsp.entrust.net
    • Triggering command: /usr/bin/dotnet dotnet build NewLife.XCode.sln --configuration Release (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>期待支持influxdb时序数据库</issue_title>
<issue_description>工控领域influxdb用得很多。期待XCode早日集成influxdb</issue_description>

<agent_instructions>尽力实现这个需要,主要是提供添删改查功能</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@nnhy influxdb 跟es 一样,使用自己独特的查询语法,不支持sql。 XCode不太好支持。

为了支持这种独立查询语法的数据,XCode需要进行架构升级才行。</comment_new>
<comment_new>@nnhy
@copilot 帮我分析一下,XCode能否实现对influxdb时序数据库的支持,主要是添删改查</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 12, 2026 16:09
Co-authored-by: nnhy <506367+nnhy@users.noreply.github.com>
Co-authored-by: nnhy <506367+nnhy@users.noreply.github.com>
Co-authored-by: nnhy <506367+nnhy@users.noreply.github.com>
…ema return

Co-authored-by: nnhy <506367+nnhy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for InfluxDB time-series database Add InfluxDB 2.x time-series database support Feb 12, 2026
Copilot AI requested a review from nnhy February 12, 2026 16:26
Copy link
Member

@nnhy nnhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在不写查询语句的前提下,要求支持实体类的添删改查操作。

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

Successfully merging this pull request may close these issues.

期待支持influxdb时序数据库

2 participants