SQL API
  • 05 Apr 2022
  • 6 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

SQL API

  • Dark
    Light
  • PDF

Article summary

Azure Cosmos DB SQL(core)

Cerebrata makes managing the data stored in your Cosmos DB SQL API accounts super easy. From managing databases, containers to documents, Cerebrata provides the most extensive set of features.
Loaded with features like viewing documents in multiple formats, built-in query manager, stored procedures, functions and triggers and more, you don't have to look beyond Cerebrata.

View Properties

User can view the following properties of Cosmos DB SQL API.

  • Cosmos DB SQL API account name
  • Account API
  • Resource ID
  • Resource Group name
  • Resource Group ID
  • Subscription name
  • Subscription ID
  • Location
  • URI
  • Provisioning State
  • Offer Type
  • Default Consistency
  • Multi Region Write Enabled

The below illustration shows viewing the properties of Cosmos DB SQL API account.
CosmosDB View Properties

Properties of Cosmos DB SQL API can be accessed in Cerebrata only when you associate Cosmos DB SQL API via Subscription Connection.

User can also open the appropriate Azure resource in the Azure portal without traversing between the browser and the application, using the Open in portal option available at the top right corner.

The below illustration shows viewing the Cosmos DB SQL API account in Azure Portal.
CosmosDB Open In Portal

Manage Tags

Tags are used for easy identification and grouping of the resources. Cerebrata allows us to create, delete and update the tags at ease.
The below illustration shows managing the tags of Cosmos DB SQL API.
CosmosDB Manage Tags

Tags associated with the Cosmos DB SQL API can be accessed in Cerebrata only when you associate Cosmos DB SQL API via Subscription Connection.

Manage Locks

Management locks can be created so that the users access the resources cannot update or delete the resources without your concern. Cerebrata helps us in managing the management locks in a comfortable manner.
The below illustration shows managing the locks of Cosmos DB SQL API.
CosmosDB Manage Locks

Locks on a Cosmos DB SQL API can be accessed in Cerebrata only when you associate the Cosmos DB SQL API via Subscription Connection.

Manage Access Keys

Access Keys are used to connect to the required Cosmos DB account without the use of Azure AD. Cerebrata allows us to view the connection string, access keys and regenerate them based on the requirements.

The below illustration shows managing the Access Keys of Cosmos DB SQL API.
CosmosDB Access Keys

Shared Access Key of a Cosmos DB SQL API can be accessed in Cerebrata only when you associate the Cosmos DB SQL API via Subscription Connection.

Edit Azure Cosmos DB Account Connection

For Cosmos DB accounts associated via the connection string, the user can edit the Cosmos DB account key. This feature helps us to update the account key when the account key is regenerated. User can also edit any friendly name given by clicking on the Edit button (or Crtl+E).

The below illustration shows editing the Cosmos DB Account Connection.
CosmosDB Edit Connection and Friendly name

Database

Create

Databases can be created by providing the database name and Throughput. The database can be created either with fixed, auto scale or no throughput.
The below illustration shows creation of a database in Cosmos DB SQL API Account.
CosmosDB Create Database

Update

The throughput of the created database can be modified.
The below illustration shows editing the throughput of a database in Cosmos DB SQL API Account.
CosmosDB Update Database Throughput

Delete

Databases can also be deleted through Cerebrata itself.
The below illustration shows deleting a database in Cosmos DB SQL API Account.
CosmosDB Delete Database

Container

Create

Containers can be created inside the databases with the following properties.

  • Container Name
  • Partition Key
  • Throughput
  • TTL
  • Indexing Policy
  • Unique Key Policy
    The below illustration shows creation of a container in database.
    CosmosDB Create Container

Update

All the properties like Throughput, Indexing Policy, Unique Key Policy and TTL can be updated.
The below illustration shows editing a container in database.
CosmosDB Update Container

Delete

The container can also be deleted through Cerebrata itself.
The below illustration shows deleting a container in database.
CosmosDB Delete Container

Stored Procedures

Stored procedures can be created, updated and deleted through Cerebrata itself.
The below illustration shows managing the stored procedures through Cerebrata.
CosmosDB Stored procedure

Functions

Functions can be created, updated and deleted through Cerebrata itself.
The below illustration shows managing the functions through Cerebrata.
CosmosDB Function

Triggers

Triggers can be created, updated and deleted through Cerebrata itself.
The below illustration shows managing the triggers through Cerebrata.
CosmosDB Trigger

View Documents

Cerebrata allows us to visualize the documents in container both in the data grid and as raw JSON. Viewing the documents as Data Grid allows us to easily read the document properties. It is also possible to query the required documents in a container based on the provided query.

The below illustration shows viewing the documents as Data Grid and Raw JSON.
CosmosDB View Documents

Manage Queries

Cerebrata allows us to save the queries that can be executed in a container. It is also possible to edit and delete them whenever required. We can mark a query a default, so that whenever a container is opened default query will be opened in the query window. Queries can also be marked as shared so that they are available across all the containers.
The below illustration shows managing the Queries of Cosmos DB SQL API.
CosmosDB Query Manager

User can save a query and use it for quick access. Saved queries can also be edited or deleted later.

Create Documents

Cerebrata allows us to create or insert document into a container. The document can be added as JSON.
The below illustration show creating a CosmosDB SQL API document
CosmosDB New Document

Update Documents

It is also possible to update the document using Cerebrata. The document can be either merged or replaced when it is updated.
When the document is merged, all the new properties will be added, and the value of the existing properties will be updated.
When the document is replaced, the entire document will be replaced with the provided document.
The below illustration show updating a CosmosDB SQL API document.
CosmosDB Update Document

Delete Document

Cerebrata allows us to delete the documents in bulk. All the documents or documents filtered based on the query can be deleted using Cerebrata.
The below illustration shows deleting the CosmosDB SQL API documents.
CosmosDB Delete Document

Download Documents

Documents can be downloaded as a JSON file or CSV file for auditing purposes using Cerebrata. The documents can either be selected manually or through query. It is also possible to download all the documents in the container. We can include the system properties like eTag, Timestamp etc in the downloaded file if required.
The below illustration shows downloading the CosmosDB SQL API documents.
CosmosDB Download Documents

Copy Documents

In some cases, it may be necessary to copy the documents from one container to another. Cerebrata allows us to copy documents across containers. It is also possible to copy the Storage Table entities as SQL API documents to SQL API container. Either all the documents or documents filtered by the provided query can be selected for copying. We can configure either to skip or overwrite the existing records while copying.
It is possible to stop the copy process when a conflict is found by enabling the Treat Conflict Exception as error option.
The below illustration shows copying the CosmosDB SQL API documents from one container to another.
CosmosDB Copy Documents

The below illustration shows copying the Storage table entities as documents to CosmosDB SQL API container.
CosmosDB Copy Storage Documents to SQL API

Document Analytics

When documents are inserted into container, a partition key is provided for the quick access of related data. It is not possible to store a large amount of data within the same logical partition. Cerebrata provides a capability to visualize the total number of documents and the total size of the documents in a container. This can be viewed by selecting the Document analytics option from the context menu of the container.

The below illustration shows viewing the Document Analytics of a Cosmos DB SQL API container.
CosmosDB Document Analytics(1)

It is also possible to export the chart as png file and export the data in a csv file.


Was this article helpful?

What's Next