1 unstable release

0.1.0 Aug 7, 2021

#2577 in Database interfaces

Apache-2.0

160KB
3.5K SLoC

Cassandra Query Language (CQL) parser

Hand crafted Apache Cassandra CQL parser, implemented in Rust.

WARNING: This library is still in very early stage, and APIs and AST will change.

Design goals

The goal of this library is to provide standalone CQL parser that can be used in tools, such as pretty printer, auto completion, schema visualizer, etc.

The design goals are:

  • Minimum dependencies
  • Detailed error reporting
  • WebAssembly compatible
  • Complete and validatable AST
  • Supports both CQL to AST and AST to CQL
  • Parsing multiple statements

Supported CQL versions

Implemented statements

  • SELECT statement
    • SELECT JSON / DISTINCT is not yet implemented
  • INSERT statement
  • UPDATE statement
  • BATCH statement
  • DELETE statement
  • USE statement
  • TRUNCATE statement
  • CREATE KEYSPACE statement
  • CREATE TABLE statement
  • CREATE INDEX statement
  • DROP KEYSPACE statement
  • DROP TABLE statement
  • DROP INDEX statement
  • ALTER TABLE statement
  • ALTER KEYSPACE statement
  • GRANT PERMISSIONS statement
  • REVOKE PERMISSIONS statement
  • LIST PERMISSIONS statement
  • CREATE USER statement (deprecated)
  • ALTER USER statement (deprecatd)
  • DROP USER statement (deprecated)
  • LIST USERS statement (deprecated)
  • CREATE TRIGGER statement
  • DROP TRIGGER statement
  • CREATE TYPE statement
  • ALTER TYPE statement
  • DROP TYPE statement
  • CREATE FUNCTION statement
  • DROP FUNCTION statement
  • CREATE AGGREGATE statement
  • DROP AGGREGATE statement
  • CREATE ROLE statement
  • ALTER ROLE statement
  • DROP ROLE statement
  • LIST ROLES statement
  • GRANT ROLE statement
  • REVOKE ROLE statement
  • CREATE MATERIALIZED VIEW statement
  • DROP MATERIALIZED VIEW statement
  • ALTER MATERIALIZED VIEW statement
  • DESCRIBE statement

TODOs

  • Binding variables are not yet supported.

Dependencies

~0–340KB