Hacker GitHub

← All repos

tobymao/sqlglot

View on GitHub ↗ ★ 9,747 Python

Python SQL Parser and Transpiler

36 mentions on Hacker News by 22 people: 9 stories, 27 comments · first 2021-03-19 · latest 2026-06-24

Mentions per year 36 mentions · busiest year 2022 (10)
20082026
  1. …tobymao/sqlglot: Python SQL Parser and Transpiler ; with tests and support for 30+ dialects: https://github.com/tobymao/sqlglot Ibis depends upon sqlglot: https://github.com/tobymao/sqlglot/network/dependents
  2. I'm curious because I have a similar use case for a querying frontend. Did you consider using https://github.com/tobymao/sqlglot ? If so, what was missing to justify writing your own parser?
  3. …is a major driver for your considerations, then I would highly recommend looking at SQLGlot ( https://github.com/tobymao/sqlglot ), a transpiler that makes you (more) independent of query dialects. They already support 30 dialects (big…
  4. Agreed, and it's an amazingly well-maintained GitHub repo: https://github.com/tobymao/sqlglot Big kudos to Toby and the team.
  5. …query graphs; and there's sql-to-ibis: https://github.com/ibis-project/ibis/issues/9529 sqlglot: https://github.com/tobymao/sqlglot : > SQLGlot is a no-dependency SQL parser, transpiler, optimizer, and engine [written in Python] . It can…
  6. Thanks for the suggestion! I am using https://github.com/tobymao/sqlglot , which magically supports most SQL dialects. And yes, support for DuckDB is also in future plans
    comment by xarici_ishler · 2025-04-29 · in Ask HN: What are you working on? (April 2025)
  7. …engine. It's a lot simpler than you may think and it's a great exercise. If using python, sqlglot ( https://github.com/tobymao/sqlglot ) let's you skip all the parsing and it even does some simple optimizations. From the parsed query tree…
    comment by ignoreusernames · 2025-04-27 · in Anatomy of a SQL Engine
  8. You can compose SQL with https://ibis-project.org/tutorials/ibis-for-sql-users , which is using https://github.com/tobymao/sqlglot to parse the SQL under the hood. As an alternative to parsing the SQL yourself, DuckDB's…
  9. Since you're using python, have you looked into sqlglot? I think it has some pretty-print options. https://github.com/tobymao/sqlglot
  10. …sqlglot into being a formatter but it's designed for forgiving dialect conversion, not formatting https://github.com/tobymao/sqlglot
    comment by NortySpock · 2024-09-26 · in SQL Tips and Tricks
  11. …to automate 80% of the translation (assuming it's just a select statement). You might take a look. https://github.com/tobymao/sqlglot
    comment by NortySpock · 2024-06-19 · in Open Source Python ETL
  12. …like COALESCE(5, FALSE) and emulation of system catalogs (pg_catalog, information_schema). [1] https://github.com/tobymao/sqlglot
  13. Recommend checking out https://github.com/tobymao/sqlglot if you are interested in this capability for other SQL dialects Tools like this are helpful for: - Rendering SQL in a consistent way, eg for snapshot testing - Testing SQL business…
  14. SQLGlot brands itself as an sql optimizer also: https://github.com/tobymao/sqlglot?tab=readme-ov-file#sql-op... but I haven't tried that aspect of it personally
  15. Cool! Is this built with sqlglot[1] on the back end? [1] https://github.com/tobymao/sqlglot
    comment by colinmilhaupt · 2023-12-16 · in Show HN: SQL Polyglot
  16. …using frameworks/libraries such as Substrait and SQLGlot to accomplish this. https://substrait.io/ https://github.com/tobymao/sqlglot
    comment by chrisjc · 2023-09-18 · in Relational is more than SQL
  17. …#. ibis-project/ibis-substrait: https://github.com/ibis-project/ibis-substrait #. tobymao/sqlglot: https://github.com/tobymao/sqlglot : > SQLGlot is a no-dependency SQL parser, transpiler, optimizer, and engine. It can be used to format…
  18. Links: SQLGlot - https://news.ycombinator.com/item?id=31981568 , https://github.com/tobymao/sqlglot Presto - https://github.com/prestodb/presto
    comment by deemarklit · 2023-07-14 · in Ask HN: recommending a SQL transpiler
  19. sqlglot might be what you are looking for. https://github.com/tobymao/sqlglot
  20. recursion! https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimiz...
    comment by captaintobs · 2022-12-30 · in I wrote a SQL engine in Python
  21. …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...
    comment by captaintobs · 2022-07-29 · in Semantic Diff for SQL
  22. https://github.com/tobymao/sqlglot
    comment by nerpderp82 · 2022-07-29 · in Semantic Diff for SQL
  23. …identical to Any so I always default to Any. You can see what it took to add this in this commit. https://github.com/tobymao/sqlglot/commit/ab49a3a2964bdff3a3...
  24. …fully supported yet but it's only a couple lines to add support since I already support EXISTS. https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/... https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/...
  25. You should try it out and see. Here are the test cases https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/... I can even parse and optimize TPC-H https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/... . SQLGlot's parser…
  26. …10k lines. The SQL is a monstrous language. Is there any trick that keeps the code simple? [1] https://github.com/tobymao/sqlglot/blob/main/sqlglot/parser.... [2] https://github.com/duckdb/duckdb/blob/master/third_party/lib... [3]…
  27. …here, feel free to ask me any questions! Something that I'm working on is a pure python SQL engine https://github.com/tobymao/sqlglot/blob/main/sqlglot/executo... . It does the whole shebang, parsing, optimizations, logical planning,…