{"id":13878450,"url":"https://github.com/planetscale/activerecord-sql_commenter","last_synced_at":"2025-12-24T10:29:45.430Z","repository":{"id":37573864,"uuid":"501769267","full_name":"planetscale/activerecord-sql_commenter","owner":"planetscale","description":"Rails query logging compatible with sqlcommenter","archived":false,"fork":false,"pushed_at":"2023-01-13T21:03:41.000Z","size":44,"stargazers_count":42,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-06T04:47:00.791Z","etag":null,"topics":["activerecord","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/planetscale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-09T18:37:37.000Z","updated_at":"2025-05-13T04:12:26.000Z","dependencies_parsed_at":"2023-02-09T17:02:34.242Z","dependency_job_id":null,"html_url":"https://github.com/planetscale/activerecord-sql_commenter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/planetscale/activerecord-sql_commenter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Factiverecord-sql_commenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Factiverecord-sql_commenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Factiverecord-sql_commenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Factiverecord-sql_commenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planetscale","download_url":"https://codeload.github.com/planetscale/activerecord-sql_commenter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Factiverecord-sql_commenter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264710669,"owners_count":23652251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","rails","ruby"],"created_at":"2024-08-06T08:01:50.190Z","updated_at":"2025-12-24T10:29:45.423Z","avatar_url":"https://github.com/planetscale.png","language":"Ruby","readme":"# ActiveRecord SqlCommenter\n[![Gem Version](https://badge.fury.io/rb/activerecord-sql_commenter.svg)](https://badge.fury.io/rb/activerecord-sql_commenter)\n\nTransform your Rail's query comments into [SqlCommenter](https://google.github.io/sqlcommenter/) format.\n\nSqlCommenter is compatible with [PlanetScale's Query Insights](https://planetscale.com/docs/concepts/query-insights).\n\n**Before:**\n```sql\nselect * from users /*application:apibb,controller:database_info,action:show*/\n```\n\n**After:**\n```sql\nselect * from users /*application='apibb',controller='database_info',action='show'*/\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"activerecord-sql_commenter\", require: \"active_record/sql_commenter\"\n```\n\nAnd then execute:\n\n    $ bundle install\n\n## Enabling Query Log Tags\nIn your Rails application, add the following to `config/application.rb`.\n\n```ruby\nconfig.active_record.query_log_tags_enabled = true\n```\n\nYou can define which tags are added to queries.\n\n```ruby\nconfig.active_record.query_log_tags = [ :application, :controller, :action, :job ]\n```\n\nTags can also be cached per request or job execution.\n\n```ruby\nconfig.active_record.cache_query_log_tags = true\n```\n\nTo learn more, see the [full documentation here](https://api.rubyonrails.org/classes/ActiveRecord/QueryLogs.html).\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/planetscale/activerecord-sql_commenter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mscoutermarsh/activerecord-sql_commenter/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the ActiveRecord::SqlCommenter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mscoutermarsh/activerecord-sql_commenter/blob/main/CODE_OF_CONDUCT.md).\n\n## Thanks ❤️\nThank you to @modulitos for the [original implementation contributed to Marginalia](https://github.com/basecamp/marginalia/pull/130).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Factiverecord-sql_commenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanetscale%2Factiverecord-sql_commenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Factiverecord-sql_commenter/lists"}