Skip to content

Classes and constants

This page lists some classes, types and constants used in this library.

src.data_hub.dataframe.DataFrame

Bases: DataFrame

A subclass of pandas DataFrame that allows for easy updating of a Deep Origin database. This can be used as a drop-in replacement for a pandas DataFrame, and should support all methods a pandas DataFrame supports.

The primary method of creating an object of this type is to use the from_deeporigin class method.

auto_sync class-attribute instance-attribute

auto_sync: bool = False

When True, changes made to the dataframe will be automatically synced to the Deep Origin database this dataframe represents.

from_deeporigin classmethod

from_deeporigin(
    database_id: str,
    *,
    use_file_names: bool = True,
    reference_format: IDFormat = "human-id",
    return_type: DatabaseReturnType = "dataframe",
    client=None
)

Create a local Deep Origin DataFrame from a Deep Origin database.

Parameters:

Name Type Description Default
database_id str

The ID of the Deep Origin database.

required
use_file_names bool

Whether to use the file names in the Deep Origin database. Defaults to True.

True
reference_format IDFormat

The format of the IDs in the Deep Origin database. Defaults to "human-id".

'human-id'
return_type DatabaseReturnType

The type of return value. Defaults to "dataframe".

'dataframe'

to_deeporigin

to_deeporigin(
    *,
    columns: Optional[list] = None,
    rows: Optional[list] = None
)

Write data in dataframe to Deep Origin

Deep Origin DataFrames can automatically synchronize

To automatically save changes to local DataFrames to Deep Origin databases, set the auto_sync attribute of the dataframe True.

Parameters:

Name Type Description Default
columns list

The columns of the dataframe to update. When None, all modified columns are updated.

None
rows list

The rows to update. Defaults to None. When None, all rows in the relevant columns are updated.

None

src.utils

This module contains utility functions that are used internally by the Python Client and the CLI

Cardinality module-attribute

Cardinality = Literal['one', 'many']

The cardinality defines whether a cell in a database can contain one or multiple objects

DataType module-attribute

DataType = Literal[
    "integer",
    "str",
    "select",
    "date",
    "text",
    "file",
    "reference",
    "editor",
    "float",
    "boolean",
]

Type of a column in a Deep Origin database. See this page in the documentation for more information.

DatabaseReturnType module-attribute

DatabaseReturnType = Literal['dataframe', 'dict']

Return type for api.get_dataframe

FileStatus module-attribute

FileStatus = Literal['ready', 'archived']

Status of a file. Ready files are ready to be used, downloaded, and operated on.

IDFormat module-attribute

IDFormat = Literal['human-id', 'system-id']

Format of an ID

ObjectType module-attribute

ObjectType = Literal['row', 'database', 'workspace']

Type of a row. In Deep Origin, a row can be a database row, a database or a workspace

PREFIXES dataclass

Prefixes for CLI and Python client

construct_resource_url

construct_resource_url(
    *, name: str, row_type: ObjectType
) -> str

Constructs the URL for a resource

Parameters:

Name Type Description Default
name str

name of the resource

required
row_type ObjectType

type of the resource

required

Returns:

Name Type Description
str str

URL for the resource

find_last_updated_row

find_last_updated_row(rows: List[T]) -> T

utility function to find the most recently updated row and return that object