
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
)
A formatted SQL query as a character string.
A character string containing the SQL query to format.
An integer specifying the number of spaces for indentation (default: 2).
A logical value indicating whether SQL keywords should be converted to uppercase (default: TRUE).
An integer specifying the number of blank lines between queries (default: 1).
A logical value indicating whether to case conversion (default: NULL).
formatted_query <- sql_format("SELECT * FROM users WHERE id = 1")
cat(formatted_query)
Run the code above in your browser using DataLab