List field names of a remote table — dbListFields (original) (raw)

Returns the field names of a remote table as a character vector.

Methods in other packages

This documentation page describes the generics. Refer to the documentation pages linked below for the documentation for the methods that are implemented in various backend packages.

Usage

dbListFields(conn, name, ...)

Arguments

conn

A DBIConnection object, as returned by[dbConnect()](dbConnect.html).

name

The table name, passed on to [dbQuoteIdentifier()](dbQuoteIdentifier.html). Options are:

...

Other parameters passed on to methods.

Value

dbListFields()

returns a character vector that enumerates all fields in the table in the correct order. This also works for temporary tables if supported by the database. The returned names are suitable for quoting with [dbQuoteIdentifier()](dbQuoteIdentifier.html).

Failure modes

If the table does not exist, an error is raised. Invalid types for the name argument (e.g., character of length not equal to one, or numeric) lead to an error. An error is also raised when calling this method for a closed or invalid connection.

Specification

The name argument can be

A column named row_names is treated like any other column.

See also

[dbColumnInfo()](dbColumnInfo.html) to get the type of the fields.

Other DBIConnection generics:[DBIConnection-class](DBIConnection-class.html),[dbAppendTable](dbAppendTable.html)(),[dbAppendTableArrow](dbAppendTableArrow.html)(),[dbCreateTable](dbCreateTable.html)(),[dbCreateTableArrow](dbCreateTableArrow.html)(),[dbDataType](dbDataType.html)(),[dbDisconnect](dbDisconnect.html)(),[dbExecute](dbExecute.html)(),[dbExistsTable](dbExistsTable.html)(),[dbGetException](dbGetException.html)(),[dbGetInfo](dbGetInfo.html)(),[dbGetQuery](dbGetQuery.html)(),[dbGetQueryArrow](dbGetQueryArrow.html)(),[dbIsReadOnly](dbIsReadOnly.html)(),[dbIsValid](dbIsValid.html)(),[dbListObjects](dbListObjects.html)(),[dbListResults](dbListResults.html)(),[dbListTables](dbListTables.html)(),[dbQuoteIdentifier](dbQuoteIdentifier.html)(),[dbReadTable](dbReadTable.html)(),[dbReadTableArrow](dbReadTableArrow.html)(),[dbRemoveTable](dbRemoveTable.html)(),[dbSendQuery](dbSendQuery.html)(),[dbSendQueryArrow](dbSendQueryArrow.html)(),[dbSendStatement](dbSendStatement.html)(),[dbUnquoteIdentifier](dbUnquoteIdentifier.html)(),[dbWriteTable](dbWriteTable.html)(),[dbWriteTableArrow](dbWriteTableArrow.html)()

Examples

con <- dbConnect(RSQLite::SQLite(), ":memory:")

dbWriteTable(con, "mtcars", mtcars)
dbListFields(con, "mtcars")
#>  [1] "mpg"  "cyl"  "disp" "hp"   "drat" "wt"   "qsec" "vs"   "am"   "gear"
#> [11] "carb"

dbDisconnect(con)