Documentation

查询 SQL Server

使用Flux查询 Microsoft SQL Server

  1. 导入 sql

  2. 使用 sql.from() 并提供以下参数:

    • driverName: sqlserver
    • dataSourceName: 查看数据源名称
    • query: 要执行的SQL查询
import "sql"

sql.from(
    driverName: "sqlserver",
    dataSourceName: "sqlserver://user:password@localhost:1433?database=examplebdb",
    query: "GO SELECT * FROM Example.Table",
)

SQL Server 数据源名称

根据连接字符串sqlserver 驱动程序使用以下 DSN 语法:

sqlserver://username:password@localhost:1433?database=examplebdb
server=localhost;user id=username;database=examplebdb;
server=localhost;user id=username;database=examplebdb;azure auth=ENV
server=localhost;user id=username;database=examplebdbr;azure tenant id=77e7d537;azure client id=58879ce8;azure client secret=0143356789

SQL Server ADO 认证

使用以下方法之一来提供 SQL Server 认证凭据作为 ActiveX 数据对象 (ADO) DSN 参数:

从环境变量中检索认证凭据

azure auth=ENV

从文件中获取身份验证凭据

InfluxDB CloudInfluxDB OSS 可以访问 底层文件系统,并且不支持从文件中读取凭据。 要从文件中检索 SQL Server 凭据,请在你的本地计算机上执行查询 Flux REPL

azure auth=C:\secure\azure.auth

在DSN中指定身份验证凭据

# Example of providing tenant ID, client ID, and client secret token
azure tenant id=77...;azure client id=58...;azure client secret=0cf123..

# Example of providing tenant ID, client ID, certificate path and certificate password
azure tenant id=77...;azure client id=58...;azure certificate path=C:\secure\...;azure certificate password=xY...

# Example of providing tenant ID, client ID, and Azure username and password
azure tenant id=77...;azure client id=58...;azure username=some@myorg;azure password=a1...

在Azure虚拟机中使用托管标识

有关托管身份的信息,请参阅 Microsoft managed identities

azure auth=MSI

SQL Server 到 Flux 数据类型转换

sql.from() 将 SQL Server 数据类型转换为 Flux 数据类型。

SQL Server 数据类型Flux 数据类型
整数, 微整数, 小整数, 大整数int
十进制,实数,浮点数,货币,小货币float
日期时间偏移time
bool

所有其他 SQL Server 数据类型(包括其他 日期/时间类型)都被转换为字符串。



Flux的未来

Flux 正在进入维护模式。您可以像现在一样继续使用它,而无需对您的代码进行任何更改。

阅读更多

InfluxDB 3 开源版本现已公开Alpha测试

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

我们将发布两个产品作为测试版的一部分。

InfluxDB 3 核心,是我们新的开源产品。 它是一个用于时间序列和事件数据的实时数据引擎。 InfluxDB 3 企业版是建立在核心基础之上的商业版本,增加了历史查询能力、读取副本、高可用性、可扩展性和细粒度安全性。

有关如何开始的更多信息,请查看: