@influxdata/influxdb3-client
    Preparing search index...

    InfluxDBClient for interacting with an InfluxDB server, simplifying common operations such as writing, querying.

    Index

    Constructors

    • Creates a new instance of the InfluxDBClient from ClientOptions.

      Parameters

      Returns default

    • Creates a new instance of the InfluxDBClient from connection string.

      Parameters

      • connectionString: string

        connection string

      Returns default

      https://us-east-1-1.aws.cloud2.influxdata.com/?token=my-token&database=my-database

      Supported query parameters:
      - token - authentication token (required)
      - authScheme - token authentication scheme. Not set for Cloud access, set to 'Bearer' for Edge.
      - database - database (bucket) name
      - timeout - I/O timeout
      - precision - timestamp precision when writing data
      - gzipThreshold - payload size threshold for gzipping data
      - writeNoSync - skip waiting for WAL persistence on write
    • Creates a new instance of the InfluxDBClient from environment variables.

      Supported variables:

      • INFLUX_HOST - cloud/server URL (required)
      • INFLUX_TOKEN - authentication token (required)
      • INFLUX_AUTH_SCHEME - token authentication scheme. Not set for Cloud access, set to 'Bearer' for Edge.
      • INFLUX_TIMEOUT - I/O timeout
      • INFLUX_DATABASE - database (bucket) name
      • INFLUX_PRECISION - timestamp precision when writing data
      • INFLUX_GZIP_THRESHOLD - payload size threshold for gzipping data
      • INFLUX_WRITE_NO_SYNC - skip waiting for WAL persistence on write
      • INFLUX_GRPC_OPTIONS - comma separated set of key=value pairs matching @grpc/grpc-js channel options.

      Returns default

    Methods

    • Retrieves the server version by making a request to the /ping endpoint. It attempts to return the version information from the response headers or the response body.

      Returns Promise<string>

      A promise that resolves to the server version as a string, or undefined if it cannot be determined. Rejects the promise if an error occurs during the request.

    • Execute a query and return the results as an async generator.

      Parameters

      • query: string

        The query string.

      • Optionaldatabase: string

        The name of the database to query.

      • queryOptions: Partial<QueryOptions> = ...

        The options for the query (default: { type: 'sql' }).

      Returns AsyncGenerator<Record<string, any>, void, void>

      An async generator that yields maps of string keys to any values.

         client.query('SELECT * from net', 'traffic_db', {
      type: 'sql',
      headers: {
      'channel-pref': 'eu-west-7',
      'notify': 'central',
      },
      })
    • Execute a query and return the results as an async generator.

      Parameters

      • query: string

        The query string.

      • Optionaldatabase: string

        The name of the database to query.

      • queryOptions: Partial<QueryOptions> = ...

        The type of query (default: {type: 'sql'}).

      Returns AsyncGenerator<PointValues, void, void>

      An async generator that yields PointValues object.

      client.queryPoints('SELECT * FROM cpu', 'performance_db', {
      type: 'sql',
      params: {register: 'rax'},
      })