rohany/vault

vault: implement a mini-DSL for querying

rohany opened this issue · 2 comments

Ideally users would not have to write the combination of SQLite json functions + raw SQL in order to query vault. Perhaps a simple DSL that provides some more natural handling of binary operations among JSON would be better.

Relates to #5

It seems like this will be needed. It's not reasonable to require knowledge of SQL (and SQLite), so it would be tricky for people to write their queries unless there is a simpler language.

This query language could look like the following:

term :=  number | float | string | null | bool
binop := * | + | - | / | OR | AND | 
expr := term
  | expr binop expr
  | func_name '(' expr ')'
  | meta '[' string ']' # This access to meta allows access into the JSON metadata for each row.
  | expr ':' ':' type_name

This simple expression language could be directly translated into SQLite syntax with additional type casts to avoid extra overhead of learning SQLite and adding the extra SQLite JSON syntax.

Some options for implementing the parser: