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

golang gocql.NewCluster undefined no field or method

I'm trying to query a test keyspace like: package main import "fmt" import _ "github.com/gocql/gocql" var ( gocql string ) func main() { // connect to the cluster cluster := gocql.NewCluster("127.0.0.1") cluster.Keyspace =…
batflaps
  • 261
  • 3
  • 12
1
vote
2 answers

How to do INSERT IF NOT EXIST in gocql

I've been reading http://godoc.org/github.com/gocql/gocql Yet I don't understand how to do INSERT -- IF NOT EXIST with gocql. It stated that func (*Query) ScanCAS func (q *Query) ScanCAS(dest ...interface{}) (applied bool, err error) ScanCAS…
Joni Atif
  • 61
  • 1
  • 2
  • 6
1
vote
1 answer

How to check non standard object equivalence in golang template

I am outputting a dropdown list using a html template, as follows: {{range .Organisations}} {{end}} I want to indicate that one of the items should be selected by doing an eq comparator. The only…
Jay
  • 19,649
  • 38
  • 121
  • 184
0
votes
1 answer

How do I make the Cassandra gocql retry policy work?

Context: I need to retry a query to read a column until it does not failed by "not found" error. From the documentation: https://pkg.go.dev/github.com/gocql/gocql#Query.RetryPolicy I have code like below, but the retry never works =) : package…
chengdol
  • 129
  • 1
  • 4
0
votes
2 answers

gocql: unable to create session: unable to discover protocol version: tls: first record does not look like a TLS handshake

Help, I am quite new to AstraDB, and while connecting it via goCQL, I got an error that says "Error creating cassandra session: gocql: unable to create session: unable to discover protocol version: dial tcp 34.93.79.117:34567: i/o timeout" I want to…
Ansh Joshi
  • 41
  • 1
  • 7
0
votes
1 answer

How to form dynamic insert query for cassandra golang

I have been trying to create a dynamic query in golang for cassandra using gocql driver ,this is what I tried so far func WriteRecord(session gocql.Session, insertstring string, table string, fields []string, values ...interface{}) error { var…
gANDALF
  • 360
  • 4
  • 21
0
votes
1 answer

Can yugabyteDB used for storage & streaming?

We have GoLang backend service used to: Store data in yugabyte DB using YCL driver Publish the same data to Kafka Step 2 was necessary so that consumers can stream through kafka Can yugabyteDB help stream data, once a new row created in a table?…
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
1 answer

Cassandra cluster: write speed decreased with multiple nodes

I'm testing Cassandra 4.0 with 3 nodes as a POC, all the nodes are using VMs with 8GB RAM and 2 cores. The VMs were created in a way to make sure that they do not share I/O. I started the 1st node, and with 50 threads in the client, it takes 7 sec…
YHC
  • 75
  • 9
0
votes
0 answers

How to bind database record upon successful insert query

ScanCAS() & MapScanCAS() are returning the values of the database row(old), only if the insert statement is not applied on a database table. insertQuery = "INSERT INTO my_table (id, column1, column2) " + "VALUES (?, ?, toTimeStamp(now())) IF NOT…
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
1 answer

Perform multiple inserts per POST request

We have a scenario, where each insert happen per id_2 given id_1, for below schema, in Cassandra: CREATE TABLE IF NOT EXISTS my_table ( id_1 UUID, id_2 UUID, textDetails TEXT, …
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
1 answer

Perform insert query on a Go-routine

Below is the query using gocql driver: insertQueryString = "INSERT INTO my_table (id_1, id_2, textDetails) " + "VALUES (?, ?, ?) IF NOT EXISTS" cassandra.Session.Query(insertQueryString, id1, id2, …
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
1 answer

CQL doesn't allow me to read data in a range

I'm using GOCQL to query for data in a range of timestamps. When I query for data <= a certain time, the code below works fine. When I query for data >= a certain time, it again works fine. When I combine both constraints, the returned slice is…
getb21000
  • 11
  • 2
0
votes
2 answers

Checking the row existence before insertion using Cassandra within a Go application

I am using gocql with my Go application and trying to solve the issue described below. CREATE TABLE IF NOT EXISTS website.users ( id uuid, email_address text, first_name text, last_name text, created_at …
BentCoder
  • 12,257
  • 22
  • 93
  • 165
0
votes
1 answer

Cassandra debug log analysis

I have a cassandra debug.log. It has a lot of SELECT * queries that are not fired by any application. Applications request specific fields in SELECT queries, also the queries seem to have a LIMIT 5000 clause which I am pretty sure is not there in…
guru107
  • 1,053
  • 1
  • 11
  • 28
0
votes
1 answer

gocql: unable to create session: control: unable to connect to initial hosts: Failed to login

cluster := gocql.NewCluster("1.2.3.4") //replace PublicIP with the IP addresses used by your cluster. cluster.Keyspace = "testkeyspace" cluster.Port = 9042 cluster.DisableInitialHostLookup = true cluster.Authenticator =…