ESQL language implementation

ESQL, SQL enhanced with metadata compiling to various relational databases

Лицензия

Лицензия

Группа

Группа

com.vikmad
Идентификатор

Идентификатор

esql
Последняя версия

Последняя версия

0.5.1
Дата

Дата

Тип

Тип

pom.sha512
Описание

Описание

ESQL language implementation
ESQL, SQL enhanced with metadata compiling to various relational databases
Ссылка на сайт

Ссылка на сайт

https://github.com/vikashmadhow/esql
Система контроля версий

Система контроля версий

https://github.com/vikashmadhow/esql

Скачать esql

Имя Файла Размер
esql-0.5.1.pom
esql-0.5.1-sources.jar 432 KB
esql-0.5.1-javadoc.jar 1 MB
Обзор

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.antlr : antlr4 jar RELEASE

runtime (10)

Идентификатор библиотеки Тип Версия
org.apache.commons : commons-lang3 jar 3.9
org.postgresql : postgresql jar 42.2.19
com.microsoft.sqlserver : mssql-jdbc jar 9.2.1.jre11
org.mariadb.jdbc : mariadb-java-client jar 2.7.2
mysql : mysql-connector-java jar 8.0.23
org.hsqldb : hsqldb jar 2.6.0
com.zaxxer : HikariCP jar 4.0.3
org.json : json jar RELEASE
org.yaml : snakeyaml jar RELEASE
com.vikmad : base jar RELEASE

Модули Проекта

Данный проект не имеет модулей.

ESQL

A language similar in form to SQL that includes metadata (as a list of name-expression pairs) which can be attached to tables and columns. The language is transparently translated for execution to the underlying database (Postgresql and MS SQL Server currently).

For example, this creates a table (metadata are between {}):

  create table com.example.S(
    {
      # table metadata (applied to all queries on this table)
      max_a: (max(a) from com.example.S),
      a_gt_b: a > b
    },
    a int {
      # column metadata attached to column a
      m1: b > 5, m2: 10, m3: a != 0
    },
    b int { m1: b < 0 },
    
    # derived columns (whose value are computed instead of stored) are
    # also supported in ESQL and is defined with a `=` between the name
    # of the column and the expression to compute its value. Metadata can
    # also be attached to derived columns
    ########
    c=a + b { label: 'Sum of a and b', m1: a > 5, m2: a + b, m3: b > 5 },
    d=b + c { m1: 10 },
    e int { m1: c },
    
    # ESQL also has a simplified select syntax for select expressions where
    # the `select` keyword is dropped and only a single column is specified.
    # Select expressions must be surrounded by parentheses.
    ########
    f=(max(a) from com.example.S) { m1: min(a) from com.example.S },
    g=(distinct c from com.example.S where d>5) { m1: min(a) from T },
    h int { m1: 5 }
    
    # select expressions can be arbitrarily complex and refer to the columns
    # in the current table as well as columns in other joined tables.
    ########
    i string {
      label: lv.label from lv:LookupValue
                      join  l:Lookup on lv.lookup_id=l._id
                                    and  l.name='City'
                     where lv.code=i
    }
  )

When a table is queried, metadata attached to the table and columns are automatically included in the result, and can be overridden at the query level:

  select x.a, x.b, y.c, 
         z.d {m1: 'test'}, # metadata override: if the z.d already contains a 
                           # metadata attribute m1, its value will be replaced
                           # by 'test'
                            
         # ESQL equivalent of SQL case statement, based on Python conditional expressions: 
         #    <true-expression> if <condition> else <false-expression>
         # The conditional expression associates to the right and can be chained.
         # ESQL also supports two-sided comparison, like Python.      
                         
         'A' if  0 <= x.a < 5  else
         'B' if  5 <= x.a < 10 else
         'C' if 10 <= x.a < 20 else 'D'
    from x:X 
    join y:Y on x.a=y.b 
    left join z:Z on y.c=z.c
   where 5 <= z.s <= 10  

Версии библиотеки

Версия
0.5.1
0.5.0
0.4.3
0.4.1
0.4.0
0.3.9
0.3.8
0.3.7
0.3.6
0.3.5
0.3.4
0.3.1