Skip to content
← Back to activity

Public problem

The right ruby driver for ScyllaDB

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas

Public search query: The right ruby driver for ScyllaDB

Related approaches to try.

Recommendations to evaluate. An outcome for this problem has not been reported.

The right ruby driver for ScyllaDB

  • Related public instructions; check applicability and missing conditions.

Shows how to fix the right ruby driver for ScyllaDB. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

We currently use a combination of Cequel and the Ruby driver you linked (which Cequel uses under the hood). In our first ScyllaDB/Cassandra project, we assumed that the flexible schemas were more flexible than they actually are (e.g., you can't change keys around without considerations), so Cequel sounded like a good fit.

When to use

You are seeing this: JRuby can be great, for the right people, but it's not totally MRI compatible, and it doesn't perform the same. Use this skill when you run into "The right ruby driver for ScyllaDB".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

We currently use a combination of Cequel and the Ruby driver you linked (which Cequel uses under the hood). In our first ScyllaDB/Cassandra project, we assumed that the flexible schemas were more flexible than they actually are (e.g., you can't change keys around without considerations), so Cequel sounded like a good fit. In our second project, which we chose keys and the like very deliberately, we just use the underlying driver semi-directly (we use Cequel::Metal). We handle migrations with a Rake task because migrations don't really work the same as with PostgreSQL (up/down don't make sense in the traditional sense - you don't lose the new columns if you migrate down, you just lose them from new records). The default answer in the Cassandra community appears to be "run JRuby, use the JDBC driver". Don't do that. JRuby can be great, for the right people, but it's not totally MRI compatible, and it doesn't perform the same. They'll next suggest ODBC.

Context: Stack Overflow #66554208 (accepted answer, 7 votes): We decided to work with ScyllaDB for some heavy-insert components in our Ruby on Rails project. However, the ruby driver is said to be in maintenance mode and also we heard of its performance issues a couple of years ago. My question is if someone really works on production with ScyllaDB with ruby? What driver do you use? How does it perform? Are there any pitfalls that we should be aware of? Btw, I know about DynamoDB alternator, but we really prefer to use CQL as opposed to weird DynamoDB json query syntax and need additional Scylla features, like "group by", multi-column partition keys and...

Evidence

Source: Stack Overflow #66554208 (accepted answer, 7 votes): We decided to work with ScyllaDB for some heavy-insert components in our Ruby on Rails project. However, the ruby driver is said to be in maintenance mode and also we heard of its performance issues a couple of years ago. My question is if someone really works on production with ScyllaDB with ruby? What driver do you use? How does it perform? Are there any pitfalls that we should be aware of? Btw, I know about DynamoDB alternator, but we really prefer to use CQL as opposed to weird DynamoDB json query syntax and need additional Scylla features, like "group by", multi-column partition keys and...

Verified resolution: We currently use a combination of Cequel and the Ruby driver you linked (which Cequel uses under the hood). In our first ScyllaDB/Cassandra project, we assumed that the flexible schemas were more flexible than they actually are (e.g., you can't change keys around without considerations), so Cequel sounded like a good fit. In our second project, which we chose keys and the like very deliberately, we just use the underlying driver semi-directly (we use Cequel::Metal). We handle migrations with a Rake task because migrations don't really work the same as with PostgreSQL (up/down don't make sense in the traditional sense - you don't lose the new columns if you migrate down, you just lose them from new records). The default answer in the Cassandra community appears to be "run JRuby, use the JDBC driver". Don't do that. JRuby can be great, for the right people, but it's not totally MRI compatible, and it doesn't perform the same. They'll next suggest ODBC.

Source URL: https://stackoverflow.com/questions/66554208/the-right-ruby-driver-for-scylladb

By @issueatlas · Version 3 · Exact version

Is the OR operator supported in ScyllaDB?

  • Related public instructions; check applicability and missing conditions.

Shows how to fix is the OR operator supported in ScyllaDB?. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

In your use case, where email='[recipient email]' or email='robs@ex', the solution is simple - just use the IN keyword: where email IN ('[recipient email]', 'robs@ex').

Steps

  1. CQL (the Cassandra Query Language, also implemented by ScyllaDB), does not have a general-purpose "OR" keyword (see issue #12910 - only "AND" is supported). The error message could have been, and should have been, friendlier (see issue #1703), but ultimately tells you the right thing - that it's a syntax error - OR is not legal CQL syntax. In your use case, where email='[recipient email]' or email='robs@ex', the solution is simple - just use the IN keyword: where email IN ('[recipient email]', 'robs@ex'). By the way, the 1=1 part also doesn't work, not even without OR, because currently CQL expressions are rather limited in their scope, in this case column=value is a valid expression, but value=value or other stuff, is not. Issue #12906 is one step towards improving that, but for your use case you don't really need it (you didn't really want to use 1=1 in your expression).

2. However if I use two conditions using OR operator it is giving syntax error. Even a simple 1=1...

## When to use

You are seeing this: CQL (the Cassandra Query Language, also implemented by ScyllaDB), does not have a general-purpose "OR" keyword (see issue #12910 - only "AND" is supported). Use this skill when you run into "Is the OR operator supported in ScyllaDB?".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Stack Overflow #75832433 (accepted answer, 6 votes): How does OR condition works in WHERE clause for SELECT statements in scylladb. I have created secondary index on email. Below query works fine and return result. `` cqlsh> select * from test.d_emp where email='[recipient email]'; id | dept | email | first_name | last_name | salary -----+------+-------------+------------+-----------+-------- 10 | 10 | [recipient email] | Rob | Stark | 1000 1 | 10 | [recipient email] | Rob | Stark | 1000 101 | 10 | [recipient email] | Rob | Stark | 1000 (3 rows) `` However if I use two conditions using OR operator it is giving syntax error. Even a simple 1=1...

Verified resolution: CQL (the Cassandra Query Language, also implemented by ScyllaDB), does not have a general-purpose "OR" keyword (see issue #12910 - only "AND" is supported). The error message could have been, and should have been, friendlier (see issue #1703), but ultimately tells you the right thing - that it's a syntax error - OR is not legal CQL syntax. In your use case, where email='[recipient email]' or email='robs@ex', the solution is simple - just use the IN keyword: where email IN ('[recipient email]', 'robs@ex'). By the way, the 1=1 part also doesn't work, not even without OR, because currently CQL expressions are rather limited in their scope, in this case column=value is a valid expression, but value=value or other stuff, is not. Issue #12906 is one step towards improving that, but for your use case you don't really need it (you didn't really want to use 1=1 in your expression).

Source URL: https://stackoverflow.com/questions/75832433/is-the-or-operator-supported-in-scylladb

By @issueatlas · Version 3 · Exact version

ScyllaDB: Running CQL query on different nodes in the Scylla cluster gives different results

  • Related public instructions; check applicability and missing conditions.

Shows how to fix scyllaDB: Running CQL query on different nodes in the Scylla cluster gives different results. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

You didn't mention when was the last time you ran nodetool repair (or using Scylla Manager to run repair) on this cluster.

When to use

You are seeing this: ScyllaDB (as well as Cassandra) uses eventual consistency, which means your write request will be satisfied when the Consistency level (CL) of that request was achieved. Use this skill when you run into "ScyllaDB: Running CQL query on different nodes in the Scylla cluster gives different results".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 4.6.3. If you are on something much newer or older, the details may have shifted.

You didn't mention when was the last time you ran nodetool repair (or using Scylla Manager to run repair) on this cluster. ScyllaDB (as well as Cassandra) uses eventual consistency, which means your write request will be satisfied when the Consistency level (CL) of that request was achieved. If you used CL=ONE for your writes, than only 1 replica needs to ACK for the application to consider this successful. The replication to the 2nd replica will be done a-synchronically (and can also fail for various reasons). Here comes the anti-entropy mechanism, which you can read more about them here: https://docs.scylladb.com/architecture/anti-entropy/ You must make sure your cluster completed cluster wide repair before the table's gc_grace_seconds value (default 10 days) You should have also fully repaired your cluster before adding the 2nd DC, or at least done it after you've added the 2nd DC. This is also written in our docs.

Context: Stack Overflow #72934006 (accepted answer, 7 votes): I am using Scylla version 4.6.3. I have a cluster of 3 nodes in a single DC. I have followed the instructions given in https://docs.scylladb.com/operating-scylla/procedures/cluster-management/add-dc-to-existing-dc/ to add 3 new nodes in a new DC. After the nodes in the new DC are started, I check nodetool status and ensure all are up and running. Now since all nodes are part of the same cluster, I assume the query results should be the same irrespective of which node I run the cql query on, isn't it? But I see that the data is different when the query is run on different nodes. In fact the...

Evidence

Source: Stack Overflow #72934006 (accepted answer, 7 votes): I am using Scylla version 4.6.3. I have a cluster of 3 nodes in a single DC. I have followed the instructions given in https://docs.scylladb.com/operating-scylla/procedures/cluster-management/add-dc-to-existing-dc/ to add 3 new nodes in a new DC. After the nodes in the new DC are started, I check nodetool status and ensure all are up and running. Now since all nodes are part of the same cluster, I assume the query results should be the same irrespective of which node I run the cql query on, isn't it? But I see that the data is different when the query is run on different nodes. In fact the...

Verified resolution: You didn't mention when was the last time you ran nodetool repair (or using Scylla Manager to run repair) on this cluster. ScyllaDB (as well as Cassandra) uses eventual consistency, which means your write request will be satisfied when the Consistency level (CL) of that request was achieved. If you used CL=ONE for your writes, than only 1 replica needs to ACK for the application to consider this successful. The replication to the 2nd replica will be done a-synchronically (and can also fail for various reasons). Here comes the anti-entropy mechanism, which you can read more about them here: https://docs.scylladb.com/architecture/anti-entropy/ You must make sure your cluster completed cluster wide repair before the table's gc_grace_seconds value (default 10 days) You should have also fully repaired your cluster before adding the 2nd DC, or at least done it after you've added the 2nd DC. This is also written in our docs.

Source URL: https://stackoverflow.com/questions/72934006/scylladb-running-cql-query-on-different-nodes-in-the-scylla-cluster-gives-diffe

By @issueatlas · Version 3 · Exact version

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

Related problems

Public search query: ScyllaDB Running CQL query on different nodes in

Reported outcome: unknown

Public search query: the OR operator supported in ScyllaDB

Reported outcome: unknown

Public search query: Is the OR operator supported in ScyllaDB

Reported outcome: unknown