crandas.stateobject#

class crandas.stateobject.DeferredObject(*args, cls, **kwargs)#

Bases: StateObject, Deferred

Deferred VDL object

Represents a deferred VDL object that has a name but for which no further structure can be used.

See transactions.

class crandas.stateobject.StateObject(handle, transaction_index=None, root_transaction=None, name=None, created=None, **kwargs)#

Bases: ABC

Base class for VDL state objects.

A VDL state object is an object that is stored remotely in the VDL and on which operations can be performed, such as a CDataFrame.

property reference#

Obtain a JSON-serializable reference to the object.

remove(**query_args)#

Remove object from server

Parameters:

query_args (query arguments) – See query_args

save(**query_args)#

Save object

Saves the object, e.g., a computation result. As a result of saving, the object is treated in the same way as an upload, meaning e.g. that (depending on the server configuration), the object may remain available after server restarts. See 11. Computed objects might be removed from cache.

Saving is supported for various types of object, including tables and table groupings. If the object does not support persistence, an error is raised. In this case, to use the object again, it first needs to be removed and recomputed (e.g., by calling obj.remove() on the object that obj.save() was called on, and then repeating the query used to compute the object).

Parameters:

query_args (query arguments) – See query_args

Raises:

cd.errors.ServerError: – The object could not be persisted (see details above)

crandas.stateobject.get_upload_handles(get_from=None)#

Get list of handles of all objects uploaded to the VDL.

See crandas.stateobject.list_uploads() for an overview of which objects are considerd to be “uploaded”

Parameters:

get_from (str, optional) – If set to “mem”, only return objects that are in the working memory of the VDL server. If set to “disk”, only return objects that are not in the working memory. (The latter causes the objects to be loaded into memory at the server.)

crandas.stateobject.list_uploads(*, also_on_disk=False)#

Get list of all objects uploaded to the VDL.

“Uploaded” objects are the results of functions that upload a local dataframe to the VDL, e.g., crandas.crandas.upload_pandas_dataframe(), crandas.crandas.DataFrame(), and crandas.crandas.read_csv(). It does not include tables that are computed from other tables or created via crandas.crandas.demo_table().

By default, for objects that are stored on-disk at the server, the metadata and creation date are not given. See the also_on_disk parameter below.

Parameters:

also_on_disk (bool, default: False) – If set to False, objects that need to be retrieved from disk at the server are listed, but their type and creation date are not returned. If set to True, these objects are loaded into memory and their metadata is returned.

Returns:

Dataframe containing handles, creation date, and type information

Return type:

pd.DataFrame