deephaven_enterprise.database¶
- class Database(j_db)[source]¶
Bases:
object
- add_partitioned_table_schema(namespace, table_name, partition_column_name, prototype)[source]¶
Adds a schema for a partitioned user table.
The schema is derived from the prototype table definition and the partition column name. The prototype definition must not include a partitioning column.
If the namespace does not exist, then it is created.
If the schema already exists and it is identical (this is a stricter check than compatibility; all columns must be present in the same order with the same properties), then the method returns False. If the schema already exists and is not identical, then an error is thrown.
- add_table_partition(namespace, table_name, partition_column_value, table)[source]¶
Adds a single column partition of data to a partitioned user table.
The data table must have a mutually compatible definition with the current schema. The data table must not have a column with the same name as the partitioning column.
If an error occurs during writing, the state of the table is undefined.
- add_unpartitioned_table(namespace, table_name, table)[source]¶
Adds an unpartitioned user table.
Writes an unpartitioned user table to disk. If the namespace does not exist, then it is created. The schema must not already exist.
If an error occurs during writing, the state of the table is undefined.
- append_live_table(namespace, table_name, partition_column_value, table)[source]¶
Appends all rows from a given table to a live user table partition.
The data table must have a mutually compatible definition with the current schema. The data table must not have a column with the same name as the partitioning column.
This method is asynchronous. After returning, the data may not be immediately available. It is possible for the write to fail after this method has returned. When multiple workers append to a partition, ordering is imposed outside the worker by other system components.
If an error is thrown during appending, the state of the table is undefined.
- append_live_table_incremental(namespace, table_name, partition_column_value, table)[source]¶
Appends all rows from a given table to a live user table partition. When rows are added to the table, they are additionally appended to the table.
The input table updates can only have additions and shifts. No modifications or removals are permitted.
The data table must have a mutually compatible definition with the current schema. The data table must not have a column with the same name as the partitioning column.
This method is asynchronous, after returning the data may not be immediately available. It is possible for the write to fail after this method has returned. When multiple workers append to a partition, ordering is imposed outside the worker by other system components.
A reference must be maintained to the returned object to ensure expected functionality; calling close() on it will stop incremental appends, and clean up related resources.
If an error is thrown during appending, the state of the table is undefined.
- catalog_table()[source]¶
Return a table of the available tables.
The result table contains a column for Namespace, TableName, and NamespaceSet.
- Returns:
a table of table names
- delete_live_table_partition(namespace, table_name, partition_column_value)[source]¶
Delete a partition from a live user table.
If an error is thrown during deleting, the state of the table is undefined.
- delete_partitioned_table(namespace, table_name)[source]¶
Delete all partitions, whether direct or live, and the schema, from a partitioned user table.
All partitions from the table are deleted sequentially. If a partition cannot be deleted, then the operation fails but some data may have already been removed. After all partitions are deleted, then the schema is deleted. If the schema does not exist, then data is not deleted. If there is no data, but the schema exists, then the schema is deleted.
The namespace is not removed, even if this is the last table in the namespace.
If an error is thrown during deleting, the state of the table is undefined.
- delete_table_partition(namespace, table_name, partition_column_value)[source]¶
Deletes a single column partition of data from a partitioned user table.
If an error is thrown while deleting, the state of the table is undefined.
- delete_unpartitioned_table(namespace, table_name)[source]¶
Deletes an unpartitioned user table and the schema.
If the schema does not exist, then data is not deleted. If there is no data but the schema exists, then the schema is deleted.
The namespace is not removed even if this is the last table in the namespace.
If an error occurs during deleting, the state of the table is undefined.
- historical_partitioned_table(namespace, table_name)[source]¶
Retrieve the specified historical table as a partitioned table from the Database.
- historical_table(namespace, table_name, internal_partition_column=None)[source]¶
Fetch a historical Table for the specified namespace and table name.
- live_partitioned_table(namespace, table_name)[source]¶
Retrieve the specified historical table as a partitioned table from the Database.
- live_table(namespace, table_name, is_refreshing=None, is_blink=False, internal_partition_column=None)[source]¶
Fetch a live Table for the specified namespace and table name.
- Parameters:
namespace (
str
) – the namespacetable_name (
str
) – the tableis_refreshing (
Optional
[bool
]) – True if the returned table should be refreshingis_blink (
bool
) – True if the returned table should be a blink table (defaults to False)internal_partition_column (
Optional
[str
]) – Set the name of the internal partition column (defaults to None, not included)
- Returns:
the live table at the specified namespace and table name
- table_definition(namespace, table_name)[source]¶
Fetch a Table containing the column definitions for the specified namespace and table name.
- table_names(namespace)[source]¶
Return the list tables within a namespace.
- Parameters:
namespace (
str
) – the namespace- Returns:
the list of tables within namespace
- update_partitioned_table_schema(namespace, table_name, prototype)[source]¶
Updates a preexisting User table schema.
If the schema does not exist an error is thrown. Not all schema modifications are permitted. The partitioning column may not be changed. Existing columns may not have their type changed. Columns may be added or deleted.
Note that no data is modified by this operation. Removed columns remain on persistent storage, and added columns are treated as null on read.
Although each modification in isolation is verified for safety, a sequence of modifications to the schema may be unsafe. For example, deleting a column and adding it back with a new type results in unreadable data.