Code Monkey home page Code Monkey logo

sql-analytic's Introduction

sql-analytic Build Status

SQL Parser for JAVA programming language. sql-analytic is derived from jsqlparser to add SQL Analytic and Spreadsheet functions, row level security and SQL dialect extensions.

Row Level Security

New library supports basic AST transformations to copy tree. Row level security is also implemented as a AST transformation to add security policy, filters. Security rules use extended [PostgreSQL Policy] (http://www.postgresql.org/docs/9.5/static/sql-createpolicy.html) declaration syntax and also supports optional column list to restrict column level access. See [unit test] (./sql-parser/src/test/java/com/github/sql/analytic/transform/policy/PolicySelectTransformTest.java) and [h2 test] (./sql-dialect/sql-dialect-h2/src/test/java/com/github/sql/analytic/dialect/h2/H2SessionTest.java) for sample code.

CREATE POLICY name ON table_name [( column_name [,...] )]
    [ FOR { ALL | SELECT | INSERT | UPDATE | DELETE } ]
    [ TO  role_name [, ...] ]
    [ USING ( using_expression ) ]
    [ WITH CHECK ( check_expression ) ]

sql-analytic's People

Contributors

jaspeen avatar jbaliuka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sql-analytic's Issues

Cannot use another tables in VPD security subqueries

Main security policy table is always applied to any column in the IN clause(despite it is select from another table).

For example USING:

POLICY MY_POLICY ON MY_VIEW FOR SELECT TO role USING ((:param= COLUMN1) OR COLUMN1 IN (SELECT CODE FROM MY_VIEW2 WHERE COLUMN2 = :param))

Now parsed into:
POLICY MY_POLICY ON MY_VIEW A FOR SELECT TO role USING ((:param= A.COLUMN1) OR A.COLUMN1 IN (SELECT A.CODE FROM MY_VIEW2 WHERE COLUMN2 = :param))

Column CODE exist only in MY_VIEW2. I assume it is not neccessary to apply "A" prefix for the subqueries at all, and should be:
POLICY MY_POLICY ON MY_VIEW A FOR SELECT TO role USING ((:param= A.COLUMN1) OR A.COLUMN1 IN (SELECT CODE FROM MY_VIEW2 WHERE COLUMN2 = :param))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.