sttp.data package

Submodules

sttp.data.callbackerrorlistener module

class sttp.data.callbackerrorlistener.CallbackErrorListener(callback: Callable[[str], None] | None = None)[source]

Bases: ErrorListener

Defines a implementation of an ANTLR error listener that reports any parsing exceptions to a user defined callback.

parsingexception_callback

Defines a callback for reporting ANTLR parsing exceptions.

syntaxError(recognizer, offendingSymbol, line, column, msg, e)[source]

Called when ANTLR parser encounters a syntax error.

sttp.data.columnexpression module

class sttp.data.columnexpression.ColumnExpression(dataColumn: DataColumn)[source]

Bases: Expression

Represents a DataColumn expression from a DataTable.

property datacolumn: DataColumn

Gets the DataColumn associated with this ColumnExpression.

property expressiontype: ExpressionType

Gets the type of this ColumnExpression.

sttp.data.constants module

sttp.data.constants.EXPRESSIONVALUETYPELEN = 9

Defines the number of elements in the ExpressionValueType enumeration.

class sttp.data.constants.ExpressionFunctionType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Defines an enumeration of possible expression function types.

ABS = 0

Defines a function type that returns the absolute value of the specified numeric expression.

CEILING = 1

Defines a function type that returns the smallest integer greater than or equal to the specified numeric expression.

COALESCE = 2

Defines a function type that returns the first non-null value from the specified expression list.

CONTAINS = 4

Defines a function type that returns a boolean value indicating whether the specified string expression contains the specified substring.

CONVERT = 3

Defines a function type that converts the specified expression to the specified data type.

DATEADD = 5

Defines a function type that adds the specified number of specified TimeInterval units to the specified date expression.

DATEDIFF = 6

Defines a function type that returns the number of specified TimeInterval units between the specified date expressions.

DATEPART = 7

Defines a function type that returns the specified TimeInterval unit from the specified date expression.

ENDSWITH = 8

Defines a function type that returns a boolean value indicating whether the specified string expression ends with the specified substring.

FLOOR = 9

Defines a function type that returns the largest integer less than or equal to the specified numeric expression.

IIF = 10

Defines a function type that returns the first expression if the specified boolean expression is true, otherwise returns the second expression.

INDEXOF = 11

Defines a function type that returns the zero-based index of the first occurrence of the specified substring in the specified string expression.

ISDATE = 12

Defines a function type that returns a boolean value indicating whether the specified string expression is a valid date.

ISGUID = 14

Defines a function type that returns a boolean value indicating whether the specified string expression is a valid GUID.

ISINTEGER = 13

Defines a function type that returns a boolean value indicating whether the specified string expression is a valid integer.

ISNULL = 15

Defines a function type that returns a boolean value indicating whether the specified expression is null.

ISNUMERIC = 16

Defines a function type that returns a boolean value indicating whether the specified string expression is a valid numeric value.

LASTINDEXOF = 17

Defines a function type that returns the zero-based index of the last occurrence of the specified substring in the specified string expression.

LEN = 18

Defines a function type that returns the length of the specified string expression.

LOWER = 19

Defines a function type that returns the specified string expression converted to lower if self.value ==.

MAXOF = 20

Defines a function type that returns the maximum value of the specified expression list.

MINOF = 21

Defines a function type that returns the minimum value of the specified expression list.

NOW = 22

Defines a function type that returns the current local date and time.

NTHINDEXOF = 23

Defines a function type that returns the zero-based index of the nth occurrence of the specified substring in the specified string expression.

POWER = 24

Defines a function type that returns the specified numeric expression raised to the specified power.

REGEXMATCH = 25

Defines a function type that returns a boolean value indicating whether the specified string expression matches the specified regular expression.

REGEXVAL = 26

Defines a function type that returns the first matching value of the specified regular expression in the specified string expression.

REPLACE = 27

Defines a function type that returns the specified string expression with the specified substring replaced with the specified replacement string.

REVERSE = 28

Defines a function type that returns the specified string expression with the characters in reverse order.

ROUND = 29

Defines a function type that returns the specified numeric expression rounded to the specified number of decimal places.

SPLIT = 30

Defines a function type that returns the zero-based nth string value from the specified string expression split by the specified delimiter, or null if out of range.

SQRT = 31

Defines a function type that returns the square root of the specified numeric expression.

STARTSWITH = 32

Defines a function type that returns a boolean value indicating whether the specified string expression starts with the specified substring.

STRCMP = 34

Defines a function type that returns an integer value representing the comparision of the specified left and right strings. Returned value will be -1 if left is less-than right, 1 if left is greater-than right, or 0 if left equals right.

STRCOUNT = 33

Defines a function type that returns the number of occurrences of the specified substring in the specified string expression.

SUBSTR = 35

Defines a function type that returns a substring of the specified string expression starting at the specified index and with the specified length.

TRIM = 36

Defines a function type that returns the specified string expression with the specified characters trimmed from the beginning and end.

TRIMLEFT = 37

Defines a function type that returns the specified string expression with the specified characters trimmed from the beginning.

TRIMRIGHT = 38

Defines a function type that returns the specified string expression with the specified characters trimmed from the end.

UPPER = 39

Defines a function type that returns the specified string expression converted to upper if self.value ==.

UTCNOW = 40

Defines a function type that returns the current date and time in UTC.

class sttp.data.constants.ExpressionOperatorType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Defines an enumeration of possible expression operator types.

ADD = 3

Defines an operator type + that adds the left and right expressions.

AND = 24

Defines an operator type AND that returns a boolean value indicating whether the left expression and the right expression are both true.

BITSHIFTLEFT = 5

Defines an operator type << that shifts the left expression left by the number of bits specified by the right expression.

BITSHIFTRIGHT = 6

Defines an operator type >> that shifts the left expression right by the number of bits specified by the right expression.

BITWISEAND = 7

Defines an operator type & that performs a bitwise AND operation on the left and right expressions.

BITWISEOR = 8

Defines an operator type | that performs a bitwise OR operation on the left and right expressions.

BITWISEXOR = 9

Defines an operator type ^ that performs a bitwise XOR operation on the left and right expressions.

DIVIDE = 1

Defines an operator type / that divides the left and right expressions.

EQUAL = 14

Defines an operator type = or == that returns a boolean value indicating whether the left expression is equal to the right expression.

EQUALEXACTMATCH = 15

Defines an operator type === that returns a boolean value indicating whether the left expression is equal to the right expression, case-sensitive.

GREATERTHAN = 12

Defines an operator type > that returns a boolean value indicating whether the left expression is greater than the right expression.

GREATERTHANOREQUAL = 13

Defines an operator type >= that returns a boolean value indicating whether the left expression is greater than or equal to the right expression.

ISNOTNULL = 19

Defines an operator type IS NOT NULL that returns a boolean value indicating whether the left expression is not null.

ISNULL = 18

Defines an operator type IS NULL that returns a boolean value indicating whether the left expression is null.

LESSTHAN = 10

Defines an operator type < that returns a boolean value indicating whether the left expression is less than the right expression.

LESSTHANOREQUAL = 11

Defines an operator type <= that returns a boolean value indicating whether the left expression is less than or equal to the right expression.

LIKE = 20

Defines an operator type LIKE that returns a boolean value indicating whether the left expression matches the right expression patten.

LIKEEXACTMATCH = 21

Defines an operator type LIKE BINARY or LIKE === that returns a boolean value indicating whether the left expression matches the right expression patten, case-sensitive.

MODULUS = 2

Defines an operator type % that returns the remainder of the left and right expressions.

MULTIPLY = 0

Defines an operator type * that multiplies the left and right expressions.

NOTEQUAL = 16

Defines an operator type <> or != that returns a boolean value indicating whether the left expression is not equal to the right expression.

NOTEQUALEXACTMATCH = 17

Defines an operator type !== that returns a boolean value indicating whether the left expression is not equal to the right expression, case-sensitive.

NOTLIKE = 22

Defines an operator type NOT LIKE that returns a boolean value indicating whether the left expression does not match the right expression patten.

NOTLIKEEXACTMATCH = 23

Defines an operator type NOT LIKE BINARY or NOT LIKE === that returns a boolean value indicating whether the left expression does not match the right expression patten, case-sensitive.

OR = 25

Defines an operator type OR that returns a boolean value indicating whether the left expression or the right expression is true.

SUBTRACT = 4

Defines an operator type - that subtracts the right expression from the left expression.

class sttp.data.constants.ExpressionType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Defines an enumeration of possible expression types.

COLUMN = 2

Column expression type.

FUNCTION = 4

Function expression type.

INLIST = 3

In-list expression type.

OPERATOR = 5

Operator expression type.

UNARY = 1

Unary expression type.

VALUE = 0

Value expression type.

class sttp.data.constants.ExpressionUnaryType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Defines an enumeration of possible unary expression types.

MINUS = 1

Negative unary expression type, i.e., -.

NOT = 2

Not unary expression type, i.e., ~ or !.

PLUS = 0

Positive unary expression type, i.e., +.

class sttp.data.constants.ExpressionValueType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Defines an enumeration of possible expression value data types. These expression value data types are reduced to a reasonable set of possible types that can be represented in a filter expression. All data table column values will be mapped to these types.

BOOLEAN = 0

Boolean value type for an expression, i.e., bool.

DATETIME = 7

DateTime value type for an expression, i.e., datetime.datetime.

DECIMAL = 3

Decimal value type for an expression, i.e., decimal.Decimal.

DOUBLE = 4

Double value type for an expression, i.e., numpy.float64.

GUID = 6

GUID value type for an expression, i.e., uuid.UUID.

INT32 = 1

32-bit integer value type for an expression, i.e., numpy.int32.

INT64 = 2

64-bit integer value type for an expression, i.e., numpy.int64.

STRING = 5

String value type for an expression, i.e., str.

UNDEFINED = 8

Undefined value type for an expression, i.e., None.

class sttp.data.constants.TimeInterval(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Defines enumeration of possible DateTime intervals.

DAY = 3

Represents the day part (1-31) of a DateTime expression.

DAYOFYEAR = 2

Represents the day of the year (1-366) of a DateTime expression.

HOUR = 6

Represents the hour part (0-23) of a DateTime expression.

MILLISECOND = 9

Represents the millisecond part (0-999) of a DateTime expression.

MINUTE = 7

Represents the minute part (0-59) of a DateTime expression.

MONTH = 1

Represents the month part (1-12) of a DateTime expression.

SECOND = 8

Represents the second part (0-59) of a DateTime expression.

WEEK = 4

Represents the week part (1-53) of a DateTime expression.

WEEKDAY = 5

Represents the weekday part (0-6) of a DateTime expression.

YEAR = 0

Represents the year part of a DateTime expression.

classmethod parse(name: str) TimeInterval | None[source]
sttp.data.constants.derive_arithmetic_operationvaluetype(operationtype: ExpressionOperatorType, leftvaluetype: ExpressionValueType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_arithmetic_operationvaluetype_fromboolean(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_arithmetic_operationvaluetype_fromdecimal(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_arithmetic_operationvaluetype_fromdouble(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_arithmetic_operationvaluetype_fromint32(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_arithmetic_operationvaluetype_fromint64(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_boolean_operationvaluetype(operationtype: ExpressionOperatorType, leftvaluetype: ExpressionValueType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype(operationtype: ExpressionOperatorType, leftvaluetype: ExpressionValueType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromboolean(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromdatetime(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromdecimal(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromdouble(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromguid(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromint32(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_comparison_operationvaluetype_fromint64(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_integer_operationvaluetype(operationtype: ExpressionOperatorType, leftvaluetype: ExpressionValueType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_integer_operationvaluetype_fromboolean(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_integer_operationvaluetype_fromint32(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_integer_operationvaluetype_fromint64(operationtype: ExpressionOperatorType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.derive_operationvaluetype(operationtype: ExpressionOperatorType, leftvaluetype: ExpressionValueType, rightvaluetype: ExpressionValueType) Tuple[ExpressionValueType, Exception | None][source]
sttp.data.constants.is_integertype(type: ExpressionValueType) bool[source]

Determines if the specified expression value type is an integer type.

sttp.data.constants.is_numerictype(type: ExpressionValueType) bool[source]

Determines if the specified expression value type is a numeric type.

sttp.data.datacolumn module

class sttp.data.datacolumn.DataColumn(parent: DataTable, name: str, datatype: DataType, expression: str = Ellipsis)[source]

Bases: object

Represents a column, i.e., a field, in a DataTable defining a name and a data type. Data columns can also be computed where its value would be derived from other columns and functions (https://sttp.github.io/documentation/filter-expressions/) defined in an expression.

property computed: bool

Gets a flag that determines if the DataColumn is a computed value, i.e., has a defined expression.

property datatype: DataType

Gets the column DataType enumeration value of the DataColumn.

property expression: str

Gets the column expression value of the DataColumn, if any.

property index: int

Gets the index of the DataColumn within its parent DataTable columns collection.

property name: str

Gets the column name of the DataColumn.

property parent: DataTable

Gets the parent DataTable of the DataColumn.

sttp.data.datarow module

class sttp.data.datarow.DataRow(parent: DataTable)[source]

Bases: object

Represents a row, i.e., a record, in a DataTable defining a set of values for each defined DataColumn field in the DataTable columns collection.

booleanvalue(columnindex: int) Tuple[bool, bool, Exception | None][source]

Gets the boolean-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.BOOLEAN.

booleanvalue_byname(columnname: str) Tuple[bool, bool, Exception | None][source]

Gets the boolean-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.BOOLEAN.

columnvalue_as_string(column: DataColumn | None) str[source]

Reads the record value for the specified data column converted to a string. For any errors, an empty string will be returned.

static compare_datarowcolumns(leftrow: DataRow, rightrow: DataRow, columnindex: int, exactmatch: bool) Tuple[int, Exception | None][source]

Returns an integer comparing two DataRow column values for the specified column index. The result will be 0 if leftrow`==`rightrow, -1 if leftrow < rightrow, and +1 if leftrow > rightrow. An error will br returned if column index is out of range of either row, or row types do not match.

datetimevalue(columnindex: int) Tuple[datetime, bool, Exception | None][source]

Gets the datetime-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.DATETIME.

datetimevalue_byname(columnname: str) Tuple[datetime, bool, Exception | None][source]

Gets the datetime-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.DATETIME.

decimalvalue(columnindex: int) Tuple[Decimal, bool, Exception | None][source]

Gets the decimal-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.DECIMAL.

decimalvalue_byname(columnname: str) Tuple[Decimal, bool, Exception | None][source]

Gets the decimal-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.DECIMAL.

doublevalue(columnindex: int) Tuple[float64, bool, Exception | None][source]

Gets the double-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.DOUBLE.

doublevalue_byname(columnname: str) Tuple[float64, bool, Exception | None][source]

Gets the double-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.DOUBLE.

guidvalue(columnindex: int) Tuple[UUID, bool, Exception | None][source]

Gets the guid-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.GUID.

guidvalue_byname(columnname: str) Tuple[UUID, bool, Exception | None][source]

Gets the guid-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.GUID.

int16value(columnindex: int) Tuple[int16, bool, Exception | None][source]

Gets the int16-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT16.

int16value_byname(columnname: str) Tuple[int16, bool, Exception | None][source]

Gets the int16-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT16.

int32value(columnindex: int) Tuple[int32, bool, Exception | None][source]

Gets the int32-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT32.

int32value_byname(columnname: str) Tuple[int32, bool, Exception | None][source]

Gets the int32-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT32.

int64value(columnindex: int) Tuple[int64, bool, Exception | None][source]

Gets the int64-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT64.

int64value_byname(columnname: str) Tuple[int64, bool, Exception | None][source]

Gets the int64-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT64.

int8value(columnindex: int) Tuple[int8, bool, Exception | None][source]

Gets the int8-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT8.

int8value_byname(columnname: str) Tuple[int8, bool, Exception | None][source]

Gets the int8-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.INT8.

property parent: DataTable

Gets the parent DataTable of the DataRow.

set_value(columnindex: int, value: object) Exception | None[source]

Assigns the record value at the specified column index.

set_value_byname(columnname: str, value: object) Exception | None[source]

Assigns the record value for the specified column name.

singlevalue(columnindex: int) Tuple[float32, bool, Exception | None][source]

Gets the single-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.SINGLE.

singlevalue_byname(columnname: str) Tuple[float32, bool, Exception | None][source]

Gets the single-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.SINGLE.

stringvalue(columnindex: int) Tuple[str, bool, Exception | None][source]

Gets the string-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.STRING.

stringvalue_byname(columnname: str) Tuple[str, bool, Exception | None][source]

Gets the string-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.STRING.

uint16value(columnindex: int) Tuple[uint16, bool, Exception | None][source]

Gets the uint16-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT16.

uint16value_byname(columnname: str) Tuple[uint16, bool, Exception | None][source]

Gets the uint16-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT16.

uint32value(columnindex: int) Tuple[uint32, bool, Exception | None][source]

Gets the uint32-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT32.

uint32value_byname(columnname: str) Tuple[uint32, bool, Exception | None][source]

Gets the uint32-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT32.

uint64value(columnindex: int) Tuple[uint64, bool, Exception | None][source]

Gets the uint64-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT64.

uint64value_byname(columnname: str) Tuple[uint64, bool, Exception | None][source]

Gets the uint64-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT64.

uint8value(columnindex: int) Tuple[uint8, bool, Exception | None][source]

Gets the uint8-based record value at the specified column index. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT8.

uint8value_byname(columnname: str) Tuple[uint8, bool, Exception | None][source]

Gets the uint8-based record value for the specified column name. Second parameter in tuple return value indicates if original value was None. An error will be returned if column type is not DataType.UINT8.

value(columnindex: int) Tuple[object | None, Exception | None][source]

Reads the record value at the specified column index.

value_as_string(columnindex: int) str[source]

Reads the record value at the specified columnIndex converted to a string. For column index out of range or any other errors, an empty string will be returned.

value_as_string_byname(columnname: str) str[source]

Reads the record value for the specified columnName converted to a string. For column name not found or any other errors, an empty string will be returned.

value_byname(columnname: str) Tuple[object | None, Exception | None][source]

Reads the record value for the specified column name.

sttp.data.dataset module

class sttp.data.dataset.DataSet(name: str = Ellipsis)[source]

Bases: object

Represents an in-memory cache of records that is structured similarly to information defined in a database. The data set object consists of a collection of data table objects. See https://sttp.github.io/documentation/data-sets/ for more information. Note that this implementation uses a case-insensitive map for DataTable name lookups. Internally, case-insensitive lookups are accomplished using str.upper().

DEFAULT_NAME = 'DataSet'
add_table(table: DataTable)[source]

Adds the specified table to the DataSet.

clear_tables()[source]

Clears the internal table collection. Any existing tables will be deleted.

create_table(name: str) DataTable[source]

Creates a new DataTable associated with the DataSet. Use add_table to add the new table to the DataSet.

static from_xml(buffer: str | bytes) Tuple[DataSet, Exception | None][source]

Creates a new DataSet as read from the XML in the specified buffer.

name

Defines the name of the DataSet.

parse_xml(buffer: str | bytes) Exception | None[source]

Loads the DataSet from the XML in the specified buffer.

parse_xmldoc(root: Element, namespaces: Dict[str, str]) Exception | None[source]

Loads the DataSet from an existing root XML document element.

remove_table(tablename: str) bool[source]

Removes the specified table name from the DataSet. Returns True if table was removed; otherwise, False if it did not exist. Lookup is case-insensitive.

table(tablename: str) DataTable | None[source]

Gets the DataTable for the specified table name if it exists; otherwise, None is returned. Lookup is case-insensitive.

property tablecount: int

Gets the total number of tables defined in the DataSet.

tablenames() List[str][source]

Gets the table names defined in the DataSet.

tables() List[DataTable][source]

Gets the DataTable instances defined in the DataSet.

sttp.data.dataset.EXT_XMLSCHEMADATA_NAMESPACE = 'urn:schemas-microsoft-com:xml-msdata'

Defines extended types for XSD elements, e.g., Guid and expression data types.

sttp.data.dataset.XMLSCHEMA_NAMESPACE = 'http://www.w3.org/2001/XMLSchema'

Defines schema namespace for the W3C XML Schema Definition Language (XSD) used by STTP metadata tables.

sttp.data.dataset.xsdformat(value: datetime) str[source]

Converts date/time value to a string in XSD XML schema format.

sttp.data.datatable module

class sttp.data.datatable.DataTable(parent: DataSet, name: str)[source]

Bases: object

Represents a collection of DataColumn objects where each data column defines a name and a data type. Data columns can also be computed where its value would be derived from other columns and functions (https://sttp.github.io/documentation/filter-expressions/) defined in an expression. Note that this implementation uses a case-insensitive map for DataColumn name lookups. Internally, case-insensitive lookups are accomplished using str.upper().

add_column(column: DataColumn)[source]

Adds the specified column to the DataTable.

add_row(row: DataRow)[source]

Adds the specified row to the DataTable.

clear_columns()[source]

Clears the internal column collections.

clear_rows()[source]

Clears the internal row collection.

clone_column(source: DataColumn) DataColumn[source]

Creates a copy of the specified source DataColumn associated with the DataTable.

clone_row(source: DataRow) DataRow[source]

Creates a copy of the specified source DataRow associated with the DataTable.

column(columnindex: int) DataColumn | None[source]

Gets the DataColumn at the specified column index if the index is in range; otherwise, None is returned.

column_byname(columnname: str) DataColumn | None[source]

Gets the DataColumn for the specified column name if the name exists; otherwise, None is returned. Lookup is case-insensitive.

property columncount: int

Gets the total number columns defined in the DataTable.

columnindex(columnname: str) int[source]

Gets the index for the specified column name if the name exists; otherwise, -1 is returned. Lookup is case-insensitive.

create_column(name: str, datatype: DataType, expression: str = '')[source]

Creates a new DataColumn associated with the DataTable. Use add_column to add the new column to the DataTable.

create_row() DataRow[source]

Creates a new DataRow associated with the DataTable. Use add_row to add the new row to the DataTable.

property name: str

Gets the name of the DataTable.

property parent: DataSet

Gets the parent DataSet of the DataTable.

row(rowindex: int) DataRow | None[source]

Gets the DataRow at the specified row index if the index is in range; otherwise, None is returned.

property rowcount: int

Gets the total number of rows defined in the DataTable.

rowswhere(predicate: Callable[[DataRow], bool], limit: int = -1) List[DataRow][source]

Returns the rows matching the predicate expression. Set limit parameter to -1 for all matching rows.

rowvalue_as_string(rowindex: int, columnindex: int) str[source]

Reads the row record value at the specified column index converted to a string. For column index out of range or any other errors, an empty string will be returned.

rowvalue_as_string_byname(rowindex: int, columnname: str) str[source]

Reads the row record value for the specified column name converted to a string. For column name not found or any other errors, an empty string will be returned.

select(filterexpression: str, sortorder: str | None = None, limit: int = -1) Tuple[List[DataRow] | None, Exception | None][source]

Returns the rows matching the filter expression criteria in the specified sort order.

The filterexpression parameter should be in the syntax of a SQL WHERE expression but should not include the WHERE keyword. The sortorder parameter defines field names, separated by commas, that exist in the DataTable used to order the results. Each field specified in the sortorder can have an ASC or DESC suffix; defaults to ASC when no suffix is provided. When sortorder is an empty string, records will be returned in natural order. Set limit parameter to -1 for all matching rows. When filterexpression is an empty string, all records will be returned; any specified sort order and limit will still be respected.

sttp.data.datatype module

class sttp.data.datatype.DataType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Enumeration of the possible data types for a DataColumn.

BOOLEAN = 1

Represents a Python bool data type.

DATETIME = 2

Represents a Python datetime data type.

DECIMAL = 5

Represents a Python decimal.Decimal data type.

DOUBLE = 4

Represents a Python numpy.float64 data type.

GUID = 6

Represents a Python uuid.UUID data type.

INT16 = 8

Represents a Python numpy.int16 data type.

INT32 = 9

Represents a Python numpy.int32 data type.

INT64 = 10

Represents a Python numpy.int64 data type.

INT8 = 7

Represents a Python numpy.int8 data type.

SINGLE = 3

Represents a Python numpy.float32 data type.

STRING = 0

Represents a Python str data type.

UINT16 = 12

Represents a Python numpy.uint16 data type.

UINT32 = 13

Represents a Python numpy.uint32 data type.

UINT64 = 14

Represents a Python numpy.uint64 data type.

UINT8 = 11

Represents a Python numpy.uint8 data type.

sttp.data.datatype.default_datatype(datatype: DataType) object[source]
sttp.data.datatype.parse_xsddatatype(xsdtypename: str, extdatatype: str | None) Tuple[DataType, bool][source]

Gets the DataType from the provided XSD data type. Return tuple includes boolean value that determines if parse was successful. See XML Schema Language Datatypes for possible xsd type name values: https://www.w3.org/TR/xmlschema-2/

sttp.data.errors module

exception sttp.data.errors.EvaluateError[source]

Bases: Exception

Raised when the ExpressionTree fails during evaluation.

sttp.data.expression module

class sttp.data.expression.Expression[source]

Bases: object

Represents any expression type.

Notes

This is the base class for all expression types.

property expressiontype: ExpressionType

Gets the type of the expression.

sttp.data.expressiontree module

class sttp.data.expressiontree.ExpressionTree[source]

Bases: object

Represents a tree of expressions for evaluation.

evaluate(row: DataRow | None = None) Tuple[ValueExpression | None, Exception | None][source]

Traverses the the ExpressionTree for the provided data row to produce a ValueExpression. Root expression should be assigned before calling evaluate; otherwise result will be a Null ValueExpression. The datarow parameter can be None if there are no columns referenced in expression tree. An error will be returned if the expresssion evaluation fails.

orderbyterms: List[OrderByTerm]

Represents the order by elements parsed from the “ORDER BY” keyword, if any.

root: Expression | None

Defines the starting Expression for evaluation of the expression tree, or None if there is not one. This is the root expression of the ExpressionTree. Value is automatically managed by the FilterExpressionParser.

select(table: DataTable) Tuple[List[DataRow], Exception | None][source]

Returns the rows matching the the ExpressionTree.

The expression tree result type is expected to be a boolean for this filtering operation. This works like the “WHERE” clause of a SQL expression. Any “TOP” limit and “ORDER BY” sorting clauses found in filter expressions will be respected. An error will be returned if the table parameter is None, the expression tree does not yield a boolean value or any row expresssion evaluation fails.

selectwhere(table: DataTable, predicate: Callable[[ValueExpression], Tuple[bool, Exception | None]], applylimit: bool, applysort: bool) Tuple[List[DataRow], Exception | None][source]

Returns each table row evaluated from the ExpressionTree that matches the specified predicate.

The applylimit and applysort parameters determine if any encountered “TOP” limit and “ORDER BY” sorting clauses will be respected. An error will be returned if the table parameter is nil or any row expresssion evaluation fails.

tablename: str

Defines the associated table name parsed from “FILTER” statement, if any.

toplimit: int

Defined the parsed value associated with the “TOP” keyword, if any.

sttp.data.filterexpressionparser module

class sttp.data.filterexpressionparser.FilterExpressionParser(filterexpression: str, suppress_console_erroroutput: bool = False)[source]

Bases: FilterExpressionSyntaxListener

Represents a parser for STTP filter expressions.

dataset: DataSet

Defines the source metadata used for parsing the filter expression.

enterExpression(ctx: ExpressionContext)[source]
enterFilterExpressionStatement(ctx: FilterExpressionStatementContext)[source]
enterFilterStatement(ctx: FilterStatementContext)[source]
evaluate(applylimit: bool, applysort: bool) Exception | None[source]

Evaluate parses each statement in the filter expression and tracks the results.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement, yielding all filtered rows and/or signal IDs that match the target filter expression. The applylimit and applysort flags determine if any encountered “TOP” limit and “ORDER BY” sorting clauses will be respected. Access matching results via filtered_rows and/or filtered_signalids, or related set functions. An error will be returned if expression fails to parse or any row expression evaluation fails.

static evaluate_datarowexpression(datarow: DataRow, filterexpression: str, suppress_console_erroroutput: bool = False) Tuple[ValueExpression | None, Exception | None][source]

Returns the result of the evaluated filterexpression using the specified datarow.

If filterexpression contains multiple semi-colon separated statements, only the first expression is evaluated. An error will be returned if datarow parameter is None, the filterexpression is empty, expression fails to parse or row expression evaluation fails.

static evaluate_expression(filterexpression: str, suppress_console_erroroutput: bool = False) Tuple[ValueExpression | None, Exception | None][source]

Returns the result of the evaluated filterexpression.

This expression evaluation function is only for simple expressions that do not reference any DataSet columns. Use evaluate_datarowexpression for evaluating filter expressions that contain column references. If filterexpression contains multiple semi-colon separated statements, only the first expression is evaluated. An error will be returned if the filterexpression is empty or expression fails to parse.

exitColumnName(ctx: ColumnNameContext)[source]
exitExpression(ctx: ExpressionContext)[source]
exitFunctionExpression(ctx: FunctionExpressionContext)[source]
exitIdentifierStatement(ctx: IdentifierStatementContext)[source]
exitLiteralValue(ctx: LiteralValueContext)[source]
exitPredicateExpression(ctx: PredicateExpressionContext)[source]
exitValueExpression(ctx: ValueExpressionContext)[source]
property expressiontrees: Tuple[List[ExpressionTree], Exception | None]

Returns the list of expression trees parsed from the filter expression.

property filtered_rows: List[DataRow]

Gets the rows matching the parsed filter expression.

Results could contain duplicates if source DataSet has duplicated rows.

property filtered_rowset: Set[DataRow]

Gets the unique row set matching the parsed filter expression.

property filtered_signalids: List[UUID]

Gets the Guid-based signal IDs matching the parsed filter expression.

Results could contain duplicates if source DataSet has duplicated rows.

property filtered_signalidset: Set[UUID]

Gets the unique Guid-based signal ID set matching the parsed filter expression.

property filterexpression_statementcount: int

Gets the number of filter expression statements encountered while parsing.

static from_dataset(dataset: DataSet, filterexpression: str, primary_table: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[FilterExpressionParser | None, Exception | None][source]

Creates a new filter expression parser associated with the provided dataSet and provided table details. Error will be returned if dataset parameter is None or the filterexpression is empty.

static generate_expressiontree(datatable: DataTable, filterexpression: str, suppress_console_erroroutput: bool = False) Tuple[ExpressionTree | None, Exception | None][source]

Gets the first produced expression tree for the provided filterexpression and datatable.

If filterexpression contains multiple semi-colon separated statements, only the first expression is returned. An error will be returned if datatable parameter is None, the filterexpression is empty or expression fails to parse.

static generate_expressiontrees(dataset: DataSet, primarytable: str, filterexpression: str, suppress_console_erroroutput: bool = False) Tuple[List[ExpressionTree] | None, Exception | None][source]

Produces a set of expression trees for the provided filterexpression and dataset.

One expression tree will be produced per filter expression statement encountered in the specified filterexpression. If primarytable parameter is not defined, then filter expression should not contain directly defined signal IDs. An error will be returned if dataSet parameter is None, the filterexpression is empty or expression fails to parse.

static generate_expressiontrees_fromtable(datatable: DataTable, filterexpression: str, suppress_console_erroroutput: bool = False) Tuple[List[ExpressionTree] | None, Exception | None][source]

Produces a set of expression trees for the provided filterexpression and datatable.

One expression tree will be produced per filter expression statement encountered in the specified filterexpression. An error will be returned if datatable parameter is None, the filterexpression is empty or expression fails to parse.

primary_tablename: str

Defines the name of the table to use in the DataSet when filter expressions do not specify a table name, e.g., direct signal identification. See: https://sttp.github.io/documentation/filter-expressions/#direct-signal-identification

static select_datarows(dataset: DataSet, filterexpression: str, primarytable: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[List[DataRow] | None, Exception | None][source]

Returns all rows matching the provided filterexpression and dataset.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRow list will contain all matching rows, order preserved. If dataset includes duplicated rows, it will be possible for the result set to contain duplicates. Any encountered “TOP” limit or “ORDER BY” clauses will be respected. An error will be returned if dataset parameter is None, the filterexpression is empty, expression fails to parse or any row expression evaluation fails.

static select_datarows_fromtable(datatable: DataTable, filterexpression: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[List[DataRow] | None, Exception | None][source]

Returns all rows matching the provided filterexpression and datatable.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRow list will contain all matching rows, order preserved. If dataSet includes duplicated rows, it will be possible for the result set to contain duplicates. Any encountered “TOP” limit or “ORDER BY” clauses will be respected. An error will be returned if datatable parameter (or its parent DataSet) is None, the filterexpression is empty, expression fails to parse or any row expression evaluation fails.

static select_datarowset(dataset: DataSet, filterexpression: str, primarytable: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[Set[DataRow] | None, Exception | None][source]

Returns all unique rows matching the provided filterexpression and dataset.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRow set will contain only unique rows, in arbitrary order. Any encountered “TOP” limit clauses for individual filter expression statements will be respected, but “ORDER BY” clauses will be ignored. An error will be returned if dataset parameter is None, the filterexpression is empty, expression fails to parse or any row expression evaluation fails.

static select_datarowset_fromtable(datatable: DataTable, filterexpression: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[Set[DataRow] | None, Exception | None][source]

Returns all unique rows matching the provided filterexpression and datatable.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRow set will contain only unique rows, in arbitrary order. Any encountered “TOP” limit clauses for individual filter expression statements will be respected, but “ORDER BY” clauses will be ignored. An error will be returned if datatable parameter (or its parent DataSet) is None, the filterexpression is empty, expression fails to parse or any row expression evaluation fails.

static select_signalidset(dataset: DataSet, filterexpression: str, primarytable: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[Set[UUID] | None, Exception | None][source]

Returns all unique signal IDs matching the provided filterexpression and dataset.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned UUID set will contain only unique values, in arbitrary order. Any encountered “TOP” limit clauses for individual filter expression statements will be respected, but “ORDER BY” clauses will be ignored. An error will be returned if dataset parameter is None, the filterexpression is empty, expression fails to parse or any row expression evaluation fails.

static select_signalidset_fromtable(datatable: DataTable, filterexpression: str, tableidfields: TableIDFields | None = None, suppress_console_erroroutput: bool = False) Tuple[Set[UUID] | None, Exception | None][source]

Returns all unique signal IDs matching the provided filterexpression and datatable.

Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned UUID set will contain only unique values, in arbitrary order. Any encountered “TOP” limit clauses for individual filter expression statements will be respected, but “ORDER BY” clauses will be ignored. An error will be returned if datatable parameter (or its parent DataSet) is None, the filterexpression is empty, expression fails to parse or any row expression evaluation fails.

set_parsingexception_callback(callback: Callable[[str], None])[source]

Registers a callback for receiving parsing exception messages.

table(tablename: str) Tuple[DataTable | None, Exception | None][source]

Gets the DataTable for the specified tableName from the FilterExpressionParser DataSet.

An error will be returned if no DataSet has been defined or the tableName cannot be found.

tableidfields_map: Dict[str, TableIDFields]

Defines a map of table ID fields associated with table names.

track_filteredrows

Defines a flag that enables tracking of matching rows during filter expression evaluation. Value defaults to True. Set value to False and set track_filteredsignalids to True if only signal IDs are needed post filter expression evaluation.

track_filteredsignalids

Defines a flag that enables tracking of matching signal IDs during filter expression evaluation.

sttp.data.functionexpression module

class sttp.data.functionexpression.FunctionExpression(functiontype: ExpressionFunctionType, arguments: list[Expression])[source]

Bases: Expression

Represents a function expression.

property arguments: list[Expression]

Gets the arguments of this FunctionExpression.

property expressiontype: ExpressionType

Gets the type of this FunctionExpression.

property functiontype: ExpressionFunctionType

Gets the type of function of this FunctionExpression.

sttp.data.inlistexpression module

class sttp.data.inlistexpression.InListExpression(value: Expression, arguments: list[Expression], has_notkeyword: bool, exactmatch: bool)[source]

Bases: Expression

Represents an in-list expression.

property arguments: list[Expression]

Gets the arguments of this FunctionExpression.

property exactmatch: bool

Gets a flag that indicates whether this InListExpression is an exact match. i.e., has the BINARY or === keyword.

property expressiontype: ExpressionType

Gets the type of this InListExpression.

property has_notkeyword: bool

Gets a flag that indicates whether this InListExpression has a NOT keyword.

property value: Expression

Gets the value of this InListExpression.

sttp.data.operatorexpression module

class sttp.data.operatorexpression.OperatorExpression(operatortype: ExpressionOperatorType, leftvalue: Expression, rightvalue: Expression)[source]

Bases: Expression

Represents an operator expression.

property expressiontype: ExpressionType

Gets the type of this OperatorExpression.

property leftvalue: Expression

Gets the left value expression for this OperatorExpression.

property operatortype: ExpressionOperatorType

Gets the operator type for this OperatorExpression.

property rightvalue: Expression

Gets the right value expression for this OperatorExpression.

sttp.data.orderbyterm module

class sttp.data.orderbyterm.OrderByTerm(column: DataColumn, ascending: bool = True, extactmatch: bool = False)[source]

Bases: object

Represents the elements parsed for a DataColumn specified in the “ORDER BY” keyword.

ascending: bool

Defines the sort direction parsed from “ORDER BY” statement.

column: DataColumn

Defines the data column referenced from an “ORDER BY” statement.

extactmatch: bool

Defines the exact match flag parsed from “ORDER BY” statement.

sttp.data.tableidfields module

sttp.data.tableidfields.DEFAULT_TABLEIDFIELDS = <sttp.data.tableidfields.TableIDFields object>

Defines the common default table ID field names.

class sttp.data.tableidfields.TableIDFields[source]

Bases: object

Represents the primary identification field names for a metadata table that is being used as the source for an STTP filter expression. See: https://sttp.github.io/documentation/filter-expressions/#activemeasurements

measurementkey_fieldname

id”), type string. Common value is “ID”.

Type:

Defines the name of the measurement key field (format like “instance

pointtag_fieldname

Defines the name of the point tag field, type string. Common value is “PointTag”.

signalid_fieldname

Defines the field name of the signal ID field, type Guid. Common value is “SignalID”.

sttp.data.unaryexpression module

class sttp.data.unaryexpression.UnaryExpression(unarytype: ExpressionUnaryType, value: Expression)[source]

Bases: Expression

Represents a unary expression.

applyto_bool(value: bool) Tuple[ValueExpression | None, Exception | None][source]

Applies the UnaryExpression prefix to a boolean and returns ValueExpression of result, if possible.

applyto_decimal(value: Decimal) Tuple[ValueExpression | None, Exception | None][source]

Applies the UnaryExpression prefix to a Decimal value and returns ValueExpression of result, if possible.

applyto_double(value: float64) Tuple[ValueExpression | None, Exception | None][source]

Applies the UnaryExpression prefix to a Double value and returns ValueExpression of result, if possible.

applyto_int32(value: int32) Tuple[ValueExpression | None, Exception | None][source]

Applies the UnaryExpression prefix to a 32-bit integer value and returns ValueExpression of result.

applyto_int64(value: int64) Tuple[ValueExpression | None, Exception | None][source]

Applies the UnaryExpression prefix to a 64-bit integer value and returns ValueExpression of result.

property expressiontype: ExpressionType

Gets the type of this UnaryExpression.

property unarytype: ExpressionUnaryType

Gets the type of unary operation of this UnaryExpression.

property value: Expression

Gets the value of this UnaryExpression.

sttp.data.valueexpression module

sttp.data.valueexpression.EMPTYSTRINGVALUE = 5

Defines a ValueExpression that represents an empty string.

sttp.data.valueexpression.FALSEVALUE = 0

Defines a ValueExpression that represents False.

sttp.data.valueexpression.NULLBOOLVALUE = 0

Defines a ValueExpression that represents a null, i.e., None, value of type Boolean.

sttp.data.valueexpression.NULLDATETIMEVALUE

Defines a ValueExpression that represents a null, i.e., None, value of type DateTime.

sttp.data.valueexpression.NULLINT32VALUE = 1

Defines a ValueExpression that represents a null, i.e., None, value of type Int32.

sttp.data.valueexpression.NULLSTRINGVALUE = 5

Defines a ValueExpression that represents a null, i.e., None, value of type String.

sttp.data.valueexpression.NULLVALUE = 8

Defines a ValueExpression that represents a null, i.e., None, value, value type Undefined.

sttp.data.valueexpression.TRUEVALUE = 0

Defines a ValueExpression that represents True.

class sttp.data.valueexpression.ValueExpression(valuetype: ExpressionValueType, value: object)[source]

Bases: Expression

Represents a value expression.

booleanvalue() Tuple[bool, Exception | None][source]

Gets the ValueExpression as a boolean value. An error will be returned if value type is not ExpressionValueType.BOOLEAN.

convert(target_typevalue: ExpressionValueType) Tuple[ValueExpression | None, Exception | None][source]

Attempts to convert the ValueExpression to the specified type.

datetimevalue() Tuple[datetime, Exception | None][source]

Gets the ValueExpression as a datetime value. An error will be returned if value type is not ExpressionValueType.DATETIME.

decimalvalue() Tuple[Decimal, Exception | None][source]

Gets the ValueExpression as a Decimal value. An error will be returned if value type is not ExpressionValueType.DECIMAL.

doublevalue() Tuple[float64, Exception | None][source]

Gets the ValueExpression as a double value. An error will be returned if value type is not ExpressionValueType.DOUBLE.

property expressiontype: ExpressionType

Gets the type of this ValueExpression.

guidvalue() Tuple[UUID, Exception | None][source]

Gets the ValueExpression as a GUID value. An error will be returned if value type is not ExpressionValueType.GUID.

int32value() Tuple[int32, Exception | None][source]

Gets the ValueExpression as a 32-bit integer value. An error will be returned if value type is not ExpressionValueType.INT32.

int64value() Tuple[int64, Exception | None][source]

Gets the ValueExpression as a 64-bit integer value. An error will be returned if value type is not ExpressionValueType.INT64.

integervalue(defaultvalue: int = 0) int[source]

Gets the ValueExpression as an integer value or specified default value if not possible.

is_null() bool[source]

Gets a flag that determines if this ValueExpression is null, i.e., None.

static nullvalue(target_valuetype: ExpressionValueType) ValueExpression[source]

Gets a ValueExpression that represents a null, i.e., None, value of the specified ExpressionValueType.

stringvalue() Tuple[str, Exception | None][source]

Gets the ValueExpression as a string value. An error will be returned if value type is not ExpressionValueType.STRING.

property value: object

Gets the value of this ValueExpression.

property valuetype: ExpressionValueType

Gets the value type of this ValueExpression.

Module contents