DBAPI-2¶
- class Type(value)[source]¶
Bases:
Enum
Type is the column type
- NULL = 0¶
- STRING = 1¶
- BOOLEAN = 2¶
- DATE = 3¶
- TIME = 4¶
- DATETIME = 5¶
- INTEGER = 6¶
- FLOAT = 7¶
- DECIMAL = 8¶
- JSON = 9¶
- OBJECT = 10¶
- class ColumnDescription(name, type, display_size, internal_size, precision, scale, null_ok)¶
Bases:
tuple
ColumnDescription provides name, type and nullability information
Create new instance of ColumnDescription(name, type, display_size, internal_size, precision, scale, null_ok)
- property display_size¶
Alias for field number 2
- property internal_size¶
Alias for field number 3
- property name¶
Alias for field number 0
- property null_ok¶
Alias for field number 6
- property precision¶
Alias for field number 4
- property scale¶
Alias for field number 5
- property type¶
Alias for field number 1
- class Cursor(conn: Connection)[source]¶
Bases:
object
Cursor is a database cursor object
This class should not be initiated directly. Use connection.cursor() method to create one.
- property connection: Connection¶
Returns the Connection object that created this cursor
- Returns:
The Connection of this cursor
- property description: Optional[List[ColumnDescription]]¶
Returns the descriptions of the columns
Get the descriptions after calling execute.
- Returns:
The list of column descriptions.
- property rowcount: int¶
Returns the number of rows in the result.
This is not supported by this driver and always
-1
is returned.- Returns:
-1
- property rownumber: Optional[int]¶
Returns the index of the cursor in the result set
- Returns:
0-based index of the cursor in the result set.
- execute(operation: str, params: Optional[Tuple] = None) None [source]¶
Executes the given query with optional parameters
- Parameters:
operation – A SQL string. Use question mark (
?
) as the placeholder if necessary.params – Optional tuple that contains the actual parameters to replace the placeholders in the query.
- executemany(operation: str, seq_of_params: Sequence[Tuple]) None [source]¶
Runs the given query with the list of parameters
Calling
executemany(sql, [params1, params2, ...]
is equivalent toexecute(sql, params1), execute(sql, params2), ...
- Parameters:
operation – A SQL string. Use question mark (
?
) as the placeholder if necessary.seq_of_params – Optional list of tuples that contains the actual parameters to replace the placeholders in the query.
- fetchone() Optional[SqlRow] [source]¶
Fetches a single row from the result
- Returns:
A single row if there are rows in the result or
None
.
- fetchmany(size: Optional[int] = None) List[SqlRow] [source]¶
Fetches the given number of rows from the result
- Parameters:
size – Optional number of rows to return.
- Returns:
List of rows. The list will have at most size items.
- class Connection(config: Config)[source]¶
Bases:
object
Connection object provides connection to the Hazelcast cluster
This class should not be initiated directly. Use
connect
method to create an instance.- cursor() Cursor [source]¶
Creates and returns a new cursor object
- Returns:
Cursor object that uses this connection.
- property Error¶
- property Warning¶
- property InterfaceError¶
- property DatabaseError¶
- property InternalError¶
- property OperationalError¶
- property ProgrammingError¶
- property IntegrityError¶
- property DataError¶
- property NotSupportedError¶
- connect(config=None, *, dsn='', user: Optional[str] = None, password: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None, cluster_name: Optional[str] = None) Connection [source]¶
Creates a new Connection to the cluster
- Parameters:
config – A Config object
dsn – Dota Source Name in the following format:
hz://[user:password]@addr1:port1[?opt1=value1[&opt2=value2 ...]]
user – Optional user name for authenticating to the cluster.
password – Optional password for authenticating to the cluster.
host – Hostname or IP address of the cluster. By default
localhost
.port – Port of the cluster. By default
5701
.cluster_name – Name of the cluster. By default
dev
.
- Returns:
Connection object.
- exception InternalError[source]¶
Bases:
DatabaseError
- exception OperationalError[source]¶
Bases:
DatabaseError
- exception ProgrammingError[source]¶
Bases:
DatabaseError
- exception IntegrityError[source]¶
Bases:
DatabaseError
- exception DataError[source]¶
Bases:
DatabaseError
- exception NotSupportedError[source]¶
Bases:
DatabaseError