page_type: sample
languages:
- go
products:
- azure
description: "Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the Cassandra API"
urlFragment: azure-cosmos-db-cassandra-go-getting-started
Developing a Go app with Cassandra API using Azure Cosmos DB (gocql
Driver)
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:
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