Skip to content

tdfs4ds.utils.storage

tdfs4ds.utils.storage

Backing-table storage selection for TimeManager / FilterManager.

On Vantage Cloud Lake (VCL), a tdstone2 model run via the Apply backend scores on the Analytical Compute Cluster (ACC), which reads its dataset from the Object File System (OFS). Passing storage='OFS' to a manager constructor makes that manager's hidden table be created on OFS (MAP = TD_MAP2, STORAGE = TD_OFSSTORAGE) instead of the default block storage. The choice is per manager (a constructor argument, never a global) so block-storage (full primary cluster) processes and OFS/Apply processes can coexist in the same session.

Making an Apply-scored view that references a manager work on the ACC needs TWO things (confirmed live on VCL):

  1. The manager table on OFS — storage='OFS' here, so the ACC can read it. A block-storage manager table read by an ACC query raises Error 6881 ("Query is not eligible to run on Analytical Compute Cluster").
  2. The filter referenced as a JOIN, not a correlated scalar subquery. The ACC rejects ... WHERE d <= (SELECT BUSINESS_DATE FROM <tm_view>) with 6881, but accepts a JOIN to the manager view. Authoring the filter as a JOIN is the user's responsibility — it is a property of the scoring/feature view's SQL, not of the manager. (A hard-coded literal also passes, but a JOIN keeps the reference dynamic so time-travel via update() still works.)

So storage='OFS' is necessary but not sufficient on its own: OFS + JOIN scores; OFS + scalar subquery still 6881s. For a view that reads an OFS table directly (no subquery), storage='OFS' is all that's needed.

Backward compatibility: the default (storage=None) emits no storage clause at all — byte-identical DDL to previous versions.

_OFS_ALIASES module-attribute

_OFS_ALIASES = {'OFS', 'TD_OFSSTORAGE', 'LAKE', 'OBJECT'}

_DEFAULT_ALIASES module-attribute

_DEFAULT_ALIASES = {'', 'DEFAULT', 'BLOCK', 'PRIMARY', 'TD_MAP1'}

DEFAULT_OFS_MAP module-attribute

DEFAULT_OFS_MAP = 'TD_MAP2'

ACC_6881_HINT module-attribute

ACC_6881_HINT = "Error 6881 (not eligible for the Analytical Compute Cluster): for a tdstone2-Apply view that references a TimeManager/FilterManager, TWO things are needed — (a) the manager table on OFS (storage='OFS'), so the ACC can read it, AND (b) the filter written as a JOIN to the manager view, NOT a correlated scalar subquery '(SELECT BUSINESS_DATE FROM <view>)', which the ACC rejects. OFS + JOIN scores; OFS + scalar subquery still 6881s. The filter shape is the user's responsibility. Also: run the model's score() BEFORE upload_features — roll_out/run() cannot drive an Apply model (its ingestion CTAS also hits 6881)."

resolve_storage

resolve_storage(storage)

Normalize a storage selector to 'OFS' or None (system default).

Parameters:

Name Type Description Default
storage

None/'OFS'/'default'/'block'/... (case-insensitive).

required

Returns:

Type Description

'OFS' for an OFS selector, else None (system default / block storage).

Unknown values fall back to None (backward-safe) with a warning.

storage_clause

storage_clause(storage, ofs_map=DEFAULT_OFS_MAP)

Return the CREATE TABLE options fragment for the requested storage.

The fragment is inserted immediately after the table name, e.g.::

CREATE TABLE db.tbl{storage_clause(...)} ( ... ) PRIMARY INDEX (...)

Parameters:

Name Type Description Default
storage

storage selector (see :func:resolve_storage).

required
ofs_map

the map paired with STORAGE = TD_OFSSTORAGE when OFS is requested.

DEFAULT_OFS_MAP

Returns:

Type Description

'' for the system default (unchanged DDL), or

',\n MAP = <ofs_map>,\n STORAGE = TD_OFSSTORAGE' for OFS.

is_acc_ineligible_error

is_acc_ineligible_error(exc)

True if exc looks like a Teradata ACC-ineligibility error (6881).