How to work with dynamic column families in Phantom for Cassandra?

Recently, I started working with heavy and massive data, which should also go through a normal transaction.

Having selected Cassandra, my data model uses dynamic columns. I understand that using CQL you can modify tables and insert or query columns to get the required data.

However, I used the Phantom client with Scala for Cassandra, and after reading the documentation, I could not find a way to write or query from dynamic column families.

Given that we use case classes, how can we work with dynamic columns with Cassandra in Scala?

+6
source share
1 answer

I would suggest that you do not dynamically alter table schemas as part of your data model. Cassandra is a series-oriented database partitioned and clustering strings in partitions. Thus, everything that you are trying to imagine adding or removing columns is best handled by setting values ​​in a fixed set of columns.

Although Cassandra allows you to change the table definitions for adding and removing columns, this is usually done only when adding a new function to the application, so you must manually change the scheme, and then use the modified application code to use the new scheme.

I consider it dangerous for a client application to modify a schema by creating or modifying tables, since you run the risk of multiple clients making changes at the same time.

+6
source

All Articles