deephaven_enterprise.schema

Module Contents

class Schema(schema)[source]

Bases: deephaven._wrapper.JObjectWrapper

Wraps a java Schema instance and provides methods for commonly accessed members.

Parameters:

schema (SchemaLike)

property column_descriptions: dict[str, str][source]

A dictionary of column names to column descriptions. The dictionary may not contain any columns that do not have a description.

Return type:

dict[str, str]

property j_object[source]

The underlying java Schema instance backing this python instance.

property namespace: str[source]

The namespace of the table.

Return type:

str

property namespace_set: str[source]

The NamespaceSet to which this schema belongs (System or User).

Return type:

str

property table_definition: deephaven.table.TableDefinition[source]

The TableDefinition corresponding to this Schema.

Return type:

deephaven.table.TableDefinition

property table_description: str[source]

The table description from the schema.

Return type:

str

property table_name: str[source]

The name of the table.

Return type:

str

property version: SchemaVersion[source]

The SchemaVersion for this schema.

Return type:

SchemaVersion

class SchemaService(schema_service)[source]

Bases: deephaven._wrapper.JObjectWrapper

Provides methods for interacting with the system Schema store using a wrapped java SchemaService instance.

add_schema(schema, code=None, comment=None)[source]

Add the specified schema to the service.

Parameters:
  • schema (Schema) – The schema to add.

  • code (Optional[str]) – Pass-thru to kv persistence, indicates the code source of this update. Default is None.

  • comment (Optional[str]) – Pass-thru to kv persistence - a comment for this update. Default is None.

Return type:

Schema

Returns

the Schema stored in the SchemaService

Raises:

DHError if the schema cannot be added.

Parameters:
  • schema (Schema)

  • code (Optional[str])

  • comment (Optional[str])

Return type:

Schema

all_schemas()[source]

Get a list of all known schemas in the system. The latest version of each will be returned.

Returns

a list of all known schemas.

Return type:

list[Schema]

contains_namespace(namespace, include_deleted=False)[source]

Find out whether the given namespace is known to the schema service.

Parameters:
  • namespace (str) – The namespace.

  • include_deleted (bool) – Set to True if deleted namespaces should be considered. Default is False.

Returns:

True if the namespace is found, else False.

Return type:

bool

contains_schema(namespace, table_name)[source]

Find out if the given schema exists. Does not check for deleted schemas.

Parameters:
  • namespace (str) – The namespace

  • table_name (str) – The table name

Returns:

True if a schema is found for namespace.table_name, else False.

Return type:

bool

create_namespace(namespace_set, namespace, code=None, comment=None)[source]

Add a namespace with the given name to the schema service, in the requested NamespaceSet. Returns True if the namespace was added, False if it already exists.

Parameters:
  • namespace (str) – The namespace to add

  • namespace_set (str) – The NamespaceSet (System, User) where the namespace should be created.

  • code (Optional[str]) – Pass-thru to kv persistence, indicates the code source of this update. Default is None.

  • comment (Optional[str]) – Pass-thru to kv persistence - a comment for this update. Default is None.

Returns:

True if the namespace was added, False if it already exists.

Raises:

DHError if the namespace could not be added to the given NamespaceSet

Return type:

bool

classmethod default()[source]

Returns the default SchemaService

Returns:

the default SchemaService

Return type:

SchemaService

delete_schema(namespace, table_name, code=None, comment=None)[source]

Delete the specified schema.

Parameters:
  • namespace (str) – The namespace of the schema to delete.

  • table_name (str) – The name of the schema to delete.

  • code (Optional[str]) – Pass-thru to kv persistence, indicates the code source of this update. Default is None.

  • comment (Optional[str]) – Pass-thru to kv persistence - a comment for this update. Default is None.

Raises:

DHError

list_all_tables()[source]

Get a dictionary of all known tables in all known namespaces for all NamespaceSet values.

Returns:

all defined table names, mapped by NamespaceSet and namespace

Return type:

dict[str, dict[str, list[str]]]

list_namespaces(namespace_set=None, include_deleted=False)[source]

Get a list of the namespaces available, optionally limiting to a given NamespaceSet.

Parameters:
  • namespace_set (Optional[str]) – An optional NamespaceSet (System, User)

  • include_deleted (bool) – Set to True if deleted namespaces should be included. Default is False.

Returns:

a list of namespaces.

Return type:

list[str]

list_table_names(namespace, include_deleted=False)[source]

Get a list of all table names in the specified namespace.

Parameters:
  • namespace (str) – The namespace

  • include_deleted (bool) – Set to True if deleted namespaces should be included. Default is False.

Returns:

a list of table names.

Return type:

list[str]

namespace_set(namespace)[source]

Get the NamespaceSet for a particular namespace (System or User).

Parameters:

namespace (str) – The namespace.

Returns:

the NamespaceSet for the namespace (System or User).

Raises:

DHError

Return type:

str

remove_namespace(namespace, code=None, comment=None)[source]

Remove the given namespace. The namespace must be empty (contain no schemas).

Parameters:
  • namespace (str) – The namespace to remove

  • code (Optional[str]) – Pass-thru to kv persistence, indicates the code source of this update. Default is None.

  • comment (Optional[str]) – Pass-thru to kv persistence - a comment for this update. Default is None.

Raises:

DHError if the namespace cannot be removed

schema(namespace, table_name)[source]

Get the latest version of the Schema defined by namespace and table name.

Parameters:
  • namespace (str) – The namespace of the schema.

  • table_name (str) – The table name of the schema.

Return type:

Optional[Schema]

Returns

the latest version of namespace.table_name or None if not found.

schemas(namespace)[source]

Get a list of all known schemas in the given NamespaceSet. The latest version of each will be returned.

Parameters:

namespace (str) – The namespace of the schemas.

Return type:

list[Schema]

Returns

a list of all known schemas in the given namespace.

schemas_for_namespace_set(namespace_set)[source]

Get a list of all known schemas in the system, with the given NamespaceSet. The latest version of each will be returned.

Parameters:

namespace_set (str) – The NamespaceSet (System, User) for the schemas.

Return type:

list[Schema]

Returns

a list of all known schemas in the given NamespaceSet.

update_schema(schema, code=None, comment=None)[source]

Update the schema with the same namespace and table name with the specified new schema.

Parameters:
  • schema (Schema) – The schema to update with.

  • code (Optional[str]) – Pass-thru to kv persistence, indicates the code source of this update. Default is None.

  • comment (Optional[str]) – Pass-thru to kv persistence - a comment for this update. Default is None.

Return type:

Schema

Returns

the Schema stored in the SchemaService

Raises:

DHError if the schema cannot be updated.

Parameters:
  • schema (Schema)

  • code (Optional[str])

  • comment (Optional[str])

Return type:

Schema

property about: str[source]

Information about this SchemaService instance. Useful for debugging.

Return type:

str

property j_object[source]

The underlying java SchemaService instance backing this python instance.

class SchemaVersion(schema_version)[source]

Bases: deephaven._wrapper.JObjectWrapper

Immutable metadata describing the version of a schema, which wraps a SchemaVersion java object.

property description: str[source]

Human readable description of this version. If not specifically defined, will return an empty String.

Return type:

str

property j_object[source]

The underlying java SchemaVersion instance backing this python instance.

property sequence_number: int[source]

An integer identifying a single version of a single Schema. Sequence numbers are guaranteed to monotonically increase with each update.

Return type:

int

property timestamp: int[source]

The time of the last update in milliseconds since epoch.

Return type:

int

property user: str[source]

The User who initiated the creation of this version.

Return type:

str

type SchemaLike = 'Schema' | _JSchema | tuple[str, str][source]

A Union representing objects that can be coerced into a Schema. May be a Schema instance, a java Schema instance, or a tuple representing Namespace and TableName.