Tables are variables (data variables and coordinates alike). Fields are
dimensions, then non-dimension coordinates, then the variable itself.
The Python object is reachable at any time via xr_dataset(); this
connection is a veneer, not a jail. Create one with
dbConnect(); queries are documented
with XarrayResult, whole variables with
dbReadTable().
Usage
# S4 method for class 'XarrayConnection'
show(object)
# S4 method for class 'XarrayConnection'
dbIsValid(dbObj, ...)
# S4 method for class 'XarrayConnection'
dbDisconnect(conn, ...)
# S4 method for class 'XarrayConnection'
dbGetInfo(dbObj, ...)
# S4 method for class 'XarrayConnection'
dbListTables(conn, ...)
# S4 method for class 'XarrayConnection,character'
dbExistsTable(conn, name, ...)
# S4 method for class 'XarrayConnection,character'
dbListFields(conn, name, ...)
# S4 method for class 'XarrayConnection'
dbBegin(conn, ...)
# S4 method for class 'XarrayConnection'
dbCommit(conn, ...)
# S4 method for class 'XarrayConnection'
dbRollback(conn, ...)
# S4 method for class 'XarrayConnection'
dbDataType(dbObj, obj, ...)
# S4 method for class 'XarrayConnection,character'
dbQuoteIdentifier(conn, x, ...)
# S4 method for class 'XarrayConnection,character'
dbQuoteString(conn, x, ...)Arguments
- object, dbObj, conn
an XarrayConnection
- ...
unused
- name
a variable name
- obj
an R object, for
dbDataType()- x
character vector to quote
Value
show(): called for its output (source, dims, data variables)dbIsValid():TRUEwhile the connection is opendbDisconnect():TRUE, invisiblydbGetInfo(): a list withdbname,db.version(the xarray version),tables(data variables) andsizes(dims)dbListTables(): character, every variable (coordinates included)dbExistsTable(): logicaldbListFields(): character, dims, then non-dimension coordinates, then the variabledbDataType(): character, the numpy dtype an R vector maps todbQuoteIdentifier(),dbQuoteString():DBI::SQL()holding Python source (ds['name'],'text')dbBegin(),dbCommit(),dbRollback(): no return, they error
Details
Transactions (dbBegin(), dbCommit(), dbRollback()) are not
implemented and error; the intended mapping is icechunk sessions and
commits.
Slots
ptrenvironment holding the Python handles (xr module, ds object)
dsnthe source string if the connection was opened from one
See also
dbConnect() to open one;
XarrayResult for queries; xr_dataset() for the Python
object; xrdbi-package for an overview.
Examples
if (FALSE) { # \dontrun{
## needs a Python environment with xarray (see ?xrdbi)
f <- system.file("extdata/autotest/trmm.nc", package = "xrdbi")
con <- dbConnect(xarray(), f)
con
dbListTables(con) # every variable, coordinates included
dbGetInfo(con)$tables # the data variables
dbListFields(con, "pcp")
dbGetInfo(con)$sizes
dbDisconnect(con)
} # }