stpy.fabric package¶
Submodules¶
stpy.fabric.enums module¶
-
class
stpy.fabric.enums.
DataspaceType
¶ Bases:
object
-
FSPACE
= 'FSPACE'¶
-
HSPACE
= 'HSPACE'¶
-
QSPACE
= 'QSPACE'¶
-
TSPACE
= 'TSPACE'¶
-
USPACE
= 'USPACE'¶
-
-
class
stpy.fabric.enums.
EventScope
¶ Bases:
object
-
CLUSTER
= 'CLUSTER'¶
-
GLOBAL
= 'GLOBAL'¶
-
INHERITED
= 'INHERITED'¶
-
LOCAL
= 'LOCAL'¶
-
OBSERVABLE
= 'OBSERVABLE'¶
-
-
class
stpy.fabric.enums.
HTTPFabricConnectionState
¶ Bases:
object
-
CLOSED
= 'CLOSED'¶
-
FABRIC_CONNECTION_LOST
= 'FABRIC_CONNECTION_LOST'¶
-
OPENED
= 'OPENED'¶
-
RECONNECT_FAILED
= 'RECONNECT_FAILED'¶
-
REOPEN_END
= 'REOPEN_END'¶
-
REOPEN_ERROR
= 'REOPEN_ERROR'¶
-
REOPEN_FAILED
= 'REOPEN_FAILED'¶
-
REOPEN_START
= 'REOPEN_START'¶
-
SERVER_CONNECTION_LOST
= 'SERVER_CONNECTION_LOST'¶
-
SERVER_CONNECTION_REPAIRED
= 'SERVER_CONNECTION_REPAIRED'¶
-
-
class
stpy.fabric.enums.
SQLType
¶ Bases:
object
-
ARRAY
= 'ARRAY'¶
-
BIGINT
= 'BIGINT'¶
-
BINARY
= 'BINARY'¶
-
BIT
= 'BIT'¶
-
BLOB
= 'BLOB'¶
-
BOOLEAN
= 'BOOLEAN'¶
-
CHAR
= 'CHAR'¶
-
CLOB
= 'CLOB'¶
-
DATE
= 'DATE'¶
-
DECIMAL
= 'DECIMAL'¶
-
DOUBLE
= 'DOUBLE'¶
-
EVENT
= 'EVENT'¶
-
FLOAT
= 'FLOAT'¶
-
FLOB
= 'FLOB'¶
-
INTEGER
= 'INTEGER'¶
-
LONG
= 'LONG'¶
-
LONGNVARCHAR
= 'LONGNVARCHAR'¶
-
LONGVARBINARY
= 'LONGVARBINARY'¶
-
LONGVARCHAR
= 'LONGVARCHAR'¶
-
NCHAR
= 'NCHAR'¶
-
NUMERIC
= 'NUMERIC'¶
-
NVARCHAR
= 'NVARCHAR'¶
-
OTHER
= 'OTHER'¶
-
REAL
= 'REAL'¶
-
SMALLINT
= 'SMALLINT'¶
-
STRING
= 'STRING'¶
-
TIME
= 'TIME'¶
-
TIMESTAMP
= 'TIMESTAMP'¶
-
TINYINT
= 'TINYINT'¶
-
UBIGINT
= 'UBIGINT'¶
-
UINTEGER
= 'UINTEGER'¶
-
URL
= 'URL'¶
-
USMALLINT
= 'USMALLINT'¶
-
UTINYINT
= 'UTINYINT'¶
-
VARBINARY
= 'VARBINARY'¶
-
VARCHAR
= 'VARCHAR'¶
-
stpy.fabric.http_dataspace_accessor module¶
-
class
stpy.fabric.http_dataspace_accessor.
HTTPDataspaceAccessor
(dataspaceType, dataspaceName, connection, nodeName=None)¶ Bases:
object
-
accessorId
= 0¶
-
autoSwitching
()¶
-
close
()¶
-
commit
()¶
-
executeQuery
(query, args=[])¶
-
getAutoCommit
()¶
-
getDownloadableLobSize
()¶
-
getFetchSize
()¶
-
getName
()¶
-
getRequestTimeout
()¶
-
getSessionContext
()¶
-
getTransactionIsolation
()¶
-
getTransferBufferSize
()¶
-
invokeLanguageRequest
(statement, timeout=None)¶
-
isAvailable
()¶
-
isOpened
()¶
-
isReadOnly
()¶
-
lock
= <_RLock owner=None count=0>¶
-
open
()¶
-
rollback
()¶
-
setAutoCommit
(autocommit)¶
-
setAutoSwitching
(autoSwitching)¶
-
setDownloadableLobSize
(downloadableLobSize)¶
-
setFetchSize
(fetchSize)¶
-
setReadOnly
(readOnly)¶
-
setRequestTimeout
(timeout)¶
-
setSessionContext
(sessionContext)¶
-
setTransactionIsolation
(level)¶
-
setTransferBufferSize
(transferBufferSize)¶
-
stpy.fabric.http_fabric_connection module¶
-
class
stpy.fabric.http_fabric_connection.
HTTPClientWrapper
(httpClient, url)¶ Bases:
object
-
closeQuiet
(client=None)¶
-
getHttpClient
()¶
-
lock
()¶
-
replaceClient
(httpClient)¶
-
unlock
()¶
-
-
class
stpy.fabric.http_fabric_connection.
HTTPFabricConnection
(url, username=None, password=None)¶ Bases:
object
-
addStateListener
(listener)¶
-
close
()¶
-
closeQuiet
()¶
-
createDataspaceAccessor
(nodeName, dataspaceType, dataspaceName)¶
-
createSLSession
(nodeName=None)¶
-
getConnectionReopenInterval
()¶
-
getName
()¶
-
getReconnectAttempts
()¶
-
getReconnectInterval
()¶
-
getStatistics
()¶
-
getTypeFactory
()¶
-
importSemanticType
(name)¶
-
isOpened
()¶
-
isReconnecting
()¶
-
isReopenOnAnyCall
()¶
-
open
()¶
-
password
(password)¶
-
ping
()¶
-
setConnectionReopenInterval
(connectionReopenInterval)¶
-
setHttpTimeoutMs
(httpTimeoutMs)¶
-
setReconnectAttempts
(reconnectAttempts)¶
-
setReconnectInterval
(reconnectInterval)¶
-
setReopenOnAnyCall
(isReopenOnAnyCall)¶
-
setSsl
(ssl)¶ - Sets SSL parameters. It is a dictionary of the following parameters:
- cert_reqs - specifies whether a certificate is required from the other side of the connection, and whether it will be validated if provided.
- Should be one of the following values:
- CERT_NONE or None - certificates ignored
- CERT_OPTIONAL - not required, but validated if provided
- CERT_REQUIRED - required and validated
If the value of this parameter is not CERT_NONE, then the ca_certs parameter must point to a file of CA certificates.
- ca_certs - file contains a set of concatenated ‘certification authority’ certificates, which are used to validate
certificates passed from the other end of the connection.
- ca_cert_dir - a directory containing CA certificates in multiple separate files, as supported by OpenSSL’s -CApath flag or
the capath argument to SSLContext.load_verify_locations().
ssl_version - specifies which version of the SSL protocol to use. Optional.
key_file and cert_file - optional files which contain a certificate to be used to identify the local side of the connection.
disable_warnings - specifies disable or not InsecureRequestWarning warning, by default True.
-
toString
()¶
-
username
(username)¶
-
-
class
stpy.fabric.http_fabric_connection.
HTTPFabricConnectionStateEvent
(state, params=None)¶ Bases:
object
stpy.fabric.http_fabric_exception module¶
-
exception
stpy.fabric.http_fabric_exception.
HTTPFabricException
(message, cause=None)¶ Bases:
exceptions.Exception
stpy.fabric.http_sl_session module¶
stpy.fabric.lobs module¶
- Dataspace supports the following types of large object:
- BLOB - binary large object
- CLOB - character large object
- FLOB - file large object
Dataspace LOBs(large objects) returned to client as objects with interface of Clob
or Blob
depending on type of lob.
Maximum size of lob data that will be downloaded at first time can be set with method:
HTTPDataspaceAccessor.setDownloadableLobSize(size)
Remaining lob data can be accessed with corresponding LOB methods.
If the size of returned LOB more than downloadable size, lob proxy will be returned.
NOTE: Lob objects allow reading lob data only.
-
class
stpy.fabric.lobs.
Blob
¶ Bases:
object
Interface for BLOB(binary large object) objects.
-
get_all_bytes
()¶ Retrieves and returns all blob content. :return: all blob content bytes
-
get_bytes
(pos, length)¶ Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes. If pos == 0 and length >= data length, original data will be returned.
Parameters: - pos – the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 0
- length – the number of consecutive bytes to be copied; the value for length must be 0 or greater
Returns:
-
length
()¶ Returns the number bytes in this BLOB. :return: the number bytes in this BLOB.
-
-
class
stpy.fabric.lobs.
Clob
¶ Bases:
object
Interface for CLOB(character large object) objects.
-
get_all_string
()¶ Retrieves and returns all clob content. :return: all blob content string
-
get_sub_string
(pos, length)¶ Retrieves sub string of the CLOB value that this Clob object represents, as a string. If pos == 0 and length >= data length, original string will be returned.
Parameters: - pos – the ordinal position of the first character in the CLOB value to be extracted; the first character is at position 0
- length – the number of consecutive characters to be copied; the value for length must be 0 or greater
Returns:
-
length
()¶ Returns the number bytes in this CLOB. :return: the number bytes in this CLOB.
-
stpy.fabric.row_set module¶
This module contains objects that represent returned RowSet
-
class
stpy.fabric.row_set.
ColumnDescriptor
¶ Bases:
object
-
name
()¶
-
nullable
()¶
-
precision
()¶
-
static
readFromMap
(map, descriptor=None, typeFactory=None)¶
-
scale
()¶
-
type
()¶
-
-
class
stpy.fabric.row_set.
Row
(meta=None)¶ Bases:
object
-
getColumnByIndex
(index)¶
-
getColumnByName
(name)¶
-
getColumns
()¶
-
getColumnsCount
()¶
-
static
readFromDataArray
(data, meta=None, typeFactory=None)¶
-
static
readFromMap
(map, meta=None, typeFactory=None)¶
-
-
class
stpy.fabric.row_set.
RowMetaData
¶ Bases:
object
-
getColumnByIndex
(columnIndex)¶
-
getColumnByName
(columnName)¶
-
getColumnCount
()¶
-
getColumnIndex
(columnName)¶
-
getColumns
()¶
-
static
readFromMap
(map, meta=None, typeFactory=None)¶
-
-
class
stpy.fabric.row_set.
RowSet
(meta=None)¶ Bases:
object
-
absolute
(row)¶ Moves the cursor to the given row number in this RowSet object.
Parameters: row – the number of the row to which the cursor should move. A positive number indicates the row number counting from the beginning of the result set; a negative number indicates the row number counting from the end of the result set Returns: True if the cursor is on the result set; False otherwise
-
afterLast
()¶
-
asRowSet
()¶
-
beforeFirst
()¶
-
close
()¶
-
first
()¶
-
getCurrentRow
()¶
-
getFetchSize
()¶
-
getMetaData
()¶
-
getPageSize
()¶
-
getRow
()¶
-
getRowAt
(index)¶
-
getRowCount
()¶
-
isAfterLast
()¶
-
isBeforeFirst
()¶
-
isClosed
()¶
-
isFirst
()¶
-
isLast
()¶
-
last
()¶
-
next
()¶
-
nextPage
()¶
-
previous
()¶
-
previousPage
()¶
-
static
readFromMap
(map, rowSet=None, typeFactory=None)¶
-
relative
(rowsCount)¶
-
setFetchSize
(fetchSize)¶
-
setPageSize
(pageSize)¶
-
stpy.fabric.sl_response module¶
-
class
stpy.fabric.sl_response.
PromptSLResponse
¶ Bases:
stpy.fabric.sl_response.SLResponse
-
static
readFromMap
(map, typeFactory=None)¶
-
static
stpy.fabric.type_converter module¶
-
class
stpy.fabric.type_converter.
TypeConverter
¶ Bases:
object
Interface for system and user defined converters. Provides methods to deserialize/serialize value from/to dictionary.
-
readFromMap
(rawValue, typeFactory=None)¶ Deserialize rawValue to object instance.
Parameters: - rawValue – primitive or dict
- typeFactory – type factory reference
Returns: object instance
-
typeClass
(name=None)¶ Returns type of object that can be converted by this converter. :param name: type name :return: type
-
writeToMap
(value, typeFactory=None)¶ Serialize specified value to dict. :param value: value :param typeFactory: type factory reference :return: dict
-
stpy.fabric.types_factory module¶
-
class
stpy.fabric.types_factory.
TypeFactory
¶ Bases:
object
- Type factory is a registry of::
- system types converters
- semantic types imported from dataspace runtime
- user defined converters for some types
- Once type is imported or registered in
TypeFacotry
:: - the object of this type can be created
- the object of this type can be serialized to json
- the object of this type can be deserialized from json
-
instantiateType
(name)¶ Create an instance of object with specified type name. :param name: type name :return: object instance
-
readFromMap
(rawValue, expectedType=None, raiseExceptionIfConverterNotFound=True)¶ - Deserializes object instance from raw value. Raw value can be a dictionary or primitive value.
- if raw value is primitive and no
expectedType
specified the same value will be returned. - if raw value is dictionary then value of @type key element will be used ar value type
- if
expectedType
is specified then it will be used as value type
- if raw value is primitive and no
Converter corresponding to value type will be used for deserialization.
Parameters: - rawValue – primitive value or dictionary
- expectedType – expected type of value
- raiseExceptionIfConverterNotFound – raise exception if converter not found or not
Returns: deserialized object instance
-
registerType
(name, converter)¶ Registers user defined converter for type with specified name. Converter should implement interface
TypeConverter
:param name: type name :param converter: converter should implement interfaceTypeConverter
-
typeDefault
(typeName)¶
-
unregisterType
(name)¶ Unregister converter for type with specified name. :param name: type name :return:
-
writeToMap
(value, valueType=None, raiseExceptionIfConverterNotFound=True)¶ Serializes specified value to dictionary. If
valueType
is not specified it will be calculated astype(value).__name__
Converter corresponding tovalueType
will be used for serialization.Parameters: - value – value to serialize
- valueType – value type
- raiseExceptionIfConverterNotFound – raise exception if converter not found or not
Returns: dictionary with serialized value