On 25.11.2014 10:22, Jens Rantil wrote:

> Anyone who is using, or could recommend, a tool for versioning 
> schemas/migrating in Cassandra?

I've recently written a tool to solve schema migration at our company
which may be useful:

https://github.com/advancedtelematic/cql-migrate

> My list of requirements is: * Support for adding tables.

Yep, this works.

> * Support for versioning of table properties. All our tables are
> to be defaulted to LeveledCompactionStrategy.

My parser/statement splitter doesn't currently recognise the WITH ...
syntax on CREATE tables and ALTER TABLE, but it could easily be added.

Do you need to modify the properties after the table has been created?
If so the changes would need to be expressed as ALTER TABLE statements.

> * Support for adding non-existing columns.

Supported. cql-migrate works by getting the user to express the
upgrade as an ALTER TABLE ... ADD <column> statement.

> * Optional: Support for removing columns. * Optional: Support for 
> removing tables.

Not supported, although it wouldn't be hard to add.

> We are preferably a Java shop, but could potentially integrate 
> something non-Java. I understand I could write a tool that would
> make these decisions using system.schema_columnfamilies and 
> system.schema_columns, but as always reusing a proven tool would
> be preferable.

It is implemented in python, and can be built into a Debian package
for deployment.

Rather than try and fully parse the CQL, cql-migrate works by
splitting a .CQL script into individual statements, executing them in
turn and ignoring errors that relate to tables etc already exiting.
Doing it that way means there is very little chance that the schema
created will differ from what running the same script through cqlsh
would have produced.

Let me know if you need a hand getting going with it.

Cheers,

Phil

Reply via email to