Earlier quoted context omitted.
> So, I am looking for a customizable query parser, planner, and execution engine That looks like an entire DB engine, isn't it? > map the public schema to the private schema sounds like view. It seems like a pretty major project as you describe it.
And if you're set on building an "entire DB engine" then you can just as well go the full mile and go for relational. As opposed to SQL.
Open Source SQL Parsers
61–70 of 103 posts
Re: Open Source SQL Parsers
#62Earlier quoted context omitted.
...and there's more to sql trouble than just troublesome syntax, typical for languages of its generation! 1. Sql is non-modular 2. Non-orthogonal 3. Its parroting of the (beautiful) relational data model is... opinionated at best. The standard is unreadable and not really implementable, one always has to resort to implementation docs. Realistically there are no alternatives, but... sql is no good.
What do you think about using SQL views and functions to make composable, modular SQL code?
2. What SQL functions are you talking about? There are builtins, e.g. avg, sum, and then there are User Defined Functions, which have nothing to do with SQL, mostly just a random external language or one of the non-portable PL/SQL flavours.
Practically speaking, one cannot really write portable SQL outside of a very limited intersection of various dialects. And within this limit users just cannot build a reasonably portable code library.
There is a reason why analysts working with SQL just copy massive query templates again and again and again...
Re: Open Source SQL Parsers
#63Not related to parsers, but i find sql syntax so backwards. Listing columns first Then table Then join Then filter Then group bys Then limit The order of operations are out of whack and makes pipeline ing a little hard. I found this to be closer to LINQ way https://github.com/prql/prql I hope in near future databases will come with better query languages...
I don't mind SQL, really, but I would prefer a query construction API that has the full power of SQL (and more even). At the very least such a thing would not have a SQL injection problem, but also could be used to generate ASTs. Query q = db.from("foo").join("bar").using("id") .select("id","foothing","barthing"); However, the moment you want any non-trivial SQL expression, such an API becomes unwieldy. And yet the n…
Re: Open Source SQL Parsers
#64Not related to parsers, but i find sql syntax so backwards. Listing columns first Then table Then join Then filter Then group bys Then limit The order of operations are out of whack and makes pipeline ing a little hard. I found this to be closer to LINQ way https://github.com/prql/prql I hope in near future databases will come with better query languages...
Nice example of: always begin with the end in mind - first specify what data you want to see and then specify where it should come from. I think it helps you focus on the outcome required, and makes you more efficient deciding how to implement it. I use the same approach for methods in normal code: first decide on the signature of the method, and potentially a unit test to test it, and then think about the implementa…
db.Table.where(x=> x.name == 'abc').skip(10).take(20).groupBy()
This is really hard in sql especially with temporary tables and nesting you need to do as soon as you need to do things a little out of order...
Etc
Re: Open Source SQL Parsers
#65Not related to parsers, but i find sql syntax so backwards. Listing columns first Then table Then join Then filter Then group bys Then limit The order of operations are out of whack and makes pipeline ing a little hard. I found this to be closer to LINQ way https://github.com/prql/prql I hope in near future databases will come with better query languages...
This feels a lot like why Kusto was invented. It's very close to SQL, but written the other way around with the table name first, then the 'where', and finally the columns. https://docs.microsoft.com/en-us/azure/data-explorer/kusto/q...
Re: Open Source SQL Parsers
#66Not related to parsers, but i find sql syntax so backwards. Listing columns first Then table Then join Then filter Then group bys Then limit The order of operations are out of whack and makes pipeline ing a little hard. I found this to be closer to LINQ way https://github.com/prql/prql I hope in near future databases will come with better query languages...
Re: Open Source SQL Parsers
#67Not related to parsers, but i find sql syntax so backwards. Listing columns first Then table Then join Then filter Then group bys Then limit The order of operations are out of whack and makes pipeline ing a little hard. I found this to be closer to LINQ way https://github.com/prql/prql I hope in near future databases will come with better query languages...
I don't mind SQL, really, but I would prefer a query construction API that has the full power of SQL (and more even). At the very least such a thing would not have a SQL injection problem, but also could be used to generate ASTs. Query q = db.from("foo").join("bar").using("id") .select("id","foothing","barthing"); However, the moment you want any non-trivial SQL expression, such an API becomes unwieldy. And yet the n…
Re: Open Source SQL Parsers
#68Earlier quoted context omitted.
Nice example of: always begin with the end in mind - first specify what data you want to see and then specify where it should come from. I think it helps you focus on the outcome required, and makes you more efficient deciding how to implement it. I use the same approach for methods in normal code: first decide on the signature of the method, and potentially a unit test to test it, and then think about the implementa…
I like to think of data transformation a chaining problem. Linq lambda syntax is kind of like that. db.Table.where(x=> x.name == 'abc').skip(10).take(20).groupBy() This is really hard in sql especially with temporary tables and nesting you need to do as soon as you need to do things a little out of order... Etc
Moreover, your very examples illustrate how "thinking SQL" is *NOT* the path to finding proper solutions. .skip() and .take() clearly originate from the world of ranking problems and it drips off of every word that you were thinking of finding a "modern" way to specify [things like] "TOP 10", but those solutions are themselves a fundamentally crippled way to attack the problem.
Re: Open Source SQL Parsers
#69Earlier quoted context omitted.
In my case it's the opposite - SQL is perfectly readable and fits my mental model while the project you linked feels awkward and hard to read. However, it's good to have options, I wonder if prql will get traction. It would be great if it did.
A lot of the time people's mental model will be derived from the language though.
Re: Open Source SQL Parsers
#70Earlier quoted context omitted.
I don't mind SQL, really, but I would prefer a query construction API that has the full power of SQL (and more even). At the very least such a thing would not have a SQL injection problem, but also could be used to generate ASTs. Query q = db.from("foo").join("bar").using("id") .select("id","foothing","barthing"); However, the moment you want any non-trivial SQL expression, such an API becomes unwieldy. And yet the n…
Linq in c# fixes that.