page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the Cassandra API |
azure-cosmos-db-cassandra-go-getting-started |
gocql
Driver)
Developing a Go app with Cassandra API using Azure Cosmos DB (Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the Cassandra API.
The code included in this sample is intended to get you quickly started with a Go application that connects to Azure Cosmos DB with the Cassandra API. It walks you through creation of keyspace, table, inserting and querying the data.
Prerequisites
Before you can run this sample, you must have the following prerequisites:
- An Azure account with an active subscription. Create one for free. Or try Azure Cosmos DB for free without an Azure subscription.
- Go installed on your computer, and a working knowledge of Go.
- Git.
Running this sample
-
Clone this repository using
git clone https://github.com/Azure-Samples/azure-cosmos-db-cassandra-go-getting-started
-
Change directories to the repo using
cd azure-cosmos-db-cassandra-go-getting-started
-
Set environment variables
export COSMOSDB_CASSANDRA_CONTACT_POINT=<Contact Point for Azure Cosmos DB Cassandra API>
export COSMOSDB_CASSANDRA_PORT=<Port for Azure Cosmos DB Cassandra API>
export COSMOSDB_CASSANDRA_USER=<Username for Azure Cosmos DB Cassandra API>
export COSMOSDB_CASSANDRA_PASSWORD=<Password for Azure Cosmos DB Cassandra API>
- Run the application
go run main.go