I am looking for a PHP Client for Cassandra that supports CompositeType and also creation and modification of ColumnFamilies/Keyspace (schema). Haven't found any that support CompositeType.
Please help. Any workaround to circumvent this issue?
Thank you.
Update:
As suggested by Tamil I am using the following statement to create the column family in cassandra-cli .
CREATE COLUMN FAMILY User
with comparator = 'CompositeType(UTF8Type,UTF8Type,UTF8Type)'
and key_validation_class = 'UTF8Type'
and default_validation_class = 'UTF8Type';
Now using pycassa I am using the following update statement to insert row.
UPDATE User set
'meta:fullname:none' = 'Praveen Baratam'
where
KEY = 'praveen';
UPDATE User set
'meta:using:none' = 'cassandra'
where
KEY = 'praveen';
UPDATE User set
'meta:location:none' = 'India'
where
KEY = 'praveen';
Subsequently I am doing a range-slice query using the following statements.
SELECT 'meta'..'zeta' from User where KEY = 'praveen';
SELECT 'meta:a'..'meta:z' from User where KEY = 'praveen';
Thanks a lot to Tamil for this work-around till CQL supports CompositeType in Cassandra 1.1.
@Praveen, You can use phpcassa & cql to work around with composite types. Although either phpcassa or cql doesn't support composite types it works for me.
Ex:
$servers = array('127.0.0.1:9160');
$pool = new ConnectionPool("Stats",$servers);
$raw = $pool->get();
$rows = $raw->client->execute_cql_query("SELECT 'a:b' from TestColumnFamily WHERE KEY='xxx:1'", cassandra_Compression::NONE);
But you have to sanitize the content returned because this might hexstring.
Check out this if you have problems using phpcassa cql
The above answer is outdated PHPCassa 1.0.a.1 has a full support for composites check out this blog post
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.