create_table_from_data_frame: Generate a CREATE TABLE statement based on a data.frame,...

View source: R/sql_helpers.R

create_table_from_data_frameR Documentation

Generate a CREATE TABLE statement based on a data.frame, optionally execute the statement if con is not NULL.

Description

Generate a CREATE TABLE statement based on a data.frame, optionally execute the statement if con is not NULL.

Usage

create_table_from_data_frame(x, table_name, con = NULL)

Arguments

x

A data.frame.

table_name

A string, the name of the SQL table to create.

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

Value

A string, the CREATE TABLE statement; or the results retrieved by DBI::dbSendQuery after executing the statement.

Examples

create_table_from_data_frame(x = iris, table_name = "test")

sqlHelpers documentation built on Oct. 15, 2023, 1:07 a.m.