sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Option to print the exact query sent to the database before running it

Open pdenapo opened this issue 1 year ago • 2 comments

What do you want to change?

This feature would be very useful for debugging, and would help to improve the quality of sqlc itself.

I am getting a strange message "incomplete input" (using sqlite in go) from a query with parameters, and it is really difficult to find out what is really happend without his feature.

What database engines need to be changed?

SQLite

What programming language backends need to be changed?

Go

pdenapo avatar Feb 17 '24 21:02 pdenapo

I believe, the respective SQL driver handles the query formation and execution. I often log out the arguments/params of the query before the actual query at the debug level. Maybe parsing the query string and populating the $1 or ? with the respective arguments can form the query beforehand.

achintya-7 avatar Feb 25 '24 18:02 achintya-7

I'm also voting for this feature - could be useful for scripts with --dry-run option.

Akkarine avatar May 01 '25 14:05 Akkarine