Search code examples
cassandradatastaxdatastax-php-driver

Datastax - Cassandra PHP Driver - Execute CQL script


Using Datastax - Cassandra PHP Driver, I would like execute CQL script file. For example, this script file contain many CREATE KEYSPACE,CREATE TABLE commands.

In cqlsh terminal, I can do the above thing by

cqlsh>source 'script_name.cql';

But, How I can acheive the same through Datastax - Cassandra PHP Driver?

Any help is appreciated.


Solution

  • There is no such API in driver. Same can be achieved through:

    1. If cql is installed on the server where php is being run, then use exec(cqlsh [ other optional options ] -f script_name.cql).
    2. Read the file in PHP code and execute the command.