I am coding in Ruby on Rails running on postgres. Here is some sample SQL that my rails log spits out that I want to format:
SELECT storage_locations.id, items.id AS item_id, storage_locations.identifier, accounts.balance, zones.display_name AS zone_display_name FROM "items" INNER JOIN "item_placements" ON "item_placements"."item_id" = "items"."id" INNER JOIN "accounts" ON "accounts"."identifier" = "item_placements"."id" AND "accounts"."category" = 'AVAILABLE' AND "accounts"."account_type" = 'ITEM_PLACEMENT' INNER JOIN "storage_locations" ON "storage_locations"."id" = "item_placements"."storage_location_id" INNER JOIN "zones" ON "zones"."id" = "storage_locations"."zone_id" WHERE "items"."id" IN (2239) AND (accounts.balance > 0) AND (storage_locations.type = 'BinLocation') LIMIT 1
Upon formatting this, the atom console reports an error:
Error: Parse error on line 2: Unexpected 'DBLSTRING' {stack: (...), message: "Parse error on line 2: Unexpected 'DBLSTRING'"}
Expected result, something like this (from SQLBeautifier package in Sublime Text):
SELECT storage_locations.id,
items.id AS item_id,
storage_locations.identifier,
accounts.balance,
zones.display_name AS zone_display_name
FROM "items"
INNER JOIN "item_placements" ON "item_placements"."item_id" = "items"."id"
INNER JOIN "accounts" ON "accounts"."identifier" = "item_placements"."id"
AND "accounts"."category" = 'AVAILABLE'
AND "accounts"."account_type" = 'ITEM_PLACEMENT'
INNER JOIN "storage_locations" ON "storage_locations"."id" = "item_placements"."storage_location_id"
INNER JOIN "zones" ON "zones"."id" = "storage_locations"."zone_id"
WHERE "items"."id" IN (2241)
AND (accounts.balance > 0)
AND (storage_locations.type = 'BinLocation') LIMIT 1
I am coding in Ruby on Rails running on postgres. Here is some sample SQL that my rails log spits out that I want to format:
Upon formatting this, the atom console reports an error:
Error: Parse error on line 2: Unexpected 'DBLSTRING' {stack: (...), message: "Parse error on line 2: Unexpected 'DBLSTRING'"}
Expected result, something like this (from SQLBeautifier package in Sublime Text):