tdfs4ds.utils.read_cache¶
tdfs4ds.utils.read_cache
¶
A cache of object definitions (SHOW VIEW / SHOW TABLE) for one call (0.3.7.20).
upload_features builds the lineage of the view it registers several times (TimeManager
detection, the check, the soft clone, the lineage record, the process-SQL capture), and each
build reads every object's definition again: four SHOW statements per object, measured.
Inside :func:ddl_cache a definition is read once.
Scope and safety:
- The cache lives in a context variable, so other threads (the admin app) never see it.
- Errors are cached too: a SHOW VIEW on a table fails every time, so the second attempt is answered from the cache as well.
- Any statement that is not a read, sent through
teradataml.execute_sqlby the context holding the cache, clears it (a CREATE / REPLACE / DROP may change a definition already read; seen live: a soft clone created after a failed SHOW VIEW of its name). tdfs4ds also clears it explicitly after the soft clone and the optimizer's rewrite (:func:invalidate). A view changed by another session during the call is not seen until the call ends.
_READ_HEADS
module-attribute
¶
_READ_HEADS = ('SELECT', 'SEL ', 'SEL\n', 'SHOW', 'HELP', 'EXPLAIN', 'LOCKING', 'WITH', 'CURRENT VALIDTIME SEL', 'NONSEQUENCED VALIDTIME SEL', 'VALIDTIME AS OF')
_install_invalidation
¶
Clear the cache of the calling context on any statement that is not a read sent through
teradataml.execute_sql (a CREATE / REPLACE / DROP may change a definition already read:
seen live, a soft clone created after a failed SHOW VIEW of its name). Installed once;
a context without a cache (another thread) passes straight through.
ddl_cache
¶
Cache object definitions for the block. Nested blocks share the outer cache.
suspended
¶
No cache inside the block (a run moves manager views, so definitions may change).
with_ddl_cache
¶
Run fn inside :func:ddl_cache (signature and source kept: functools.wraps).