2.3. Using Version Aliases¶
In REDLIN, every lineage harvesting run is identified by a unique version_id (typically a timestamp formatted like YYYY-MM-DD HH:MI:SS.FF3). While precise, these timestamps can be cumbersome to remember or use in daily queries.
To simplify querying, REDLIN allows you to assign business-meaningful names (aliases) to specific versions using the redlin.lin_version_aliases table.
2.3.1. Querying with Aliases¶
When using the LIN_GEN_LINEAGE function, the version_id parameter natively supports aliases. You can simply provide the alias string instead of a timestamp.
The function automatically detects if the provided input matches the timestamp pattern. If it does not match, it treats the input as an alias and looks up the corresponding timestamp from the redlin.lin_version_aliases table behind the scenes.
Setting a Version Alias
1-- PROD_RELEASE_24_01 is an alias for the timestamp 2026-07-20 14:30:00.000
2execute script api_redlin.add_version_alias('PROD_RELEASE_24_01','2026-07-20 14:30:00.000');
Example: Querying by Alias
1-- Find lineage using a human-readable alias
2SELECT * FROM (
3 IMPORT FROM SCRIPT "REDLIN"."LIN_GEN_LINEAGE" WITH
4 DIRECTION = 'DOWN'
5 START_SCHEMA = 'PSV_CORE_BA'
6 START_TABLE = 'CUSTOMER'
7 START_COLUMN = 'SURENAME'
8 VERSION_ID = 'PROD_RELEASE_24_01'
9);
Example: Querying by Timestamp
If you still need to query a specific historical timestamp directly, you can pass the timestamp string as usual. The function will recognize the format and bypass the alias lookup:
1-- Find lineage using the exact timestamp
2SELECT * FROM (
3 IMPORT FROM SCRIPT "REDLIN"."LIN_GEN_LINEAGE" WITH
4 DIRECTION = 'DOWN'
5 START_SCHEMA = 'PSV_CORE_BA'
6 START_TABLE = 'CUSTOMER'
7 START_COLUMN = 'SURENAME'
8 VERSION_ID = '2026-07-20 14:30:00.000'
9);
By leveraging version aliases, you can ensure your SQL queries remain robust, readable, and tied to significant business events (e.g., releases, monthly closings) rather than obscure runtime timestamps.