Cassandra API provides us the ability to store NoSQL data efficiently and easily in Cassandra. You need to create a new Cassandra database inside Cosmos DB to perform the CRUD operation.
- Log in to your Azure portal and click on the Azure Cosmos DB option on the left side of the options bar.
- Click on the + button and give your new database a proper ID, then choose the Cassandra option from the API dropdown.
- You can create a new resource or use the existing one. Select the location where most writing will happen and click on the Create button. You can refer to the screenshot for reference:
- Now, click on Data explorer | New Table button and create a new table to store the data. Refer the screenshot below for the reference.
- Now, we can insert data using the standard SQL commands as shown below.
INSERT INTO uprofile.user (first_name, last_name) VALUES ('Shahid', 'Shaikh');
- You can read data from the Cassandra table using the SELECT query.
SELECT * from uprofile.user;
Similarly, UPDATE and DELETE commands can be used to update and delete the records from Cassandra table respectively.
This covers performing the CRUD operations using the various data models.