The Azure Cosmos DB data source type in ArcGIS Velocity read records from database collections stored in Azure Cosmos DB.
A researcher wants to load data from a database collection stored in Azure Cosmos DB into Velocity to perform analysis.
- The master key is encrypted the first time the analytic is saved and is stored in an encrypted state.
- A where clause can be specified to restrict the records loaded from the Azure Cosmos DB container collection.
- Analytic run time variables can be specified in the Where clause parameter to only load new features from the Azure Cosmos DB container collection for each run.
The endpoint URL for Azure Cosmos DB, for example, https://yourCosmosDBAccountName.documents.azure.com:443/.
The primary key for Azure Cosmos DB.
The name of the Azure Cosmos DB container that contains the collection of data to read.
The name of the Azure Cosmos DB collection in the specified container that contains the data.
Where clause (optional)
Restrict the features loaded from the Azure Cosmos DB container collection.
Use a simple query format. For example, if a numeric field called course exists in the dataset, you can specify a where clause of course = 49.5845184; if a string field called user_id exists in the dataset, you can specify a where clause of user_id = 'pete1234'.
In the Azure Cosmos DB interface, these queries look like SELECT * FROM c WHERE c.user_id = 'pete1234'; however, you must specify user_id = 'pete1234' for this parameter in Velocity.
When querying string fields, use single quotation marks around text that is part of the query, for example, road_type = 'asphalt'.
Analytic run time variables can be specified to only load new features for each run in a recurring big data analytic. These variables are replaced with the relevant analytic scheduled start times for querying ISO 8601 string fields in Azure Cosmos DB. The available analytic run time variables available are $analytic.AnalyticLastScheduledStartTime and $analytic.AnalyticScheduledStartTime. For the first run after starting a scheduled big data analytic, the $feature.AnalyticLastScheduledStartTime variable is provided as the ISO 8601 origin time of January 1, 1970, so all features after this time will be loaded. To accommodate this, specify an additional part of the where clause query to return features after the anticipated first run time of the recurring analytic.
For example, you can specify a where clause as shown below in which the analytic was started June 6, 2021, at 12:01:01 UTC.
yourISO8601StringTimestampField > '$analytic.AnalyticLastScheduledStartTime' and yourISO8601StringTimestampField <= '$analytic.AnalyticScheduledStartTime' and yourISO8601StringTimestampField > '2021-06-04T12:01:01.0Z'
Considerations and limitations
- When specifying a where clause to filter string values, wrap text values in single quotation marks.
- When specifying date fields, only the following configurations are supported for this data source:
- Epoch seconds such as 1616673883
- Epoch milliseconds such as 1616673883000
- ISO 8601 datetime format with no time zone such as 2021-03-25T12:05:34
- ISO 8601 datetime format with a time zone such as 2021-03-25T12:05:34+0000
- String dates in the format (milliseconds are optional) yyyy-MM-dd HH:mm:ss[.fffffffff] such as 2021-03-25 12:05:34 or 2021-03-25 12:05:34.435
- You can use the Where clause parameter to specify analytic run time variables to restrict each recurrence of the analytic to only load the most recent features since the last analytic run. Additional details are provided above.