RepositoryRuby
kvokka

kvokka/pp_sql

Rails ActiveRecord SQL queries log beautifier

274sao
11fork
3issue
1lượt xem

✨ Định dạng SQL đẹp trong Rails log và console

Thay thế ActiveRecord#to_sql bằng anbt-sql-formatter, hiển thị SQL đẹp trong console và log.

PpSql là gem Ruby dùng anbt-sql-formatter để làm đẹp câu lệnh SQL từ ActiveRecord. Hỗ trợ Rails 7.1+ (tùy chọn), tự động chèn vào Rails. Yêu cầu Ruby 3.1+.

✨ Điểm nổi bật

  • to_sql được định dạng: Thay thế ActiveRecord#to_sql bằng output đẹp.
  • Rails log đẹp: Định dạng SQL trong Rails log tự động.
  • Cài đặt dễ dàng: Thêm gem 'pp_sql', group: :development vào Gemfile.
  • Tùy chỉnh hành vi: PpSql.rewrite_to_sql_method=false để giữ to_sql gốc.
  • Tắt log formatting: PpSql.add_rails_logger_formatting=false.
  • Hỗ trợ pry/formatter khác: Dùng puts hoặc pp_sql.
  • Thêm vào ApplicationRecord: include PpSql::ToSqlBeautify if defined?(Rails::Console).
  • Hỗ trợ Rails 7.1–8.1, Ruby 3.2–3.4.

💡 Vì sao đáng chú ý

PpSql tập trung vào một bài toán cụ thể: làm đẹp SQL. Không phải ORM mới, không phải query builder — chỉ là wrapper nhẹ quanh anbt-sql-formatter. Phù hợp nhóm phát triển Rails muốn log/console SQL dễ đọc mà không thay đổi workflow.


#Ruby #Rails #SQL #Formatter #OpenSource #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryC++
uncrustify/uncrustify

Code beautifier

3.1k
Nov 30, 2026
RepositoryGo
mvdan/sh

A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt

9.2k
Nov 30, 2026
RepositoryPHP
prettier/plugin-php

Prettier PHP Plugin

1.9k
Nov 17, 2026
RepositoryTeX
cmhughes/latexindent.pl

Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.

1.1k
Nov 29, 2026
RepositoryTypeScript
Unibeautify/unibeautify

One Beautifier to rule them all, One Beautifier to clean them, One Beautifier to bring them all and in the darkness sheen them

554
Nov 25, 2026
RepositoryPython
bitst0rm-pub/Formatter

🧜‍♀️ A Sublime Text plugin to beautify, minify, convert: CSS, SCSS, Sass, HTML, XML, SVG, JS,JavaScript, JSON, GraphQL, Markdown, TypeScript, Vue, Lua, YAML, Go, Perl, PHP, Python, Ruby, Rust, Haskell, Dart, Swift, Crystal, Bash, Shell, SQL, CSV, C, C++, C#, Objective-C, D, Java, Pawn, Julia, Blade, LaTeX, D2, Graphviz, Mermaid, PlantUML, Disasm..

162
Oct 9, 2025
RepositoryShell
cmilr/Git-Beautify-For-MacOS-Terminal

An easy-to-use set of config files to beautify Git in your MacOS or OS X terminal. If you find it hard to parse a jumble of mono-colored type on your command line, this set-up can help you tame the ugly bash beast.

132
Apr 21, 2021
RepositoryHTML
adogecheems/alist-beautification

Alist/OpenList 动态美化方案 | Alist/OpenList Dynamic Beautification Solution

71
Aug 21, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026