You can get information about a datastore in the current user schema by using the ore.datastore
and ore.datastoreSummary
functions.
Using the ore.datastore
function, you can list basic information about datastores. To get information about a specific type of datastore, you can use the optional character string type
argument. The valid values for type
are the following:
user
, which lists the datastores created by current session user. This is the default value.
private
, which lists the datastores for which read access cannot be granted by the current session user to other users.
all
, which lists all of the datastores to which the current session user has read access.
grantable
, which lists the datastores the read privilege for which can be granted by the current session user to other users.
grant
, which lists the datastores the read privilege for which has been granted by the current session user to other users.
granted
, which lists the datastores the read privilege for which has been granted by other users to the current session user.
If you do not specify a type, then function ore.datastore
returns a data.frame
object with columns that correspond to the datastore name, the number of objects in the datastore, the datastore size, the creation date, and a description. Rows are sorted by column datastore.name
in alphabetical order. If you do specify a type, then the function returns a data.frame
that has a column for the specified type.
You can search for a datastore by name or by using a regular expression pattern.
The ore.datastoreSummary
function returns information about the R objects saved within a datastore in the user schema in the connected database. The function returns a data.frame
with columns that correspond to object name, object class, object size, and either the length of the object, if it is a vector
, or the number of rows and columns, if it is a data.frame
object. It takes one required argument, the name of a datastore, and has an optional argument, the owner of the datastore.
Example 2-20 Using the ore.datastore Function
This example demonstrates using the ore.datastore
function. The example uses some of the R objects created in Example 2-18.
# The datastore objects ds1 and ds2 and objects data.frame objects df1 and df2 # were created in Example 2-18. ore.save(df1, df2, name = "dfobj", description = "df objects" ore.save(x, y, z, name = "another_ds", description = "For pattern matching") # List all of the datastore objects. ore.datastore() # List the specified datastore. ore.datastore("ds1") # List the datastore objects with names that include "ds". ore.datastore(pattern = "ds")Listing for Example 2-20
R> # The datastore objects ds1 and ds2 and objects data.frame objects df1 and df2 R> # were created in Example 2-18. R> ore.save(df1, df2, name = "dfobj", description = "df objects" R> ore.save(x, y, z, name = "another_ds", description = "For pattern matching") R> R> # List all of the datastore objects. R> ore.datastore() datastore.name object.count size creation.date description 1 another_ds 3 1243 2014-07-24 13:31:56 For pattern mattching 2 dfobj 2 656 2014-07-24 13:31:46 df objects 3 ds1 4 3162 2014-07-24 13:25:17 My datastore 4 ds2 2 1111 2014-07-24 13:27:26 only x R> # List the specified datastore. R> ore.datastore("ds1") datastore.name object.count size creation.date description 1 ds1 4 2908 2013-11-08 10:41:09 My datastore R> R> # List the datastore objects with names that include "ds". R> ore.datastore(pattern = "ds") datastore.name object.count size creation.date description 1 another_ds 3 1243 2014-07-24 13:31:56 For pattern mattching 2 ds1 4 3162 2014-07-24 13:25:17 My datastore 3 ds2 2 1111 2014-07-24 13:27:26 only x
Example 2-21 Using the ore.datastoreSummary Function
This example demonstrates using the ore.datastoreSummary
function. The example uses the datastores created in Example 2-18.
ore.datastoreSummary("ds1") ore.datastoreSummary("ds2")Listing for Example 2-21
R> ore.datastoreSummary("ds1") object.name class size length row.count col.count 1 AIRQUALITY ore.frame 1077 6 153 6 2 df1 data.frame 328 2 5 2 3 df2 data.frame 328 2 5 2 4 iris_of ore.frame 1429 5 150 5 R> ore.datastoreSummary("ds2") object.name class size length row.count col.count 1 x numeric 182 20 NA NA 2 z ore.numeric 929 20 NA NA