Sign inSign up

galliumdata/galliumdata-cqlparser

By galliumdata

Updated over 3 years ago

A microservice to parse Cassandra CQL commands and return information about them.

Image
0

197

galliumdata/galliumdata-cqlparser repository overview

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.

TLDR;

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.

Try it in 1 minute

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:

  • the type of command: select
  • the main object of the command: myks.mytable
  • which columns are being selected: col1, col2
  • which columns are in the where clause: col1

To stop the service: docker stop cqlparser

Input format

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...

Output format

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.

Performance

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.

License

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.

Tag summary

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