ds_provider_aic_py_lib.dataset.utils.sql

File: sql.py Region: ds_provider_aic_py_lib/dataset/utils/sql

Scope a gold statement to one dataset and move a later page with OFFSET.

Attributes

_GOLD_TABLE

_OTHER_DATASET

_ORDER_BY

Functions

qualify(→ str)

Rewrite gold to this dataset. A quoted reference to another dataset is rejected.

has_order_by(→ bool)

Return whether sql has an ORDER BY outside strings and line comments.

statement(→ str)

Return sql unchanged, or the same statement moved by offset rows.

Module Contents

ds_provider_aic_py_lib.dataset.utils.sql._GOLD_TABLE
ds_provider_aic_py_lib.dataset.utils.sql._OTHER_DATASET
ds_provider_aic_py_lib.dataset.utils.sql._ORDER_BY
ds_provider_aic_py_lib.dataset.utils.sql.qualify(sql: str, dataset_id: object) → str[source]

Rewrite gold to this dataset. A quoted reference to another dataset is rejected.

ds_provider_aic_py_lib.dataset.utils.sql.has_order_by(sql: str) → bool[source]

Return whether sql has an ORDER BY outside strings and line comments.

ds_provider_aic_py_lib.dataset.utils.sql.statement(sql: str, offset: int) → str[source]

Return sql unchanged, or the same statement moved by offset rows.

The wrapper keeps row order only when sql has ORDER BY. The newline before the closing parenthesis keeps a trailing -- comment from swallowing it.