| Title: | Format SQL Queries |
|---|---|
| Description: | A convenient interface for formatting 'SQL' queries directly within 'R'. It acts as a wrapper around the 'sql_format' Rust crate. The package allows you to format 'SQL' code with customizable options, including indentation, case formatting, and more, ensuring your 'SQL' queries are clean, readable, and consistent. |
| Authors: | Morgan Durand [aut, cre, cph], Authors of the dependent Rust crates [aut] (see AUTHORS file) |
| Maintainer: | Morgan Durand <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.2.9000 |
| Built: | 2026-05-18 09:52:20 UTC |
| Source: | https://github.com/dataupsurge/sqlformatter |
This function formats an SQL query based on various styling options.
sql_format( query, indent = 2L, uppercase = TRUE, lines_between_queries = 1L, ignore_case_convert = NULL )sql_format( query, indent = 2L, uppercase = TRUE, lines_between_queries = 1L, ignore_case_convert = NULL )
query |
A character string containing the SQL query to format. |
indent |
An integer specifying the number of spaces for indentation (default: 2). |
uppercase |
A logical value indicating whether SQL keywords should be converted to uppercase (default: TRUE). |
lines_between_queries |
An integer specifying the number of blank lines between queries (default: 1). |
ignore_case_convert |
A logical value indicating whether to case conversion (default: NULL). |
A formatted SQL query as a character string.
formatted_query <- sql_format("SELECT * FROM users WHERE id = 1") cat(formatted_query)formatted_query <- sql_format("SELECT * FROM users WHERE id = 1") cat(formatted_query)