Question

In cassandra how to add images in column family for a row. Below I mentioned a sample table which shows the KEY,Name,Age and Cover_Image. enter image description here

Here we can able to add Name,Age by entering the queries like this

create column family users with comparator=UTF8Type and column_metadata=[ {column_name:Name,validation_class:UTF8Type}, {column_name:Age,validation_class:LongType,index_type:KEYS}];

set users[babu][Name]='Babu Droid';

set users[babu][Age]=23;

Like the above queries, what's the query to add an image (query for both create(also validation_class) and set options)

Était-ce utile?

La solution

For an image you would want to use BytesType for the column validator and simply insert the raw bytes of the image into the column. There won't be a good way to do something like that from the command line interface though. You would need to write some custom code using a client library.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top