Welcome to Python Client’s documentation!

Python Client for GridDB is developed using GridDB C Client and SWIG (http://www.swig.org/).

Functions are the following:

(available)

  • STRING, BOOL, BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, TIMESTAMP, BLOB, GEOMETRY type for GridDB
  • Put/get data
  • Normal query, aggregation with TQL
  • Multi-Put/Get/Query (batch processing)
  • Array type for GridDB
  • Connectivity for Pandas library
  • None

(not available)

  • Timeseries compression
  • Timeseries-specific function like gsAggregateTimeSeries, gsQueryByTimeSeriesSampling in C Client
  • Trigger, affinity

Please refer to GridDB API reference about Data-type and TQL.

Please use the following examples for Pandas library.


  1. Pandas DataFrame into GridDB

    ex. container.multi_put(df.values.tolist())

  2. GridDB into Pandas DataFrame

    ex. df = pd.DataFrame(list(rowset), colums=rowset.get_column_names())


Note:

  • None is used to represent the absence of a value.
  • Accuracy of TIMESTAMP for GridDB is in milliseconds. A value less than a millisecond will be ignored.
  • When an error occurs, a GSException or a built-in exception like ValueError is raised. So, for error handling, please use both GSException and Exception in except statement as below.
    import griddb_python as griddb
    try:
        ...
    except griddb.GSException as e:
        ...
    except Exception as e:
        ...
    

griddb_python module

class AggregationResult

Bases: object

Stores the result of an aggregation operation.

The type of the stored result depends on the type of aggregation operation and the type of the target Columns. For specific rules, see the TQL specifications.

The type of obtaining value depends on the stored type. Float type and long type are only available when a result is of numeric type, and datetime type when a result is of TIMESTAMP type.

get(type)

Returns the aggregation result as the value with specified type

Parameters:type (Type) – Column type
Returns:the aggregation result
Return type:long, float or datetime
class Container

Bases: object

Provides management functions for sets of row having same type.

Each column in GridDB schema is defined by a ContainerInfo. Each container consists of one or more columns.

Mapping table between column type and value in a row object is following:

(Column) Type str bool int float datetime bytearray
STRING mapped          
BOOL   mapped mapped      
BYTE     mapped      
SHORT     mapped      
INTEGER     mapped      
LONG     mapped      
FLOAT     mapped mapped    
DOUBLE     mapped mapped    
TIMESTAMP mapped     mapped mapped  
GEOMETRY mapped          
BLOB mapped         mapped
(Column) Type list of str list of bool list of int list of float list of datetime
STRING_ARRAY mapped        
BOOL_ARRAY   mapped mapped    
BYTE_ARRAY     mapped    
SHORT_ARRAY     mapped    
INTEGER_ARRAY     mapped    
LONG_ARRAY     mapped    
FLOAT_ARRAY     mapped mapped  
DOUBLE_ARRAY     mapped mapped  
TIMESTAMP_ARRAY mapped     mapped mapped

TIMESTAMP represents milliseconds since the UNIX epoch (January 1, 1970 00:00:00 UTC) with long type.

TIMESTAMP value suports msec. Range of time is from 1/1/1970 to 12/31/9999 (UTC). There may be more limitation depending on a GridDB cluster configuration. Cannot store a value out of the range.

There is an upper limit for the number of column and the length of column name. The value has limitations for rage and size. Please refer to appendix of GridDB API Reference for more detail. Cannot store a value exceeding these limitations.

A limitation about a row key type, presence of column corresponding to a row key, and availability of row value updates, may differ for each type derived from the container type.

NULL in GridDB rows can be retained unless the NOT NULL constraint is set. NOT NULL constraint can be set with columnInfoList object in ContainerInfo when put_container() is called.

About transaction, auto commit mode is active as a default. In the auto commit mode, each transaction is processed sequentially, and cannot be canceled. For manual commit mode, transactions before a commit is canceled if there is an error on a cluster node during the transaction via Container instances. Transaction isolation level supports only READ COMMITTED. Lock granularity may differ for each container type.

When a row is updated, added, deleted, and got a lock for updates, a transaction is generated internally. This transaction has a valid period. After some period defined by GridDB is passed from the timing of this transaction for Container instance, any same type of transactions will be not accepted.

abort()

Rolls back the result of the current transaction and starts a new transaction in the manual commit mode.

commit()

Commits the result of the current transaction and start a new transaction in the manual commit mode.

create_index(column_name, index_type=<IndexType.DEFAULT: -1>, name=None)

Creates a specified type of index on the specified Column.

Named index can be set with name parameter.

No index cannot be set on a TimeSeries Row key (TIMESTAMP type).

When a transaction is held, uncommitted updates will be rolled back.

If an index is already set on the specified Column, nothing is changed.

When a transaction(s) is active in a target Container, it creates an index after waiting for the transaction(s) to complete.

Parameters:
  • column_name (str) – Column name to be processed
  • index_type (IndexType) – Index type to be set
  • name (str) – Index name to be created
drop_index(column_name, index_type=<IndexType.DEFAULT: -1>, name=None)

Removes the specified type of index among indexes on the specified Column.

Nothing is changed if the specified index is not found.

When a transaction(s) is active in a target Container, it removes the index after waiting for the transaction(s) to be completed.

Parameters:
  • column_name (str) – Column name to be processed
  • type (IndexType) – Index type to be deleted
  • name (str) – Index name to be removed
flush()

Writes the results of earlier updates to a non-volatile storage medium, such as SSD, so as to prevent the data loss even if all cluster nodes stop suddenly.

It can be used for operations which require higher reliability than usual. However, frequent execution of this operation would potentially cause degradation in response time.

The details of behavior, such as the scope of cluster nodes which are the data export targets, will be changed depending on the configuration of GridDB.

get(key)

Returns the content of a Row corresponding to Row key.

Parameters:key (object) – Row key to be processed
Returns:the list object representing the content of a Row to be obtained
Return type:list[object]
multi_put(row_list)

Newly creates an arbitrary number of Rows together based on the specified Row objects group.

In the manual commit mode, the target Row is locked.

Parameters:row_list (list[list[object]) – list object corresponding to contents of newly created Row collection
put(row)

Newly creates or update a Row.

If a Column exists which corresponds to the specified Row key, it determines whether to newly create or update a Row, based on the Row key and the state of the Container. If there is no corresponding Row in the Container, it determines to newly create a Row; otherwise, it updates a relevant Row.

If no Column exists which corresponds to the specified Row key, it always creates a new Row.

In the manual commit mode, the target Row is locked.

Parameters:row (list[object]) – A list object representing the content of a Row to be newly created or updated.
Returns:True if a Row exists
Return type:bool
query(query_string)

Creates a query to execute the specified TQL statement.

Parameters:query_string (str) – TQL statement
Returns:Query instance
Return type:Query
remove(key)

Removes a Row corresponding to Row key.

In the manual commit mode, the target Row is locked.

Parameters:key (object) – Row key to be processed
Returns:a BOOL-type value which can be used to identify whether the target Row exists or not.
Return type:bool
set_auto_commit(enabled)

Change the setting of the commit mode.

In the auto commit mode, the transaction state cannot be controlled directly and change operations are committed sequentially. If the auto commit mode is disabled, i.e. in the manual commit mode, as long as the transaction has not timed out or commit() has been invoked directly, the same transaction will continue to be used in this Container and change operations will not be committed.

When the auto commit mode is switched from disabled to enabled, uncommitted updates are committed implicitly. Unless the commit mode is changed, the state of the transaction will not be changed.

Parameters:enabled (bool) – indicates whether it enables auto commit mode or not. if True, auto commit mode is enabled. if False, manual commit mode is enabled.
type = 0

Container type

class ContainerInfo

Bases: object

Represents the information about a Container.

ContainerInfo(name, column_info_list, type=<ContainerType.COLLECTION: 0>, row_key=True, expiration=None)

Constructor

Parameters:
  • name (str) – Name of container
  • columnInfoList (list[str, Type, TypeOption]) – The list of the information of Columns. The information consists of column name, column type and NOT NULL constraint.
  • type (ContainerType) – Type of container
  • row_key (bool) – The boolean value indicating whether the Row key Column is assigned.
  • expiration (ExpirationInfo) – Expiration instance
column_info_list = None

The list of the information of Columns

expiration = None

Expiration instance

name = None

Name of container (Read-only attribute)

row_key = True

The boolean value indicating whether the Row key Column is assigned.

type = 0

Type of container

class ContainerType

Bases: enum.IntEnum

Represents the type of a Container.

COLLECTION = 0

Collection container

TIME_SERIES = 1

TImeSeries container

class ExpirationInfo

Bases: object

Represents the information about a expiration.

ExpirationInfo(time, unit, division_count)

Constructor

Parameters:
  • time (int) – The elapsed time period of a Row to be used as the basis of the validity period.
  • unit (TimeUnit) – The unit of the elapsed time period of a Row to be used as the basis of the validity period.
  • division_count (int) – The division number for the validity period as the number of expired row data units to be released.
division_count = None

The division number for the validity period as the number of expired row data units to be released.

time = None

The elapsed time period of a Row to be used as the basis of the validity period.

unit = None

The unit of the elapsed time period of a Row to be used as the basis of the validity period.

class GSException

Bases: object

Represents the exception for GridDB

get_error_code(stack_index)

Returns the error code of last error related to this resource.

0 indicates the successful execution for GridDB instructions.

Parameters:stack_index (int) – The index of error stack. A valid result will be returned only if a value which has more than 0 and less than the stack size is specified.
Returns:the error code
Return type:int
get_error_stack_size()

Returns the stack size of last error information related to this resource.

Error information has become a stack structure. A large stack number corresponds to the more direct cause of the error.

Returns:the stack size. 0 is returned if corresponding information can not be obtained
Return type:int
get_location(stack_index)

Returns the error location of the internal module to the message of last error related to this resource.

It might always return empty string depending on the settings.

Parameters:stack_index (int) – The index of error stack. A valid result will be returned only if a value which has more than 0 and less than the stack size is specified.
Returns:The string to store the error location information.
Return type:str
get_message(stack_index)

Returns the message of last error related to this resource.

Parameters:stack_index (int) – The index of error stack. A valid result will be returned only if a value which has more than 0 and less than the stack size is specified.
Returns:the error message
Return type:str
is_timeout = False

Read-only attribute to determine whether the result of the requested process shows the error code corresponding to the error that occurred when the requested process is not completed within a predetermined time

class IndexType

Bases: enum.IntEnum

Represents the type(s) of indexes set on a Container.

If DEFAULT is specified, the following types of indexes are selected depending on the Container type and corresponding Column type.

(Column) Type Collection TimeSeries
STRING TREE TREE
BOOL TREE TREE
Numeric type TREE TREE
TIMESTAMP TREE TREE
GEOMETRY SPATIAL (None)
BLOB (None) (None)
ARRAY (None) (None)
DEFAULT = -1

Indicates a default index.

HASH = 2

Indicates a hash index. This type of index can be set on STRING/BOOL/BYTE/SHORT/INTEGER/LONG/FLOAT/DOUBLE/TIMESTAMP types of Columns in Collection. It cannot be set on Columns in TimeSeries.

SPATIAL = 4

Indicates a spatial index. This index type can be applied to only GEOMETRY type of Columns in Collection. It cannot be set on Columns in TimeSeries.

TREE = 1

Indicates a tree index. This index can be applied to STRING/BOOL/BYTE/SHORT/INTEGER/LONG/FLOAT/DOUBLE/TIMESTAMP types of Columns of any type of Container, except the Column corresponding to the Row key of TimeSeries.

class PartitionController

Bases: object

Controller for acquiring and processing the partition status.

A partition is a theoretical region where data is stored. It is used to perform operations based on the data arrangement in a GridDB cluster.

get_container_count(partition_index)

Get the total number of containers belonging to a specified partition.

The calculated quantity when determining the number of containers is generally not dependent on the number of containers.

Parameters:partition_index (int) – the partition index, from 0 to the number of partitions minus one
Returns:the number of Container
Return type:int
get_container_names(partition_index, start, limit)

Get a list of the Container names belonging to a specified partition.

For the specified partition, the sequence of the list of acquisition results before and after will not be changed when the relevant Container is excluded even if a Container is newly created, its composition changed or the Container is deleted. All other lists are compiled in no particular order. No duplicate names will be included.

If the upper limit of the number of acquisition cases is specified, the cases will be cut off starting from the ones at the back if the upper limit is exceeded. If no relevant specified condition exists, a blank list is returned.

Parameters:
  • partition_index (int) – the partition index, from 0 to the number of partitions minus one
  • start (int) – the start position of the acquisition range. A value must be greater than or equal to 0
  • limit (int) – the upper limit of the number of cases acquired. It is optional. If not specified or limit < 0, it is considered as no upper limit.
Returns:

the list of Container name

Return type:

list[str]

get_partition_index_of_container(container_name)

Get the partition index corresponding to the specified Container name.

Once a GridDB cluster is constructed, there will not be any changes in the partitions of the destination that the Container belongs to and the partition index will also be fixed. Whether there is a Container corresponding to the specified name or not does not depend on the results.

Information required in the computation of the partition index is cached and until the next cluster failure and cluster node failure is detected, no inquiry will be sent to the GridDB cluster again.

Parameters:container_mame (str) – Container name
Returns:the partition index
Return type:int
partion_count = None

the number of partitions in the target GridDB cluster. (Read-only attribute)

class Query

Bases: object

Provides the functions of holding the information about a query related to a specific Container, specifying the options for fetching and retrieving the result.

fetch(for_update=False)

Executes a specified query with the specified option and returns a set of Rows as an execution result.

It locks all target Rows if True is specified as forUpdate . If the target Rows are locked, update operations on the Rows by any other transactions are blocked while a relevant transaction is active. True can be specified only if the auto commit mode is disabled on a relevant Container.

When new set of Rows are obtained, any Row operation via RowSet as the last result of specified query is prohibited.

If the system tries to acquire a large number of Rows all at once, the upper limit of the communication buffer size managed by the GridDB node may be reached, possibly resulting in a failure. Refer to “System limiting values” in the Appendix of GridDB API Reference for the upper limit size.

Parameters:for_update (bool) – indicates whether it requests a lock for update or not
Returns:RowSet instance
Return type:RowSet
get_row_set()

Returns RowSet as the latest result.

Once RowSet is returned, it cannot be obtained until the new query is executed.

Returns:RowSet instance as the latest result
Return type:RowSet
set_fetch_options(limit=-1, partial=False)

Sets an fetch options for a result acquisition.

Parameters:
  • limit (int) – The maximum number of Rows to be fetched. If the number of Rows in a result exceeds the maximum, the maximum number of Rows counting from the 0-th in RowSet are fetched. The rest of the Rows in the result cannot be fetched. Negative values are not available. If the setting is omitted, the limit is not defined.
  • partial (bool) – Used to set the partial execution mode.
class QueryAnalysisEntry

Bases: object

Represents one of information entries composing a query plan and the results of analyzing a query operation.

get()

Returns one of information entries composing a query plan and the results of analyzing a query operation.

Returns:Query plan and the results of analyzing a query operation
Return type:list
class RowKeyPredicate

Bases: object

Represents the condition that a row key satisfies.

This is used as the search condition in Store.multi_get().

There are two types of conditions, range condition and individual condition. The two types of conditions cannot be specified at the same time. If the condition is not specified, it means that the condition is satisfied in all the target row keys.

get_distinct_keys()

Returns a list of the values of the Row keys that configure the individual condition.

Returns:List of the values of the Row keys that configure the individual condition
Return type:list[object]
get_range()

Returns the value of Row key at the start and end position of the range condition.

Returns:The value of Row key at the start and end position of the range condition
Return type:[object, object]
key_type = None

The type of Row key used as a search condition. (Read-only attribute)

set_distinct_keys(keys)

Sets list of the elements in the individual condition.

Parameters:keys (list[object]) – List of the elements in the individual condition
set_range(start, end)

Sets the value of Row key as the start and end position of the range conditions.

Parameters:
  • start (object) – The value of the Row key as the start position
  • end (object) – The value of the Row key as the end position
class RowSet

Bases: object

Manages a set of Rows obtained by a query.

It has a function of per-Row and per-Row-field manipulation and holds a cursor state to specify a target Row. The cursor is initially located just before the head of a Row set.

get_column_names()

Get a list of column names.

Returns:A list of column names.
Return type:list[str]
has_next()

Returns whether a Row set has at least one Row ahead of the current cursor position.

Returns:True if a Row exists ahead of the current cursor position
Return type:bool
next()

Moves the cursor to the next Row in a Row set and returns the Row object at the moved position.

Returns:The object that can be extracted from RowSet.
Return type:list[object], AggregationResult or QueryAnalysisEntry
remove()

Removes the Row at the current cursor position.

It can be used only for RowSet obtained with locking enabled.

size = None

The size of Row set. (Read-only attribute)

type = 0

The type of content that can be extracted from RowSet. (Read-only attribute)

update(row)

Updates the values except a Row key of the Row at the cursor position, using the specified Row object.

Parameters:row (list[object]) – A Row object representing the content of a Row to be updated. The contents of Row key are ignored.
class RowSetType

Bases: enum.IntEnum

Represents the type of content that can be extracted from RowSet.

AGGREGATION_RESULT = 1

Aggregation result

CONTAINER_ROWS = 0

Row set in a Container

QUERY_ANALYSIS = 2

Represents one of information entries composing a query plan and the results of analyzing a query operation.

class Store

Bases: object

Provides functions to manipulate the entire data managed in one GridDB system.

A function to add, delete, or change the composition of Collection and TimeSeries Containers as well as to process the Rows constituting a Container is provided.

Regardless of container types, etc., multiple container names different only in uppercase and lowercase ASCII characters cannot be defined in a database. See the GridDB Technical Reference for the details. In the operations specifying a container name, uppercase and lowercase ASCII characters are identified as the same unless otherwise noted.

Thread safety of each method is not guaranteed.

create_row_key_predicate(type)

Creates a matching condition with the specified Type as the type of Row key.

The target Container must have a Row key, and it must be the same type as the specified Type .

The type of Row key that can be set must be the same type that is allowed by the individual Container type derived from Container .

Parameters:type (Type) – the type of Row key used as a matching condition
Returns:RowKeyPredicate instance
Return type:RowKeyPredicate
drop_container(name)

Delete a Container with the specified name.

If the specified Container is already deleted, nothing is changed.

When a transaction(s) is active in a target Container, it deletes the Container after waiting for the transaction completion.

Parameters:name (str) – Container name to be processed
fetch_all(query_list)

Query execution and fetch is carried out on a specified arbitrary number of Query , with the request unit enlarged as much as possible.

For each Query included in a specified query column, perform a similar query execution and fetch as when Query.fetch() is performed individually and set the RowSet in the results. Use get_row_set() to extract the execution results of each Query . However, unlike the case when carried out individually, the target node is requested for the same storage destination, etc. with a unit that is as large as possible. Based on this, the larger the number of elements in the list, the higher is the possibility that the number of correspondences with the target node will be reduced. Query in a list are not executed in any particular order.

Only a Query that has not been closed, including corresponding Container acquired via the specified Store instance, can be included in a specified query column. Like a fetch() , the Row operations via RowSet finally generated and held by each Query will be unavailable. If the same instance is included multiple times in an array, the behavior will be the same as the case in which the respective instances differ.

Like other Container or Row operations, consistency between Containers is not guaranteed. Therefore, the processing results for a certain Container may be affected by other operation commands that have been completed prior to the start of the process.

The commit mode of each Container corresponding to the specified Query can be used in either the auto commit mode or manual commit mode. The transaction status is reflected in the execution results of the query. If the operation is completed normally, the corresponding transaction of each Container will not be aborted so long as the transaction timeout time has not been reached.

If an exception occurs in the midst of processing each Query , a new RowSet may be set for only some of the Query . In addition, uncommitted transactions of each Query corresponding to the designated Container may be aborted.

If the system tries to acquire a large number of Rows all at once, the upper limit of the communication buffer size managed by the GridDB node may be reached, possibly resulting in a failure. Refer to “System limiting values” in the Appendix of GridDB API Reference for the upper limit size.

Parameters:query_list (list[Query]) – A list of target Queries
get_container(name)

Get a Container instance whose Rows can be processed using a Row .

Parameters:name (str) – Container name to be processed
Returns:Container instance. If the Container with the specified name does not exist, None is returned.
Return type:Container
get_container_info(name)

Get information related to a Container with the specified name.

A name stored in GridDB is set for the Container name to be included in a returned ContainerInfo . Therefore, compared to the specified Container name, the notation of the ASCII uppercase characters and lowercase characters may differ.

Parameters:name (str) – Container name to be processed
Returns:ContainerInfo instance for storing information about the Container with the specified name. If the Container with the specified name does not exist, None is returned.
Return type:ContainerInfo
multi_get(predicate_entry)

Returns an arbitrary number and range of Rows in any Container based on the specified conditions, with the request unit enlarged as much as possible.

Returns the Row contents in accordance with the conditions included in the specified entry column, similar to invoking Container.get() or Query.fetch() individually. However, unlike the case when carried out individually, the target node is requested for the same storage destination, etc. with a unit that is as large as possible. Based on this, the larger the total number of Rows conforming to the conditions and the larger the total number of target Containers, the higher is the possibility that the number of correspondences with the target node will be reduced.

A specified condition entry column is composed of an arbitrary number of condition entries that adopt the Container name as the key and the acquisition condition represented by RowKeyPredicate as the value. Multiple instances with the same RowKeyPredicate can also be included. In addition, a subject Container may be a mixture of different Container types and column layouts. However, there are some acquisition conditions that cannot be evaluated due to the composition of the Container. Refer to the definitions of the various setting functions for RowKeyPredicate for the specific restrictions. In addition, the specified Container name must be a real Container. It is prohibited to set NULL in the Container name or the acquisition condition.

An acquired entry column is composed of entries that adopt the Container name as its key and column of Row objects as its value. All entries included in a specified entry as acquisition conditions are included in an acquired entry column. If multiple entries pointing the same Container are included in a specified condition entry column, a single entry consolidating these is stored in the acquired entry column. If multiple Row objects are included in the same list, the stored order follows the Container type and the definition of the individual Container type derived from the corresponding Container . If there is no Row corresponding to the specified Container, the number of elements in corresponding column of Row object will be 0.

Like other Container or Row operations, consistency between Containers is not guaranteed. Therefore, the processing results for a certain Container may be affected by other operation commands that have been completed prior to the start of the process.

Like Container.get() or Query.fetch() , a transaction cannot be maintained and requests for updating locks cannot be made.

If the system tries to acquire a large number of Rows all at once, the upper limit of the communication buffer size managed by the GridDB node may be reached, possibly resulting in a failure. Refer to “System limiting values” in the Appendix of GridDB API Reference for the upper limit size.

Parameters:predicate_entry (dict[str, RowKeyPredicate]) – The column of condition entry consisting of a combination of the target Container name and the acquisition condition. It consists of the array of RowKeyPredicate
Returns:dict-type data consisting of container name and the list of Row
Return type:dict[str, list[list[object]]]
multi_put(container_entry)

New creation or update operation is carried out on an arbitrary number of rows of a Container, with the request unit enlarged as much as possible.

For each Row object included in a specified entry column, a new creation or update operation is carried out just like the case when Container.put() is invoked individually. However, unlike the case when carried out individually, the target node is requested for the same storage destination, etc. with a unit that is as large as possible. Based on this, the larger the total number of Row objects specified and the larger the total number of target Containers, the higher is the possibility that the number of correspondences with the target node will be reduced.

A specified entry column is composed of an arbitrary number of entries that adopt the Container name as its key and the column of Row objects as its value. A subject Container may be a mixture of different Container types and column layouts. However, the Containers must already exist. NULL can not be set as the Container name in the entry column. Also NULL can not be set as the array address to the column of Row objects if the number of elements in the column of Row objects is positive value.

An arbitrary number of Row with the same column layout as the subject Container can be included in each column of Row objects. In the current version, all the column order must also be the same. The Container cannot include NULL as an element of the column of Row objects. Depending on the Container type and setting, the same restrictions as Container.put() are established for the contents of Rows that can be operated. If there are multiple columns of Row objects having the same Row key targeting the same Container in the designated entry column, the contents of the rear-most Row object having a Row key with the same value will be reflected using the element order of entry column as a reference if it is between different lists, or the element order of the column of Row object as a reference if it is within the same column of Row object. The transaction cannot be maintained and the lock cannot continue to be retained. However, if the lock that affects the target Row is secured by an existing transaction, the system will continue to wait for all the locks to be released. Like other Container or Row operations, consistency between Containers is not guaranteed. Therefore, the processing results for a certain Container may be affected by other operation commands that have been completed prior to the start of the process. If an error occurs in the midst of processing a Container and its Rows, only the results for some of the Rows of some of the Containers may remain reflected.

Parameters:container_entry (dict[str, list[list[object]]]) – dict-type data consisting of container name and the list of Row
partition_controller = None

PartitionController instance corresponding to GridDB cluster. (Read-only attribute)

put_container(info, modifiable=False)

Newly creates or update a Container with the specified ContainerInfo .

Parameters:
  • info (ContainerInfo) – Container information to be processed
  • modifiable (bool) – Indicates whether the column layout of the existing Container can be modified or not
Returns:

Container instance

Return type:

Container

class StoreFactory

Bases: object

Manage a Store instance.

It manages the client settings shared by Store instances and used connections.

To access GridDB, you need to get a Store instance using this Factory.

get_instance()

Returns a StoreFactory instance.

Returns:StoreFactory instance
Return type:StoreFactory
get_store(host=None, port=None, cluster_name=None, database=None, username=None, password=None, notification_member=None, notification_provider=None)

Returns a Store with the specified properties.

When obtaining Store, it just searches for the name of a master node (hereafter, a master) administering each Container as necessary, but authentication is not performed. When a client really needs to connect to a node corresponding to each Container , authentication is performed.

A new Store instance is created by each call of this method. Operations on different Store instances and related resources are thread safe. That is, if some two resources are each created based on Store instances or they are just Store instances, and if they are related to different Store instances respectively, any function related to one resource can be called, no matter when a function related to the other resource may be called from any thread. However, since thread safety is not guaranteed for Store itself, it is not allowed to call a method of a single Store instance from two or more threads at an arbitrary time.

Parameters:
  • host (str) – An IP address (IPV4 only) for receiving a notification used for autodetection of a master. Or a destination host name (IP address).
  • port (int) – A port number for receiving a notification used for autodetection of a master. Or a destination port number.
  • cluster_name (str) – A cluster name.
  • database (str) – A database name.
  • username (str) – A user name.
  • password (str) – A password for user authentication.
  • notification_member (str) – A list of address and port pairs in cluster. It is used to connect to cluster which is configured with FIXED_LIST mode, and specified as ‘(Address1):(Port1),(Address2):(Port2),...’.
  • notification_provider (str) – A URL of address provider. It is used to connect to cluster which is configured with PROVIDER mode.
Returns:

Store instance

Return type:

Store

get_version()

Returns the version of this client

Returns:the version of this client
Return type:str
class TimeUnit

Bases: enum.IntEnum

Represents the unit of the elapsed time period of a Row to be used as the basis of the validity period.

DAY = 2
HOUR = 3
MILLISECOND = 6
MINUTE = 4
MONTH = 1
SECOND = 5
YEAR = 0
class TimestampUtils

Bases: object

Provides the utilities for manipulating time data.

get_time_millis(timestamp)

Caluculate int-type timestamp in millisecond from datetime.timestamp()

Parameters:timestamp (float) – timestamp for Python
Returns:int-type timestamp in millisecond
Return type:int
class Type

Bases: enum.IntEnum

Represents the type of field values in GridDB.

BLOB = 10

BLOB type

BOOL = 1

BOOL type

BOOL_ARRAY = 12

BOOL ARRAY type

BYTE = 2

BYTE type

BYTE_ARRAY = 13

BYTE ARRAY type

DOUBLE = 7

DOUBLE type

DOUBLE_ARRAY = 18

DOUBLE ARRAY type

FLOAT = 6

FLOAT type

FLOAT_ARRAY = 17

FLOAT ARRAY type

GEOMETRY = 9

GEOMETRY type

INTEGER = 4

INTEGER type

INTEGER_ARRAY = 15

INTEGER ARRAY type

LONG = 5

LONG type

LONG_ARRAY = 16

LONG ARRAY type

SHORT = 3

SHORT type

SHORT_ARRAY = 14

SHORT ARRAY type

STRING = 0

STRING type

STRING_ARRAY = 11

STRING ARRAY type

TIMESTAMP = 8

TIMESTAMP type

TIMESTAMP_ARRAY = 19

TIMESTAMP ARRAY type

class TypeOption

Bases: enum.IntEnum

Represents NOT NULL constrant.

NOT_NULL = 4

NOT NULL. Indicates a Column with NOT NULL constraint.

NULLABLE = 2

Nullable. Indicates a Column without NOT NULL constraint.