I have recently started working with heavy and massive data which also needs to go through regular transaction.
Choosing Cassandra, my data model uses dynamic columns. I understand that with CQL one can alter tables and insert or query columns to get required data.
However, I was using Phantom client with Scala for Cassandra and reading through the documentation I could not find a way to write to or query from dynamic column families.
Given that we use case classes, how can one work with dynamic columns with Cassandra in Scala?
I would suggest that you not dynamically alter table schemas as part of your data model. Cassandra is a row oriented database with partitioning and clustering of rows within partitions. So whatever you are trying to represent by adding or removing columns would be better handled by setting values in a fixed set of columns.
Although Cassandra allows table definitions to be altered to add and remove columns, this would normally be done only when adding a new feature to an application, so you would have an operator manually alter the schema, and then use modified application code to make use of the new schema.
I consider it dangerous for a client application to modify the schema by creating or altering tables since you run the risk of having multiple clients make changes at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With