{"id":33134964,"url":"https://github.com/kvokka/pp_sql","last_synced_at":"2025-11-20T04:02:12.592Z","repository":{"id":15369481,"uuid":"78002099","full_name":"kvokka/pp_sql","owner":"kvokka","description":"Rails ActiveRecord SQL queries log beautifier ","archived":false,"fork":false,"pushed_at":"2025-01-18T23:14:48.000Z","size":527,"stargazers_count":274,"open_issues_count":4,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-11-08T19:32:12.541Z","etag":null,"topics":["beautifier","beautify","formatter","rails-log","sql"],"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/kvokka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-04T09:39:38.000Z","updated_at":"2025-10-28T17:28:26.000Z","dependencies_parsed_at":"2025-01-18T22:29:52.031Z","dependency_job_id":null,"html_url":"https://github.com/kvokka/pp_sql","commit_stats":{"total_commits":101,"total_committers":7,"mean_commits":"14.428571428571429","dds":"0.40594059405940597","last_synced_commit":"19c37a1a1068b1c8d1142d668d7c8f17c5056795"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kvokka/pp_sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvokka%2Fpp_sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvokka%2Fpp_sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvokka%2Fpp_sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvokka%2Fpp_sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kvokka","download_url":"https://codeload.github.com/kvokka/pp_sql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvokka%2Fpp_sql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285369043,"owners_count":27159982,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["beautifier","beautify","formatter","rails-log","sql"],"created_at":"2025-11-15T10:00:48.326Z","updated_at":"2025-11-20T04:02:12.582Z","avatar_url":"https://github.com/kvokka.png","language":"Ruby","readme":"# PpSql\n\n[![Version               ][rubygems_badge]][rubygems]\n[![Codacy Badge          ][codacy_badge]][codacy]\n[![Reviewed by Hound     ][hound_badge]][hound]\n[\u003cimg src=\"https://api.gitsponsors.com/api/badge/img?id=78002099\" height=\"20\"\u003e](https://api.gitsponsors.com/api/badge/link?p=J9d+7zEGJS+BQMhX3FZDy2lWmzWp75oJZulj80NsvTrAkDEWcEC5PzkwUCDB/oqWGOfl1rwmFSi7crAJTxB6ww==)\n\nReplace standard `ActiveRecord#to_sql` method with\n[`anbt-sql-formatter`][anbt-sql-formatter-link]\ngem for pretty SQL code output in console. Rails log will be formatted also.\nExample output:\n\n![log][log-img]\n\nOr in console\n\n![console][console-img]\n\n## Require\n\nRuby 3.1+\n\n## Rails\n\nRails 7.0+ (optional), will be injected automatically\n\n## Legacy\n\nYou can use version `~\u003e 0.2` of this gem with Ruby 2.2, 2.3 and/or Rails 4.0, 4.1\n\n## Usage\n\n```\nPost.first.to_sql\n```\n\nfor easy and clean usage with custom string you can use:\n\n```\nclass MyAwesomeDecoratedString \u003c String\n  include PpSql::ToSqlBeautify\nend\n```\n\n## Installation\n\nadd in Gemfile\n\n```\ngem 'pp_sql', group: :development\n```\n\nAnd then execute:\n\n```bash\nbundle\n```\n\n## With other formatters\n\nIf you are `pry` user, or use custom output formatter, use `puts` for output whitespaces,\nlike `puts User.all.to_sql`, or use `User.all.pp_sql`.\n\n## With Rails\n\nIf you do not want to rewrite default `#to_sql` method you may specify\n `PpSql.rewrite_to_sql_method=false` in initializers.\n\nYou can also disable log formatting by specifying `PpSql.add_rails_logger_formatting=false`\nin initializers.\n\n### Add to Application record\n\nI found usefull this trick:\n\n ```\n class ApplicationRecord \u003c ActiveRecord::Base\n  include PpSql::ToSqlBeautify if defined?(Rails::Console)\n\n  self.abstract_class = true\nend\n```\n\n### Supported by\n\n[![jetbrains][jetbrains-img-link]][jetbrains-link]\n\n## Contributing\n\nRunning the tests requires sqlite. To run the tests for different combinations of dependency\nversions, run `bundle exec appraisal install` followed by `bundle exec appraisal rake`.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License][mit-licence-link].\n\n[rubygems_badge]: http://img.shields.io/gem/v/pp_sql.svg\n[rubygems]: https://rubygems.org/gems/pp_sql\n[codacy_badge]: https://app.codacy.com/project/badge/Grade/0394889311ea49529ddea12baac9b699\n[codacy]: https://www.codacy.com/gh/kvokka/pp_sql/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=kvokka/pp_sql\u0026amp;utm_campaign=Badge_Grade\n[hound_badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg\n[hound]: https://houndci.com\n\n[anbt-sql-formatter-link]: https://github.com/sonota88/anbt-sql-formatter\n[mit-licence-link]: http://opensource.org/licenses/MIT\n[jetbrains-link]: https://www.jetbrains.com/?from=pp_sql\n[jetbrains-img-link]: https://raw.githubusercontent.com/kvokka/pp_sql/master/img/jetbrains-variant-3.svg?sanitize=true\n\n[log-img]: https://raw.githubusercontent.com/kvokka/pp_sql/master/img/log.png\n[console-img]: https://raw.githubusercontent.com/kvokka/pp_sql/master/img/console.png\n","funding_links":[],"categories":["Gems"],"sub_categories":["ActiveRecord"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvokka%2Fpp_sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkvokka%2Fpp_sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvokka%2Fpp_sql/lists"}