The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Title: Format SQL Queries
Version: 0.0.2
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.
License: MIT + file LICENSE
URL: https://dataupsurge.github.io/SQLFormatteR/, https://github.com/dataupsurge/SQLFormatteR
BugReports: https://github.com/dataupsurge/SQLFormatteR/issues
Imports: assertthat
Suggests: covr (≥ 3.6.4), docopt (≥ 0.7.1), git2r (≥ 0.35.0), jsonlite (≥ 1.8.9), lintr (≥ 3.1.2), optparse (≥ 1.7.5), precommit (≥ 0.4.3), rextendr (≥ 0.3.1), roxygen2 (≥ 7.3.2), styler (≥ 1.10.3), testthat (≥ 3.0.0)
Config/rextendr/version: 0.3.1.9001
Config/SQLFormatteR/MSRV: 1.78.0
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.3.2
SystemRequirements: Cargo (Rust's package manager), rustc >= 1.78.0
Depends: R (≥ 4.2)
NeedsCompilation: yes
Packaged: 2025-04-13 06:17:04 UTC; morgan
Author: Morgan Durand [aut, cre, cph], Authors of the dependent Rust crates [aut] (see AUTHORS file)
Maintainer: Morgan Durand <morgan@dataupsurge.com>
Repository: CRAN
Date/Publication: 2025-04-13 06:30:01 UTC

Format an SQL Query

Description

This function formats an SQL query based on various styling options.

Usage

sql_format(
  query,
  indent = 2L,
  uppercase = TRUE,
  lines_between_queries = 1L,
  ignore_case_convert = NULL
)

Arguments

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).

Value

A formatted SQL query as a character string.

Examples

formatted_query <- sql_format("SELECT * FROM users WHERE id = 1")
cat(formatted_query)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.