Description
Update: This proposal has been implemented in this PR: #45081
I’m looking for feedback on a proposal to improve the formatting of auto-injected SQL comments in Rails 7 (via QueryLogs). It seems like the current format for SQL comments isn’t correct, because:
- It isn’t really machine-readable
- It doesn’t adhere to existing standards, like sqlcommenter
For example, auto-commented SQL queries using Marginalia/Rails look like this:
"select id from posts; /*application:Joe's app,controller:my_controller*/"
and I'm proposing a format to use the “sqlcommenter” syntax like so:
"select id from posts; /*application='Joe\\'s app',controller='my_controller'*/"
The latter can be parsed much more easily, and will also automatically report metrics by databases that support the sqlcommenter formatting.
This also feels like a good time to propose a change because it's relatively new functionality, before too many folks develop a dependency on the format.