Common scidb operations
Please access this singleton instance via arrayop::dbutils
.
No instance creation is needed.
The default connection is used. So we need to call arrayop::db_connect
first
before any of the dbutils
db related function is available.
We can call dbutils$set_conn(another_scidb_connection_obj)
to set a different
ScidbConnection object, which should be extremely rare.
random_array_name()
Generate a random array name so it does not collides with existing array names
set_conn()
Set a ScidbConnection
object that dbutils
uses for db operations
No need to set the connection in most cases. The default conneciton object is used.
get_conn()
Get the ScidbConnection
object the dbutils
is using
If no set_conn
call is made, by default it returns the default
ScidbConnection
object, identical to get_default_connection()
clear_cache()
Clear cached arrayOp instances
For performance concerns, dbutils
caches every arrayOp it retrieves from
scidb.
Call this function if there are array changes in scidb after the scidb connection is established
list_arrays_in_ns()
Returns an ArrayOp instance of the "list arrays" opeartion in a scidb namespace
Implemented by scidb list(ns:myNamespace)
.
Throw an error if the namespace does not exist in scidb.
sanitize_names()
Sanitize (data frame or scidb array) names
First replace any non-alphanumerical letter to _ Then trim off any leading or trailing underscores.
This is useful when data frames or files contain characters not supported as scidb field names.
sanitize_names_for()
Sanitize names for an R object
sanitize_names_for(myObj)
is equvilant to
names(myObj) <- sanitize_names(names(myObj))
db_namespaces()
Return an ArrayOp instance that encapsualtes all namespaces in scidb
The namespaces visible to us is determined by our scidb role and previlige.
db_users()
Return an ArrayOp instance that encapsualtes all users in scidb
The scidb users visible to us is determined by our scidb role and previlige.
db_roles()
Return an ArrayOp instance that encapsualtes all user roles in scidb
The roles visible to us is determined by our scidb role and previlige.
## ------------------------------------------------
## Method `DBUtils$sanitize_names`
## ------------------------------------------------
if (FALSE) { # \dontrun{
names(myDataFrame) <- dbutils$sanitize_names(names(myDataFrame))
} # }
## ------------------------------------------------
## Method `DBUtils$db_namespaces`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_namespace()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_users`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_users()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_roles`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_roles()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_operators`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_operators()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_instances`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_instances()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_queries`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_queries()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_macros`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_macros()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_types`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_types()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_libraries`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_libraries()$to_df()
} # }
## ------------------------------------------------
## Method `DBUtils$db_aggregates`
## ------------------------------------------------
if (FALSE) { # \dontrun{
dbutils$db_aggregates()$to_df()
} # }