Skip to content

Qs

flowtask.components.QS

QuerySource. QS is a new kind of component supporting the new sources for QuerySource and making transformations of data, returning a transformed Pandas DataFrame.

Example:

```yaml
QS:
  query: troc_mileage.tpl
  from_templates_dir: true
  conditions:
    tenant: bose
    firstdate: '{first}'
    lastdate: '{last}'
    forms:
    - 4184
    - 4149
    - 4177
    - 4152
    - 3900
    - 3931
    - 3959
  masks:
    first:
    - date_diff_dow
    - day_of_week: monday
      diff: 8
      mask: '%Y-%m-%d'
    last:
    - date_diff_dow
    - day_of_week: monday
      diff: 2
      mask: '%Y-%m-%d'
```

QS

QS(loop=None, job=None, stat=None, **kwargs)

Bases: FlowComponent, TemplateSupport, PandasDataframe

QS.

Overview

Calling Complex QuerySource operations from Flowtask.
This component supports QuerySource,
making transformations of data and returning a transformed Pandas DataFrame.
Component Syntax

"QS": { "query": "path to file", "conditions": { "firstdate": "", "lastdate": "", forms: [1, 2, 3, 4] } } or "QS": { "slug": "troc_mileage" }

.. table:: Properties :widths: auto

+------------------------+----------+-----------+------------------------------------------------------------------+ | Name | Required | Summary | +------------------------+----------+-----------+------------------------------------------------------------------+ | slug | Yes | The slug identifier for the query. | +------------------------+----------+-----------+------------------------------------------------------------------+ | query | No | The query template file to use. | +------------------------+----------+-----------+------------------------------------------------------------------+ | conditions | No | Conditions to apply to the query. | +------------------------+----------+-----------+------------------------------------------------------------------+ | map | No | Dictionary for mapping or transforming the resulting DataFrame. | +------------------------+----------+-----------+------------------------------------------------------------------+ | infer_types | No | If True, converts DataFrame columns to appropriate dtypes. Default is False. | +------------------------+----------+-----------+------------------------------------------------------------------+ | to_string | No | If True, converts DataFrame columns to string dtype. Default is True. | +------------------------+----------+-----------+------------------------------------------------------------------+ | use_template | No | If True, use a query template for the query. Default is True. | +------------------------+----------+-----------+------------------------------------------------------------------+

Returns

This component returns a pandas DataFrame containing the queried and transformed data.

close async

close()

Closing QS Object.