A microservice to parse Cassandra CQL commands and return information about them.
199
A microservice that parses Cassandra CQL commands and returns information about those commands - full documentation.
This is useful when you need to control which CQL commands to let through, and which to reject, or just to know what kind of command a piece of CQL is.
If you send this microservice a CQL command, such as:
select col1, col2 from myKs.myTable where col3 = 1 and col4 = 'foo'
it will respond with information about this command:
{
"type":"select",
"keyspace":"myks",
"target":"mytable",
"columns":["col1","col2"],
"whereColumns":["col3","col4"],
"operators":["=","="],
"parameters":["1","'foo'"]
}
This allows you to to determine what the command does and what objects it references.
Start the service:
docker run -d --rm --name cqlparser -p 8094:8099 galliumdata/galliumdata-cqlparser:1.0.0-18
Send a command with curl:
curl -d 'select col1, col2 from myKs.myTable where col1 = 1' http://localhost:8094
Or send a command with wget:
wget -nv -O - --post-data 'select col1, col2 from myKs.myTable where col1 = 1' localhost:8094
You will get the response:
{"keyspace":"myks","operators":["="],"columns":["col1","col2"],"type":"select","whereColumns":["col1"],"parameters":["1"],"target":"mytable"}
which tells you:
selectmyks.mytablecol1, col2col1To stop the service: docker stop cqlparser
The request can be either a raw CQL command, or a JSON object with a "cql" attribute containing the command, e.g.:
{"cql": "select col1, col2 from myKs.myTable where col1 = 1"}
This microservice is built using Cassandra's own parser, so any single valid CQL command is accepted, including comments, blank lines, semicolons, etc...
The output will be a JSON document whose format depends on the type of command. See the Gallium Data documentation for details.
If no keyspace is specified in the CQL command, the keyspace attribute will not be present in the response.
Cassandra converts most names to lowercase, unless they are enclosed in double quotes.
This service can typically process many thousands of CQL statements per second on a small server, though of course that will depend on the complexity of the CQL statements.
This service is freely available to end users, but you may not redistribute it.
If you are an OEM or VAR, please contact Gallium Data ([email protected]) and we'll be happy to discuss a licensing deal that can be mutually advantageous.
Content type
Image
Digest
sha256:65b3159db…
Size
412.1 MB
Last updated
over 3 years ago
docker pull galliumdata/galliumdata-cqlparser:1.0.0-18