Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1011 Bytes

File metadata and controls

26 lines (19 loc) · 1011 Bytes
title Query ASTs

An AST (Abstract Syntax Tree) is a representation of a query that is used internally by Zero. It is not meant to be human readable, but it sometimes shows up in logs and other places.

If you need to read one of these, save the AST to a json file. Then run the following command:

cat ast.json | npx ast-to-zql

The returned ZQL query will be using server names, rather than client names, to identify columns and tables. If you provide the schema file as an option you will get mapped back to client names:

cat ast.json | npx ast-to-zql --schema schema.ts

This comes into play if, in your schema.ts, you use the from feature to have different names on the client than your backend DB.

The `ast-to-zql` process is a de-compilation of sorts. Given that, the ZQL string you get back will not be identical to the one you wrote in your application. Regardless, the queries will be semantically equivalent.