Questions tagged [gocql]

GOCQL is the golang driver for connecting to Cassandra.

GOCQL is the Google go language's driver for connecting to Apache Cassandra.

91 questions
1
vote
1 answer

How do I apply read and write consistency in gocql?

I am using https://github.com/gocql/gocql. I want to set the read/write consistency of cassandra. cluster := gocql.NewCluster(hosts...) cluster.Consistency = gocql.ParseConsistency(consistency) If the consistency setting is applied as above, is…
battlecook
  • 471
  • 6
  • 17
1
vote
3 answers

Getting error when inserting a row on Amazon Keyspaces using the GoCQL driver

I created a keyspace in eu-west-3. When I try with the same query in cqlsh it works but with golang doesn't. Someone can help me? cluster := gocql.NewCluster("cassandra.eu-west-3.amazonaws.com:9142") cluster.ConnectTimeout = time.Second *…
nico
  • 11
  • 1
1
vote
2 answers

How do I check if the Session object in GoCQL is connected similar to PING in Redis?

Created a cassandra cluster using gocql library. func CreateCassandraCluster(host string) (*gocql.Session, error) { cluster := gocql.NewCluster(host) cluster.ConnectTimeout = time.Second * 10 cluster.DisableInitialHostLookup = true session, err :=…
Mesc
  • 123
  • 7
1
vote
1 answer

Golang cassandra gocql transaction need a delay time to executed

This block of code does not delete the data, I don't know why. s.Query( "INSERT INTO smth (id, name) VALUES (?,?)", data.ID data.Name ).ScanCAS(nil, nil, nil) s.Query( "DELETE FROM smth WHERE id = ? AND name = ?", …
1
vote
0 answers

How to check cassandra session is active or not?

How to check through cassandra session healthcheck like mysql we have sql.Ping()?
Mesc
  • 123
  • 7
1
vote
1 answer

Scylla gocqlx how to implement pagination similar to a cursor

I'm using Scylla to save parties created by a users. The method below returns a list of parties created by a user. I currently return all parties without allowing pagination, but I'm trying to implement Pagination for the method below but I still…
JonasLevin
  • 1,592
  • 1
  • 20
  • 50
1
vote
1 answer

How do I connect to a Cassandra cluster deployed on AWS with gocql?

I have done a setup of a three node Cassandra cluster. This one is on aws, and the server port are open. The three servers are well connected to each other and work perfectly. I have set authenticator: AllowAllAuthenticator in my cassandra.yaml…
Jesver
  • 83
  • 1
  • 6
1
vote
1 answer

How to convert a Go type to a Scylla/Cassandra type with gocql?

Is there a way to convert a Go type like []string to a set using gocql? Or do I need to make my own mapper for that? I know gocql is able to convert a Go value to a Scylla/Cassandra value with their marshaller but I want to get the type, not…
Sculas
  • 25
  • 2
  • 6
1
vote
1 answer

How to connect Go API to Cassandra DB

I'm using a Go API and I need to connect it to my Cassandra DB on a Google Cloud server. This is my Go connection code: func SetupDBConnection() { cluster := gocql.NewCluster("XX.XXX.XXX.XXX") cluster.Keyspace = "afterstr" …
abrd
  • 63
  • 6
1
vote
1 answer

gocql how to walk through data come from a select query

I have looking for a way to select data from cassandra and load it to an array because I want to processing series data where I need to get data from previous or next indexes. What I've found is an Iterator and all examples in doc make it walk to…
1
vote
1 answer

How to connect to bitnami/cassandra using GoCQL in a Docker Compose multi-container application?

I'm trying to build a simplified example of an app which uses username-and-password authentication to connect to Cassandra. To this end, I've adapted the docker-compose.yml from https://hub.docker.com/r/bitnami/cassandra/ as follows: version:…
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
1
vote
1 answer

How to query cassandra UDT using gocql?

Cassandra table and UDT CREATE TYPE IF NOT EXISTS phone_type( code TEXT, phone TEXT, ); CREATE TABLE IF NOT EXISTS user_by_phone( user_id UUID, phone FROZEN, password TEXT, PRIMARY KEY (phone) ); golang…
Chandu
  • 962
  • 2
  • 16
  • 33
1
vote
2 answers

cassandra - move rows from one table to another under a condition (where)

If I have two tables that are identical in structure, how can I move a set of rows from 1 table to the other while deleting records? I want something similar like that in Cassandra: BEGIN; INSERT INTO persons_table select * from customer_table where…
1
vote
2 answers

unable to create session: control: unable to connect to initial hosts: Invalid Cosmos DB account or key

I have been trying to connect to cosmos cassandra db using gocql. func GetSession(cosmosCassandraContactPoint, cosmosCassandraPort, cosmosCassandraUser, cosmosCassandraPassword string) *gocql.Session { clusterConfig :=…
1
vote
1 answer

Does Cassandra log query attempts that are part of a retry policy?

For example, would these attempts be recorded as part of a trace session in system_traces.sessions or system_traces.events? Edit: The driver I'm using is called gocql
Tantillo
  • 367
  • 1
  • 5