Categorygithub.com/maxjustus/treehouse
repository
0.0.0-20240103222049-12a2bdb80451
Repository: https://github.com/maxjustus/treehouse.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

TreeHouse

A utility for parsing, introspecting and manipulating ClickHouse ASTs from the output of explain ast

The main idea here is that everyone tries to reinvent the wheel and make their own ClickHouse query parsers. ClickHouse has functionality built in for outputting queries as ASTs via explain ast #{query/create statement/etc}. This output is much simpler to parse than ClickHouse's SQL syntax and is likely to remain stable as ClickHouse's functionality evolves.

Goals of this project:

  • Provide an abstraction for parsing the output of explain ast with a simple entrypoint for obtaining that result from a ClickHouse client, clickHouse-local or chdb
  • Provide a CLI for AST printing/manipulation that uses either clickhouse-local or chdb - chdb could be neat because it would be embedded.
    • could print AST as JSON, etc.
  • Provide functionality for generating a directed acyclic graph of multiple queries such that any queries which create tables/views/materialized views/functions are parents of queries which depend on them.
    • Should also consider queries that depend on columns added, changed or removed by other statements
      • Could even consider column types, but that might explode out complexity
    • Provide functionality for outputting the DAG as a sorted SQL file for execution against a database.
  • Provide functionality for reformatting queries from their ASTs
  • Provide functionality for diffing ASTs
    • Provide functionality for generating alter table statements based on those diffs.
  • More???