dbCreateTableArrow | R Documentation |
The default dbCreateTableArrow()
method determines the R data types
of the Arrow schema associated with the Arrow object,
and calls dbCreateTable()
.
Backends that implement dbAppendTableArrow()
should typically
also implement this generic.
Use dbCreateTable()
to create a table from the column types
as defined in a data frame.
dbCreateTableArrow(conn, name, value, ..., temporary = FALSE)
conn |
A DBIConnection object, as returned by
|
name |
The table name, passed on to
|
value |
An object for which a schema can be determined via
|
... |
Other parameters passed on to methods. |
temporary |
If |
dbCreateTableArrow()
returns TRUE
, invisibly.
If the table exists, an error is raised; the remote table remains unchanged.
An error is raised when calling this method for a closed
or invalid connection.
An error is also raised
if name
cannot be processed with dbQuoteIdentifier()
or
if this results in a non-scalar.
Invalid values for the temporary
argument
(non-scalars,
unsupported data types,
NA
,
incompatible values,
duplicate names)
also raise an error.
The following arguments are not part of the dbCreateTableArrow()
generic
(to improve compatibility across backends)
but are part of the DBI specification:
temporary
(default: FALSE
)
They must be provided as named arguments. See the "Specification" and "Value" sections for details on their usage.
The name
argument is processed as follows,
to support databases that allow non-syntactic names for their objects:
If an unquoted table name as string: dbCreateTableArrow()
will do the quoting,
perhaps by calling dbQuoteIdentifier(conn, x = name)
If the result of a call to dbQuoteIdentifier()
: no more quoting is done
The value
argument can be:
a data frame,
a nanoarrow array
a nanoarrow array stream (which will still contain the data after the call)
a nanoarrow schema
If the temporary
argument is TRUE
, the table is not available in a
second connection and is gone after reconnecting.
Not all backends support this argument.
A regular, non-temporary table is visible in a second connection,
in a pre-existing connection,
and after reconnecting to the database.
SQL keywords can be used freely in table names, column names, and data. Quotes, commas, and spaces can also be used for table names and column names, if the database supports non-syntactic identifiers.
Other DBIConnection generics:
DBIConnection-class
,
dbAppendTable()
,
dbAppendTableArrow()
,
dbCreateTable()
,
dbDataType()
,
dbDisconnect()
,
dbExecute()
,
dbExistsTable()
,
dbGetException()
,
dbGetInfo()
,
dbGetQuery()
,
dbGetQueryArrow()
,
dbIsReadOnly()
,
dbIsValid()
,
dbListFields()
,
dbListObjects()
,
dbListResults()
,
dbListTables()
,
dbQuoteIdentifier()
,
dbReadTable()
,
dbReadTableArrow()
,
dbRemoveTable()
,
dbSendQuery()
,
dbSendQueryArrow()
,
dbSendStatement()
,
dbUnquoteIdentifier()
,
dbWriteTable()
,
dbWriteTableArrow()
con <- dbConnect(RSQLite::SQLite(), ":memory:")
ptype <- data.frame(a = numeric())
dbCreateTableArrow(con, "df", nanoarrow::infer_nanoarrow_schema(ptype))
dbReadTable(con, "df")
dbDisconnect(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.