[HN Gopher] Show HN: SQL Formatter
___________________________________________________________________
Show HN: SQL Formatter
Author : pictur
Score : 6 points
Date : 2023-08-21 20:01 UTC (3 hours ago)
(HTM) web link (normaltool.com)
(TXT) w3m dump (normaltool.com)
| natpalmer1776 wrote:
| Maybe it's just me, but I find the sample input more legible than
| the output.
| bot347851834 wrote:
| I'm of the same opinion. I always wonder why SQL formatters do
| this. Is it because it's easier to diff queries with versioning
| tools? Because to me it's definitely not for legibility. The
| example shown here isn't even that bad compared to what I see
| regularly. We've got quiet a few queries longer than 100 sanely
| written lines running in BigQuery, sometimes I missclick the
| "format query" option and it always makes me wonder who the
| hell enjoys scrolling so much because suddenly the line count
| increases by an order or magnitude or more and the lines aren't
| much longer than 20 or so characters.
| natpalmer1776 wrote:
| I think formatters are generally written by people who value
| consistency above other criteria, as many of the general
| conventions used when handwriting queries tend to break down
| as the complexity of the query increases. With these
| formatters I imagine complex queries would render in a more
| 'consistent' manner.
| DougMerritt wrote:
| Yes, and that tends to be the case with formatters for
| programming languages in general.
| adamrezich wrote:
| I agree that the example input is more readable than the
| output, but I also think it's a bad example of messy SQL.
| sometimes it's nice to use a tool like this to break down a
| complex, appended-to-by-multiple-authors-over-the-years query
| just so you can understand the logic (and sometimes find
| unexpected logic bugs that nobody noticed before). at least,
| that's been my experience.
| [deleted]
___________________________________________________________________
(page generated 2023-08-21 23:01 UTC)