Skip to content

Conversation

Jeherper
Copy link
Contributor

@Jeherper Jeherper commented Aug 6, 2025

…ed example code

Issue #, if available:
none
Description of changes:
Added example graph and query
Updated example code
Added more description for user to call graphviz visualization functions

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Jeherper Jeherper requested a review from alancai98 August 6, 2025 20:50
README.md Outdated
Comment on lines 29 to 34
The PartiQL Graphviz visualization tool allows you to easily convert PartiQL queries into visual graph representations.
To use this functionality, first create an instance of the AstToGraph class. You can then convert a PartiQL query string directly to a graph using convertQueryToGraph(String query),
or if you already have a parsed AST statement, use convertAstToGraph(Statement statement). Once you have the graph, you can export it in various formats: save it as a DOT file with convertGraphToDot(graph, filePath),
render it as a PNG image using convertDotToPng(graph, filePath, scale), or create an SVG with convertDotToSvg(graph, filePath, scale). The scale parameter allows you to adjust the size of the output image.
This visualization capability is particularly useful for understanding complex query structures, debugging query issues, or educational purposes to demonstrate how PartiQL parses different query constructs.
The generated visual representation clearly shows the hierarchical structure of the query, including SELECT clauses, FROM sources, WHERE conditions, and other query components with their relationships.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all helpful info. Thanks for adding it! Looking at the rendered README file, it all shows up as one paragraph. Can you add some line breaks between the different sections? Also for code references, let's wrap the code in backticks -- https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code.

README.md Outdated
Comment on lines 71 to 73
PartiQLParser parser = PartiQLParser.standard();
PartiQLParser.Result parseResult = parser.parse(query);
Statement statement = parseResult.statements.get(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's revert this added spacing. it doesn't align with the above comment

README.md Outdated

### Example Graph

<img alt="img_1.png = 70x70" height="400" src="img_1.png" width="500"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md Outdated

TODO:
- Implement remaining AST nodes that are currently not handled by the visualization system
- Extend AST visualization to PartiQL plan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: slightly incorrect. the AST visualization would be its own thing from the Plan visualization

Suggested change
- Extend AST visualization to PartiQL plan
- Visualization of the PartiQL plan

README.md Outdated
```

### Example Graph
![img_2.png](img_2.png)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still doesn't quite work since you need to include the image in the repository.

See https://github.com/partiql/partiql-graphviz-java/blob/Readmeupdated/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants