Learn R Programming

sqlparseR (version 0.1.0)

sql_split: 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)

Value

Character vector with the single SQL statements.

Details

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

See Also

sql_format, sql_parse

Examples

Run this code
# NOT RUN {
  if (reticulate::py_module_available("sqlparse")) {

    library("sqlparseR")

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

    statements <- sql_split(raw)

    print(statements)

  }
# }

Run the code above in your browser using DataLab