Code Monkey home page Code Monkey logo

Comments (3)

aisbergde avatar aisbergde commented on June 22, 2024

maybe this should be implemented in sql_parser.py
somthing like this
329

# SQL STATEMENT
selectColumn = Group(
    Group(expr).setName("expression1")("value").setDebugActions(*debug) + Optional(Optional(AS) + ident.copy().setName("column_name1")("name").setDebugActions(*debug)) |
    Group(expr).setName("column_name1")("name").setDebugActions(*debug) + Literal('=') + ident.copy().setName("expression1")("value").setDebugActions(*debug) |
    Literal('*')("value").setDebugActions(*debug)
).setName("column").addParseAction(to_select_call)

I am not a python programmer but a database developer.
But I like the way how this parser is programmed. The idea of this project is great and could help me to transform some manually defined views in a formalized presentation used in a repository, where each column of a view is represented as separate column in columns-table.

from moz-sql-parser.

klahnakoski avatar klahnakoski commented on June 22, 2024

@aisbergde How does the parser distinguish between

  • A=B (a comparison expression that returns a Boolean) and
  • A=B (rename column B as A?

from moz-sql-parser.

aisbergde avatar aisbergde commented on June 22, 2024

I understand that this is not the job of the parser and need to be done outside.
The idea was to get something like SSMS query designer which parses the query and brings it in a unique form. There are also some parsers which can detect the existence of an alias and combining the alias and the whole statement per column it can be transformed.

Some days ago I found a great solution for my goal: https://www.activequerybuilder.com/ has an undocumented web api to parse sql and I am allowed to use it for free for noncommercial purposes. It can't parse all possibilities (for example cross apply) but it parses most features which I need to transform a free text view definition in a unified form used by the www.analyticscreator.com repository to define views.

from moz-sql-parser.

Related Issues (20)

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.