Klevr Product Documentation logo

Store Cosmos DB Query Stage

The Store Cosmos DB Query stage allows Integration Hub to query data stored in a Cosmos DB data store.

Stage Overview

The Store Cosmos DB Query stage allows Integration Hub to query data stored in a Cosmos DB data store.

The Store Cosmos DB Query stage is only supported when deploying using Standard Logic Apps.

Stage Definition File Location

All Store Cosmos DB Query stages are defined by creating an appropriately formatted JSON definition file in the following location:

interfaces
{businessUnitCode}
{domainCode}
{integrationName}
st
cdb
{STAGE_NAME}.json

Stage JSON Definition File Format

The JSON definition file for a Store Cosmos DB Query stage is as follows:

{
  "name": "stage-name",
  "operation": "query",
  "displayName": "Brief Stage Title",
  "description": "Brief description of the stage.",
  "enabled": "$env:STATUS_<INTEGRATION_NAME>",
  "source": "source-event",
  "concurrency": 10,
  "cdb": {
    "databaseId": "DatabaseID-string-value",
    "containerId": "ContainerID-string-value",
    "connectionString": "$env:CDB_CONNECTION_STRING",
    "schemaFilename": "schemas/path/to/schema/schema-name.json",
    "continuationToken": "Cosmos-DB-Continuation-Token",
    "maxItemCount": 1000
  },
  "preLogTransformSchemaFileName": "schemas/path/to/schema/schema-name.liquid",
  "preLogTransformSchemaType": "liquid|javascript",
  "preLogTransformFormat": "json|xml|csv"
}
  
PropertyDescription
nameThe name of the stage.
operationThis must be query.
displayNameOptional (but highly recommended). A short (3 or 4 word) "display name" for the stage, used as a "title" of the stage in the Integration Hub Portal service's self-documentation capability.
descriptionOptional (but highly recommended). A brief (10 to 15 word) description of the stage, used as a brief description of the stage's purpose in the Integration Hub Portal service's self-documentation capability. For a more detailed explanation (when needed), use the stage markdown feature.
enabledOptional boolean flag (true or false). Default is true.

Generally set via a DevOps variable. Controls if the stage is deployed enabled or not.
sourceThe source event that the stage subscribes to. See Pub/Sub Model.

Alternatively, sources may be supplied, and an array of one or more source events can be subscribed to.
concurrencyOptional number of concurrent runs permitted for the stage. Default is 10.
cdbAn object that contains the databaseId, containerId, connectionString, and the schemaFilename.
databaseIdDatabase ID Name. This can be found by navigating to the Cosmos DB resource and looking at the header folder in the data explorer.
containerIdThe Container ID Name. This can be found by navigating to the Cosmos DB resource and looking at the target container folder in the data explorer.
connectionStringThis value is stored as an environment variable. The connection string can be found by navigating to the Cosmos DB resource and looking in the keys.
schemaFilenameA filename that defines the Cosmos DB SQL query schema. See below for more details on the file location and format.
continuationTokenOptional continuation token used to resume a paged Cosmos DB query from a prior position. When supplied, the stage starts querying from that token instead of the beginning of the result set.
maxItemCountOptional number to limit the query to return no more than the specified number of results.

Pre-Logging Transformation

This stage supports the optional pre-logging transformation feature using the following fields:

  • preLogTransformSchemaFileName
  • preLogTransformSchemaType
  • preLogTransformFormat

See the Pre-Logging Transformation for details.

Schema File Location

The schemaFilename must be defined using a directory path which is based on the root of the Integration Hub service folder. It is recommended that this always starts with the directory schemas, and that all Cosmos DB schemas be stored in a logical structure that allows for easy reuse of Cosmos DB schema definitions as required.

Schema File Format

The schema file must contain a valid Cosmos DB query that will return the required data from the Cosmos DB store.

Last updated on