Summary
Integrate sqlparser and implement a pipeline that parses SQL files, walks the original source text, and associates preceding -- comments with tables and columns for documentation generation.
Processing flow
For each .sql file:
-
Parse SQL statements with sqlparser.
-
For each CREATE TABLE statement:
- Identify the source text span of the table declaration and its columns.
- Walk upwards from each table/column line in the original source to collect contiguous preceding
-- comments.
- Stop when a non-comment line is reached.
-
Build structured documentation from those collected comment blocks.
Requirements
Tasks
Summary
Integrate
sqlparserand implement a pipeline that parses SQL files, walks the original source text, and associates preceding--comments with tables and columns for documentation generation.Processing flow
For each
.sqlfile:Parse SQL statements with
sqlparser.For each
CREATE TABLEstatement:--comments.Build structured documentation from those collected comment blocks.
Requirements
Use
sqlparseras the SQL frontend (AST + basic validation).Always operate on the original source text to locate comments (don’t rely purely on AST).
Clearly distinguish:
Tasks
sqlparseras a dependency.CREATE TABLE:CREATE TABLEline.