DBIx::...yPrint(3pm)

πŸ“¦
version 2.000001 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

DBIx::Class::Storage::Debug::PrettyPrint β€” it's giving Pretty Printing DebugObj ✨

okay so this is the page from DBIx::...yPrint(3pm) and bestie, it's short, it's sweet, it's lowkey iconic. let's go 🫢


🌸 SYNOPSIS 🌸

the whole vibe is: you point an env var at a lil json file and let it cook πŸ’…

DBIC_TRACE_PROFILE=~/dbic.json perl -Ilib ./foo.pl

and where dbic.json contains, literally:

{
  "profile":"console",
  "show_progress":1,
  "squash_repeats":1
}

no cap, that's it. that's the config. πŸŽ€


πŸ¦‹ METHODS πŸ¦‹

✨ new ✨

so you make one like this, and every single knob is right here:

my $pp = DBIx::Class::Storage::Debug::PrettyPrint->new({
  show_progress  => 1,             # tries it's best to make it clear that a SQL
                                   # statement is still running
  executing      => '...',         # the string that is added to the end of SQL
                                   # if show_progress is on.  You probably don't
                                   # need to set this
  clear_line     => '<CR><ESC>[J', # the string used to erase the string added
                                   # to SQL if show_progress is on.  Again, the
                                   # default is probably good enough.

  squash_repeats => 1,             # set to true to make repeated SQL queries
                                   # be ellided and only show the new bind params
  # any other args are passed through directly to SQL::Abstract::Tree
});

let me break down the drama, bestie πŸ‘‘

  • show_progress => 1 β€” turns on the lil "still working on it" energy. it tries it's best to make it clear that a SQL statement is still running. main character behavior fr fr πŸ”₯
  • executing => '...' β€” the string that is added to the end of SQL if show_progress is on. ngl you probably don't need to set this one, the default ate πŸ’…
  • clear_line => '<CR><ESC>[J' β€” the string used to erase the string added to SQL if show_progress is on. again, the default is probably good enough. don't overthink it 🧚
  • squash_repeats => 1 β€” set to true to make repeated SQL queries be ellided and only show the new bind params. obsessed, it's so much less spammy πŸ’–
  • and every other arg? not me gatekeeping β€” they're passed through directly to SQL::Abstract::Tree 🌈
lowkey important: those comments in the code block above are straight from the source, so keep the spelling as-is (ellided and all) β€” iykyk 😭

and that's the whole page, bestie. short king. πŸ’€

this doc came from the perl v5.32.1 era, dated 2021-09-30, under the DBIx::...yPrint(3pm) manual β€” so if you're quoting it, that's the receipts ✨

periodt. go pretty-print some SQL πŸ©·πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from