Live data from Hacker News

Open Source SQL Parsers

tokern.io

1–10 of 103 posts

Re: Open Source SQL Parsers

#2
I wrote a similar post recently and not all the libraries overlap interestingly. My post includes sample code for each library and evaluates a few various complexity SELECT queries for correctness.

I may have to write a second post now to include some from this one that I missed!

https://datastation.multiprocess.io/blog/2022-04-11-sql-pars...

Re: Open Source SQL Parsers

#4

Since DuckDB is so portable, it can be a good choice for adding a SQL parser to a new system. Have a look here for an example that uses the parser separately from the execution engine: https://github.com/duckdb/duckdb/blob/master/examples/standa...

Duckdb itself uses a variation of pganalyze's library-ification of postgres's parser so this seems a little indirect.

That said, I've heard the duckdb folks have improved on the postgres parser a bit.

Re: Open Source SQL Parsers

#5
Not 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

#6
I'd be interested to hear people's use cases for parsing SQL. The link talks about exploring sql history, but has anyone else got some interesting uses?

A couple of times where I've needed to parse SQL I would typically write a module for sqlite3 and get it to do the parsing for me. But annoyingly I can't remember _why_ I did this or what I was trying to achieve.

Re: Open Source SQL Parsers

#7
post #5

Not 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...

KQL is a more LINQy language.

Re: Open Source SQL Parsers

#8
post #6

I'd be interested to hear people's use cases for parsing SQL. The link talks about exploring sql history, but has anyone else got some interesting uses? A couple of times where I've needed to parse SQL I would typically write a module for sqlite3 and get it to do the parsing for me. But annoyingly I can't remember _why_ I did this or what I was trying to achieve.

Building a SQL IDE and want to do introspection on queries. Building a SQL frontend for some API or CLI. Building a SQL-aware proxy. Just a few ideas. :)

Re: Open Source SQL Parsers

#9
post #7
post #5

Not 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...

KQL is a more LINQy language.

Looks interesting.

Re: Open Source SQL Parsers

#10
post #6

I'd be interested to hear people's use cases for parsing SQL. The link talks about exploring sql history, but has anyone else got some interesting uses? A couple of times where I've needed to parse SQL I would typically write a module for sqlite3 and get it to do the parsing for me. But annoyingly I can't remember _why_ I did this or what I was trying to achieve.

Building a SQL IDE and want to do introspection on queries. Building a SQL frontend for some API or CLI. Building a SQL-aware proxy. Just a few ideas. :)

Some more: SQL linter, alternate DB implementations (Cockroach DB, TiDB etc), SQL optimisers
Post reply on HN