Comments (3)
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.
@aisbergde How does the parser distinguish between
A=B
(a comparison expression that returns a Boolean) andA=B
(rename columnB as A
?
from moz-sql-parser.
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)
- What would be the right approach to customise the supported grammar here? HOT 1
- parse failed in this kind of query.
- Interactive usage with jupyterlab fails
- Customizing the SQL parser definition HOT 2
- Parse a sql, format the tokens back to sql, gives syntax invalid query HOT 4
- Is there any plans to use latest version of pyparsing? HOT 2
- Cannot recognize literals when using with an operator HOT 2
- parsing issue for oracle window function HOT 2
- offset can not parse when using order by HOT 1
- square brackets are not accepted: "Select [A] from dual"
- (py)parser enters infinite recursion loop with WHERE clause enclosed with parenthesis HOT 2
- DEVELOPMENT MOVED TO klahnakoski HOT 1
- Travis CI free usage ends Dec 3; mozilla repos should switch to other CI platforms
- New failing test cases from a Redshift user (part 1) HOT 5
- Select CASE with NULL is formatted to None in the sql HOT 6
- Update queries is not working HOT 1
- Expecting StringEnd, found "xxx" (at char 388, (line:1, col:389) HOT 2
- Broken at import HOT 9
- Parser not working HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moz-sql-parser.