sql_split {sqlparseR}R Documentation

Split SQL to Single Statements

Description

Split a string with (one or) several SQL statements into single statements.

Usage

sql_split(sql, encoding = NULL)

Arguments

sql

Character string containing (one or) several SQL statements

encoding

Character string specifying the input encoding. Default: NULL (assumes UTF-8 or latin-1)

Details

This function is a wrapper to the sqlparse.split() function from the sqlparse python module, which is a non-validating SQL parser.

Value

Character vector with the single SQL statements.

See Also

sql_format, sql_parse

Examples

  if (reticulate::py_module_available("sqlparse")) {

    library("sqlparseR")

    raw <- "select*from foo; select*from bar;"

    statements <- sql_split(raw)

    print(statements)

  }

[Package sqlparseR version 0.1.0 Index]