parser icon indicating copy to clipboard operation
parser copied to clipboard

Parse statements one at a time from a file

Open kyleconroy opened this issue 5 years ago • 2 comments

Feature Request

Hello from the sqlc project! sqlc is a SQL compiler; it parses SQL and generates type-safe Go code. For MySQL support, we currently use the vitess.io/vitess/go/vt/sqlparser package. However, their parser, by design, is not 100% MySQL-compatible.

A few months ago, @shenli mentioned that that the pingcap parser would be a great fit for our project. After looking it over, I agree! However, it's currently missing one required feature: incremental parsing.

Is your feature request related to a problem? Please describe: The sqlparser package allows us to take a string containing multiple queries and parse them one at a time. You can see it in action here. This allows us to report multiple SQL syntax errors within the same file.

Describe the feature you'd like: Would it be possible to add a similar API to this parser? I'm happy to help implement said API, but I wanted to check first to make sure this is something you'd be interested in offering.

kyleconroy avatar May 27 '20 20:05 kyleconroy

Would it be possible to add a similar API to this parser?

@kyleconroy Yes, any contribution that improves the usability is welcomed!

tangenta avatar May 28 '20 12:05 tangenta

I would also love to see this. I have a large (10 GB) SQL dump and I would like to parse it, statement by statement.

mitar avatar Feb 03 '22 00:02 mitar