2

I'm using phantom dsl library to perform scylladb operations. Now I was trying to combine 'where' clause with 'or' clause but its not working.

db.object
.select
.where(_.businessEmail eqs "abc@gmail.com")
.or(_.homeEmail eqs "abc@gmail.com")
.or(_.additionalEmail eqs "abc@gmail.com")
.fetch()

Error:

value or is not a member of com.outworkers.phantom.builder.query.SelectQuery[com.outworkers.phantom.builder.Unlimited,com.outworkers.phantom.builder.Unordered,com.outworkers.phantom.builder.Unspecified,com.outworkers.phantom.builder.Chainned,shapeless.HNil]
possible cause: maybe a semicolon is missing before `value or`?
      .or(_.homeEmail eqs "abc@gmail.com")

How can I use 'or' clause?

Zaryab Ali
  • 161
  • 7

1 Answers1

1

The where method from SelectQuery returns again a SelectQuery, which allows you to invoke and method that will be translated as an AND operator in the WHERE clause. If you look at the methods of SelectQuery, you will not find any of them that lets use the OR operator in the WHERE clause because OR operator is supported in ScyllaDB.

In the official docs of ScyllaDB, you will also see that a select statement doesn't have an OR operator and the same happens for a select statement in CQL.

There is an open issue in the repo of ScyllaDB to Add basic support for the logical OR operator in CQL. Not sure if that will be added to phantom knowing that the last commit was on Aug 16, 2021.

Gastón Schabas
  • 2,153
  • 1
  • 10
  • 17