Hacker News new | ask | show | jobs
by chrisjc 1421 days ago
Very nice/interesting.

Somewhat related question and apologies if this is already stated in the documentation (it's rather dense and I haven't had the time to read through it completely)...

Can you use sqlglot to create custom DDL dialects that have custom first class objects? For instance, if I want to build a custom SQL/DDL/DML dialect that had a new kind of object such as a "pipe", "kitchensink", etc, would sqlglot be a good tool to use?

I've tried playing around with Apache Calcite, but it lost me pretty quickly since the examples to customize/extend DDLs were quite lacking in my opinion.

1 comments

Yes. SQLGlot is very customizable and you can pretty much override everything. It kind of needs to be flexible because even common sql dialects vary greatly.

Here's an example of how we use SQLGlot to output raw Python code directly from SQL.

https://github.com/tobymao/sqlglot/blob/main/sqlglot/executo...

Very nice, and exactly along the lines of what I was thinking... I want to be able to create a custom SQL dialect that can output some code.

Thanks very much, looking forward to spending some time reading through all of this!