DBAPI-2¶
- class Type(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumType 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: str, type: Type, display_size: None, internal_size: None, precision: None, scale: None, null_ok: bool)¶
Bases:
NamedTupleColumnDescription provides name, type and nullability information
Create new instance of ColumnDescription(name, type, display_size, internal_size, precision, scale, null_ok)
- display_size: None¶
Alias for field number 2
- internal_size: None¶
Alias for field number 3
- name: str¶
Alias for field number 0
- null_ok: bool¶
Alias for field number 6
- precision: None¶
Alias for field number 4
- scale: None¶
Alias for field number 5
- class Cursor(conn: Connection)[source]¶
Bases:
objectCursor 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: List[ColumnDescription] | None¶
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
-1is returned.- Returns:
-1
- property rownumber: int | None¶
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: Tuple | None = 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() SqlRow | None[source]¶
Fetches a single row from the result
- Returns:
A single row if there are rows in the result or
None.
- fetchmany(size: int | None = 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:
objectConnection object provides connection to the Hazelcast cluster
This class should not be initiated directly. Use
connectmethod 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: str = None, password: str = None, host: str = None, port: int = None, cluster_name: 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