Snowpipe Streaming Node.js SDK v1.4.0
    Preparing search index...

    Class StreamingIngestClient

    A client that is the starting point for using the Streaming Ingest client APIs.

    A single client maps to exactly one account/database/schema/pipe in Snowflake; however, multiple clients can point to the same account/database/schema/pipe. Each client contains information for Snowflake authentication and authorization, and it is used to create one or more StreamingIngestChannel instances for data ingestion.

    Create instances using the createClient() function.

    Index

    Properties

    binaryInputFormat: string

    The binary input format. One of: "BASE64", "HEX", "UTF-8".

    clientName: string

    The client name.

    dbName: string

    The database name.

    isClosed: boolean

    Whether the client is closed.

    pipeName: string

    The pipe name.

    schemaName: string

    The schema name.

    Methods

    • Close the client. If waitForFlush is true, the client waits for all data in every channel to be flushed to Snowflake before shutting down.

      Parameters

      • Optionaloptions: { timeoutMs?: number; waitForFlush?: boolean }

        Close options

        • OptionaltimeoutMs?: number

          Optional timeout in milliseconds for the flush operation.

        • OptionalwaitForFlush?: boolean

          Whether to wait for the flush to complete, defaults to true.

      Returns Promise<void>

      StreamingIngestError If closing the client fails or the timeout is reached

    • Drop a channel by name (server-side removal).

      Parameters

      • channelName: string

        Name of the channel to drop

      Returns Promise<void>

      StreamingIngestError If dropping the channel fails

    • Get the status of multiple channels. Can fetch status for channels not opened by this client.

      Parameters

      • channelNames: string[]

        Names of channels to query

      Returns Promise<Record<string, ChannelStatus>>

      StreamingIngestError If retrieving statuses fails

    • Get the latest committed offset tokens for multiple channels.

      Parameters

      • channelNames: string[]

        Names of channels to query

      Returns Promise<Record<string, string>>

      StreamingIngestError If retrieving offset tokens fails

    • Initiate a flush of the client. Causes all outstanding buffered data to be flushed to Snowflake. Data can still be accepted by the client after calling this method — this is an asynchronous call that returns after the flush is initiated for all channels.

      Returns void

      StreamingIngestError If initiating the flush fails

    • Open a channel with the given name. The channel is opened on the database/schema/pipe defined by this client. If the channel already exists, Snowflake reuses the latest persisted offset token unless a new one is provided.

      Parameters

      • options: { name: string; offsetToken?: string }

        Channel options

        • name: string

          The name of the channel to open.

        • OptionaloffsetToken?: string

          Optional offset token to set on the channel. If not provided and this reopens an existing channel, the latest persisted offset token is reused.

      Returns Promise<{ channel: StreamingIngestChannel; status: ChannelStatus }>

      StreamingIngestError If opening the channel fails

    • Wait for all buffered data in all channels managed by this client to be flushed to Snowflake. This method triggers a flush of all pending data across all channels and waits for the flush operations to complete.

      Parameters

      • Optionaloptions: { timeoutMs?: number }

        Wait options

        • OptionaltimeoutMs?: number

          Optional timeout in milliseconds.

      Returns Promise<void>

      StreamingIngestError If waiting for the flush fails

      Error If the timeout is reached