Illustration Image

How can I model a column in Cassandra (Datastax version)?

I'm working with Cassandra (Datastax version) and I have an issue. I want to model a column which is (always) going to change. I can't just create a column family with 1,2,3,4..10 columns because tomorrow probably can change.

I think in collections, but I got to query into these. I need query into this information every second.

Ex: With map:

<'col1':'val1','col2':'val2'> 

I need to query like this:

SELECT * FROM example WHERE 'col1' = 'val1' AND 'col2' = 'val2';

I don't know how to do this and this is extremely necessary for what I want to do.

I read that you can create a column (text) and implement a kind of format:

colum1 = 'val1\x01val2\x01'

But this doesn't resolve what I want to do, because I can't query in these fields (or don't know how)

How can I model something like that?

I can't use a collection because (according to what I read) it is slow.

Become part of our
growing community!
Welcome to Planet Cassandra, a community for Apache Cassandra®! We're a passionate and dedicated group of users, developers, and enthusiasts who are working together to make Cassandra the best it can be. Whether you're just getting started with Cassandra or you're an experienced user, there's a place for you in our community.
A dinosaur
Planet Cassandra is a service for the Apache Cassandra® user community to share with each other. From tutorials and guides, to discussions and updates, we're here to help you get the most out of Cassandra. Connect with us and become part of our growing community today.
© 2009-2023 The Apache Software Foundation under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation. Sponsored by Anant Corporation and Datastax, and Developed by Anant Corporation.

Get Involved with Planet Cassandra!

We believe that the power of the Planet Cassandra community lies in the contributions of its members. Do you have content, articles, videos, or use cases you want to share with the world?