{"id":43998726,"url":"https://github.com/mdesantis/sql_formatter_web_interface","last_synced_at":"2026-02-07T12:04:45.706Z","repository":{"id":3145530,"uuid":"4174939","full_name":"mdesantis/sql_formatter_web_interface","owner":"mdesantis","description":"A library for online SQL formatting","archived":false,"fork":false,"pushed_at":"2017-12-24T19:38:26.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-05T03:04:02.434Z","etag":null,"topics":[],"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/mdesantis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-29T14:40:49.000Z","updated_at":"2017-12-24T18:31:16.000Z","dependencies_parsed_at":"2022-08-19T11:41:36.979Z","dependency_job_id":null,"html_url":"https://github.com/mdesantis/sql_formatter_web_interface","commit_stats":null,"previous_names":["prognommers/sql_formatter_web_interface"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mdesantis/sql_formatter_web_interface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fsql_formatter_web_interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fsql_formatter_web_interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fsql_formatter_web_interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fsql_formatter_web_interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdesantis","download_url":"https://codeload.github.com/mdesantis/sql_formatter_web_interface/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fsql_formatter_web_interface/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29194015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-07T12:04:45.432Z","updated_at":"2026-02-07T12:04:45.700Z","avatar_url":"https://github.com/mdesantis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SqlFormatterWebInterface\r\n\r\n## Installation\r\n\r\n```ruby\r\ngem install sql_formatter_web_interface\r\n```\r\n\r\nIn your Gemfile:\r\n\r\n```ruby\r\ngem 'sql_formatter_web_interface'\r\n```\r\n\r\nOr, if you want to use `String#to_formatted_sql`:\r\n\r\n```ruby\r\ngem 'sql_formatter_web_interface', require: 'sql_formatter_web_interface/to_formatted_sql'\r\n```\r\n\r\n## Description\r\nThis library lets you write this:\r\n\r\n```ruby\r\nsql = \u003c\u003c-SQL\r\n         select user_id, count(*) as how_many from bboard where\r\n         not exists (select 1 from bboard_authorized_maintainers bam\r\n         where bam.user_id = bboard.user_id) and posting_time + 60 \u003e sysdate\r\n         group by user_id order by how_many desc;\r\n         SQL\r\nSqlFormatterWebInterface.new(sql).format #=\u003e\r\n# SELECT user_id,\r\n#        count(*) AS how_many\r\n# FROM bboard\r\n# WHERE NOT EXISTS\r\n#     (SELECT 1\r\n#      FROM bboard_authorized_maintainers bam\r\n#      WHERE bam.user_id = bboard.user_id)\r\n#   AND posting_time + 60 \u003e sysdate\r\n# GROUP BY user_id\r\n# ORDER BY how_many DESC;\r\n```\r\n\r\nor this:\r\n\r\n```ruby\r\nsql = \u003c\u003c-SQL\r\n         insert into customer (id, name) values (1, 'John');\r\n         insert into customer (id, name) values (2, 'Jack');\r\n         insert into customer (id, name) values (3, 'Jane');\r\n         insert into customer (id, name) values (4, 'Jim');\r\n         insert into customer (id, name) values (5, 'Jerry');\r\n         insert into customer (id, name) values (1, 'Joe');\r\n         SQL\r\nSqlFormatterWebInterface.new(sql).format #=\u003e\r\n# INSERT INTO customer (id, name)\r\n# VALUES (1,\r\n#         'John');\r\n#\r\n# INSERT INTO customer (id, name)\r\n# VALUES (2,\r\n#         'Jack');\r\n#\r\n# INSERT INTO customer (id, name)\r\n# VALUES (3,\r\n#         'Jane');\r\n#\r\n# INSERT INTO customer (id, name)\r\n# VALUES (4,\r\n#         'Jim');\r\n#\r\n# INSERT INTO customer (id, name)\r\n# VALUES (5,\r\n#         'Jerry');\r\n#\r\n# INSERT INTO customer (id, name)\r\n# VALUES (1,\r\n#         'Joe');\r\n```\r\n\r\nor even this:\r\n\r\n```ruby\r\nrequire 'sql_formatter_web_interface/to_formatted_sql'\r\n'select * from foo join bar on val1 = val2 where id = 123;'.to_formatted_sql(keyword_case: 'capitalize') #=\u003e\r\n# Select *\r\n# From foo\r\n# Join bar On val1 = val2\r\n# Where id = 123;\r\n```\r\n\r\nFormatting happens making a request to an online SQL formatting service (https://sqlformat.org/api/ is the only supported at the moment).\r\n\r\n## Usage\r\n\r\nYou can use `SqlFormatterWebInterface::format(sql, options)` or either `String#to_formatted_sql(options)`, where `options` is an hash with the options supported by the web service (see https://sqlformat.org/api/)\r\n\r\n## License\r\nMIT (see [LICENSE](LICENSE))\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdesantis%2Fsql_formatter_web_interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdesantis%2Fsql_formatter_web_interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdesantis%2Fsql_formatter_web_interface/lists"}