cycquery.ops.Sequential

class Sequential(*ops: QueryOp)[source]
class Sequential(ops: List[QueryOp])
class Sequential(op: OrderedDict[str, QueryOp])

Bases: QueryOp

Sequential query operations class.

Chains a sequence of query operations and executes the final query on a table.

Examples

>>> Sequential(Drop(["col1", "col2"]), ...)
>>> Sequential([Drop(["col1", "col2"]), ...])

Initialize the class.

Parameters:

args (QueryOp) – Query operations to be chained sequentially.

Methods

append

Append a given query op to the end.

extend

Extend the sequential query op with another sequential query op.

insert

Insert a given query op at the given index.

pop

Pop the query op at the given index.

__add__(other)[source]

Add two Sequential objects.

Parameters:

other (Sequential) – Sequential object to be added.

Returns:

Sequential object with the two Sequential objects chained.

Return type:

Sequential

__call__(table)[source]

Execute the query operations on the table.

Parameters:

table (Union[Select, Subquery, Table, DBTable]) – Table to be queried.

Returns:

Query result after chaining the query operations.

Return type:

Subquery

__init__(*args)[source]

Initialize the class.

Parameters:

args (QueryOp) – Query operations to be chained sequentially.

append(op_)[source]

Append a given query op to the end.

Parameters:

op – Query op to append.

Returns:

Sequential object with the query op appended.

Return type:

Sequential

extend(sequential)[source]

Extend the sequential query op with another sequential query op.

Parameters:

sequential (Sequential) – Sequential object to extend with.

Returns:

Sequential object with the other sequential query op extended.

Return type:

Sequential

insert(index, op_)[source]

Insert a given query op at the given index.

Parameters:
  • index (int) – Index to insert the query op at.

  • op – Query op to insert.

Returns:

Sequential object with the query op inserted.

Return type:

Sequential

pop(key)[source]

Pop the query op at the given index.

Parameters:

key (Union[int, slice]) – Index of the query op to pop.

Returns:

Popped query op.

Return type:

QueryOp