Giter Club home page Giter Club logo

dkan-sql-parse's People

Contributors

dafeder avatar

Watchers

 avatar  avatar

dkan-sql-parse's Issues

Default resource alias always "t"

Probably not a problem for most cases since most people don't bother to add their own alias and we are not yet supporting joins, but if an alias is provided for a resource, it still defaults "t" no matter what it is. So if we parse:

SELECT numcol FROM tablename x WHERE (numcol > 2)

We get this, where the resource added to the properties elsewhere in the query should be "x" but is always "t".

    "properties": [
        {
            "resource": "t",
            "property": "numcol"
        }
    ],
    "resources": [
        {
            "id": "tablename",
            "alias": "x"
        }
    ],
    "conditions": [
        {
            "resource": "t",
            "property": "numcol",
            "operator": ">",
            "value": 2
        }
    ]
}

(Cutting off some superfluous properties at the end of the JSON there.)

If we always use the alias explicitly it works just fine:

SELECT x.numcol FROM tablename x WHERE (x.numcol > 2)

parses to:

{
    "properties": [
        {
            "resource": "x",
            "property": "numcol"
        }
    ],
    "resources": [
        {
            "id": "tablename",
            "alias": "x"
        }
    ],
    "conditions": [
        {
            "resource": "x",
            "property": "numcol",
            "operator": ">",
            "value": 2
        }
    ]
}

This probably needs a significant refactor because we'd need to set a universal default table alias, and our static functions wouldn't be able to see it. So we'll need to make TreeTranslator a non-static class to fix this.

Write tests

Would be a good idea to write unit tests here before moving into DKAN. They should be portable with the two translate classes.

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.