Skip to content

Syntax#

This reference page describes all building blocks of the Intermediate Query Language (IQL).

dbally.iql.syntax.Node #

Base class for all nodes in the IQL.

is_bool_op #

is_bool_op() -> IsBoolOpType

Checks if node is a boolean operation.

RETURNS DESCRIPTION
IsBoolOpType

True if the node is a boolean operation, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_bool_op(self) -> IsBoolOpType:
    """
    Checks if node is a boolean operation.

    Returns:
        True if the node is a boolean operation, otherwise False.
    """
    return isinstance(self, BoolOp)

is_function_call #

is_function_call() -> IsFunctionCallType

Checks if node is a function call.

RETURNS DESCRIPTION
IsFunctionCallType

True if the node is a function call, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_function_call(self) -> IsFunctionCallType:
    """
    Checks if node is a function call.

    Returns:
        True if the node is a function call, otherwise False.
    """
    return isinstance(self, FunctionCall)

dbally.iql.syntax.FunctionCall dataclass #

FunctionCall(name: str, arguments: List[Any])

Bases: Node

Represents a call to a function. Is composed of a function name and a list of arguments.

name instance-attribute #

name: str

arguments instance-attribute #

arguments: List[Any]

is_bool_op #

is_bool_op() -> IsBoolOpType

Checks if node is a boolean operation.

RETURNS DESCRIPTION
IsBoolOpType

True if the node is a boolean operation, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_bool_op(self) -> IsBoolOpType:
    """
    Checks if node is a boolean operation.

    Returns:
        True if the node is a boolean operation, otherwise False.
    """
    return isinstance(self, BoolOp)

is_function_call #

is_function_call() -> IsFunctionCallType

Checks if node is a function call.

RETURNS DESCRIPTION
IsFunctionCallType

True if the node is a function call, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_function_call(self) -> IsFunctionCallType:
    """
    Checks if node is a function call.

    Returns:
        True if the node is a function call, otherwise False.
    """
    return isinstance(self, FunctionCall)

dbally.iql.syntax.BoolOp #

Bases: Node

Base class for boolean operator nodes.

is_bool_op #

is_bool_op() -> IsBoolOpType

Checks if node is a boolean operation.

RETURNS DESCRIPTION
IsBoolOpType

True if the node is a boolean operation, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_bool_op(self) -> IsBoolOpType:
    """
    Checks if node is a boolean operation.

    Returns:
        True if the node is a boolean operation, otherwise False.
    """
    return isinstance(self, BoolOp)

is_function_call #

is_function_call() -> IsFunctionCallType

Checks if node is a function call.

RETURNS DESCRIPTION
IsFunctionCallType

True if the node is a function call, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_function_call(self) -> IsFunctionCallType:
    """
    Checks if node is a function call.

    Returns:
        True if the node is a function call, otherwise False.
    """
    return isinstance(self, FunctionCall)

match #

match(not_: Callable[[Not], Any], and_: Callable[[And], Any], or_: Callable[[Or], Any]) -> Any

Match syntax for convenient query building based on BoolOp type.

PARAMETER DESCRIPTION
not_

Callable executed when node is Not

TYPE: Callable[[Not], Any]

and_

Callable executed when node is And

TYPE: Callable[[And], Any]

or_

Callable executed when node is Or

TYPE: Callable[[Or], Any]

RETURNS DESCRIPTION
Any

Result of chosen callable.

RAISES DESCRIPTION
ValueError

if node is not of any supported boolean types

Source code in src/dbally/iql/syntax.py
def match(self, not_: Callable[["Not"], Any], and_: Callable[["And"], Any], or_: Callable[["Or"], Any]) -> Any:
    """
    Match syntax for convenient query building based on BoolOp type.

    Args:
        not_: Callable executed when node is Not
        and_: Callable executed when node is And
        or_: Callable executed when node is Or

    Returns:
        Result of chosen callable.

    Raises:
        ValueError: if node is not of any supported boolean types
    """
    if isinstance(self, Not):
        return not_(self)
    if isinstance(self, And):
        return and_(self)
    if isinstance(self, Or):
        return or_(self)

    raise ValueError(f"Unsupported BoolOp type {type(self)}")

dbally.iql.syntax.And dataclass #

And(children: List[Node])

Bases: BoolOp

And operator which may contain any number of children nodes. Returns True if all children are true.

children instance-attribute #

children: List[Node]

is_bool_op #

is_bool_op() -> IsBoolOpType

Checks if node is a boolean operation.

RETURNS DESCRIPTION
IsBoolOpType

True if the node is a boolean operation, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_bool_op(self) -> IsBoolOpType:
    """
    Checks if node is a boolean operation.

    Returns:
        True if the node is a boolean operation, otherwise False.
    """
    return isinstance(self, BoolOp)

is_function_call #

is_function_call() -> IsFunctionCallType

Checks if node is a function call.

RETURNS DESCRIPTION
IsFunctionCallType

True if the node is a function call, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_function_call(self) -> IsFunctionCallType:
    """
    Checks if node is a function call.

    Returns:
        True if the node is a function call, otherwise False.
    """
    return isinstance(self, FunctionCall)

match #

match(not_: Callable[[Not], Any], and_: Callable[[And], Any], or_: Callable[[Or], Any]) -> Any

Match syntax for convenient query building based on BoolOp type.

PARAMETER DESCRIPTION
not_

Callable executed when node is Not

TYPE: Callable[[Not], Any]

and_

Callable executed when node is And

TYPE: Callable[[And], Any]

or_

Callable executed when node is Or

TYPE: Callable[[Or], Any]

RETURNS DESCRIPTION
Any

Result of chosen callable.

RAISES DESCRIPTION
ValueError

if node is not of any supported boolean types

Source code in src/dbally/iql/syntax.py
def match(self, not_: Callable[["Not"], Any], and_: Callable[["And"], Any], or_: Callable[["Or"], Any]) -> Any:
    """
    Match syntax for convenient query building based on BoolOp type.

    Args:
        not_: Callable executed when node is Not
        and_: Callable executed when node is And
        or_: Callable executed when node is Or

    Returns:
        Result of chosen callable.

    Raises:
        ValueError: if node is not of any supported boolean types
    """
    if isinstance(self, Not):
        return not_(self)
    if isinstance(self, And):
        return and_(self)
    if isinstance(self, Or):
        return or_(self)

    raise ValueError(f"Unsupported BoolOp type {type(self)}")

dbally.iql.syntax.Or dataclass #

Or(children: List[Node])

Bases: BoolOp

Or operator which may contain any number of children nodes. Returns True if any child is true.

children instance-attribute #

children: List[Node]

is_bool_op #

is_bool_op() -> IsBoolOpType

Checks if node is a boolean operation.

RETURNS DESCRIPTION
IsBoolOpType

True if the node is a boolean operation, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_bool_op(self) -> IsBoolOpType:
    """
    Checks if node is a boolean operation.

    Returns:
        True if the node is a boolean operation, otherwise False.
    """
    return isinstance(self, BoolOp)

is_function_call #

is_function_call() -> IsFunctionCallType

Checks if node is a function call.

RETURNS DESCRIPTION
IsFunctionCallType

True if the node is a function call, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_function_call(self) -> IsFunctionCallType:
    """
    Checks if node is a function call.

    Returns:
        True if the node is a function call, otherwise False.
    """
    return isinstance(self, FunctionCall)

match #

match(not_: Callable[[Not], Any], and_: Callable[[And], Any], or_: Callable[[Or], Any]) -> Any

Match syntax for convenient query building based on BoolOp type.

PARAMETER DESCRIPTION
not_

Callable executed when node is Not

TYPE: Callable[[Not], Any]

and_

Callable executed when node is And

TYPE: Callable[[And], Any]

or_

Callable executed when node is Or

TYPE: Callable[[Or], Any]

RETURNS DESCRIPTION
Any

Result of chosen callable.

RAISES DESCRIPTION
ValueError

if node is not of any supported boolean types

Source code in src/dbally/iql/syntax.py
def match(self, not_: Callable[["Not"], Any], and_: Callable[["And"], Any], or_: Callable[["Or"], Any]) -> Any:
    """
    Match syntax for convenient query building based on BoolOp type.

    Args:
        not_: Callable executed when node is Not
        and_: Callable executed when node is And
        or_: Callable executed when node is Or

    Returns:
        Result of chosen callable.

    Raises:
        ValueError: if node is not of any supported boolean types
    """
    if isinstance(self, Not):
        return not_(self)
    if isinstance(self, And):
        return and_(self)
    if isinstance(self, Or):
        return or_(self)

    raise ValueError(f"Unsupported BoolOp type {type(self)}")

dbally.iql.syntax.Not dataclass #

Not(child: Node)

Bases: BoolOp

Not operator, contains only one children node. Inverts result of boolean operation.

child instance-attribute #

child: Node

is_bool_op #

is_bool_op() -> IsBoolOpType

Checks if node is a boolean operation.

RETURNS DESCRIPTION
IsBoolOpType

True if the node is a boolean operation, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_bool_op(self) -> IsBoolOpType:
    """
    Checks if node is a boolean operation.

    Returns:
        True if the node is a boolean operation, otherwise False.
    """
    return isinstance(self, BoolOp)

is_function_call #

is_function_call() -> IsFunctionCallType

Checks if node is a function call.

RETURNS DESCRIPTION
IsFunctionCallType

True if the node is a function call, otherwise False.

Source code in src/dbally/iql/syntax.py
def is_function_call(self) -> IsFunctionCallType:
    """
    Checks if node is a function call.

    Returns:
        True if the node is a function call, otherwise False.
    """
    return isinstance(self, FunctionCall)

match #

match(not_: Callable[[Not], Any], and_: Callable[[And], Any], or_: Callable[[Or], Any]) -> Any

Match syntax for convenient query building based on BoolOp type.

PARAMETER DESCRIPTION
not_

Callable executed when node is Not

TYPE: Callable[[Not], Any]

and_

Callable executed when node is And

TYPE: Callable[[And], Any]

or_

Callable executed when node is Or

TYPE: Callable[[Or], Any]

RETURNS DESCRIPTION
Any

Result of chosen callable.

RAISES DESCRIPTION
ValueError

if node is not of any supported boolean types

Source code in src/dbally/iql/syntax.py
def match(self, not_: Callable[["Not"], Any], and_: Callable[["And"], Any], or_: Callable[["Or"], Any]) -> Any:
    """
    Match syntax for convenient query building based on BoolOp type.

    Args:
        not_: Callable executed when node is Not
        and_: Callable executed when node is And
        or_: Callable executed when node is Or

    Returns:
        Result of chosen callable.

    Raises:
        ValueError: if node is not of any supported boolean types
    """
    if isinstance(self, Not):
        return not_(self)
    if isinstance(self, And):
        return and_(self)
    if isinstance(self, Or):
        return or_(self)

    raise ValueError(f"Unsupported BoolOp type {type(self)}")