ALIAS

You create an alias for a table to make referencing it in your code simpler and more concise. Using an alias enables you to streamlines queries and improves readability, especially in complex statements.

Syntax
alias_definition ::= ALIAS table_source_type table_name AS table_alias
table_source_type ::= {EXTERNAL | FACTORY | LOCAL}
Example
ALIAS LOCAL CUSTOMERS_D AS CUST

Table Source Types

Table source types include:

  • LOCAL: You define local aliases on the datasets in the same Data Augmentation Scripts application.
    Example:
    DEFINE DATASET CHANNELS_D FROM CHANNELS END
    ALIAS LOCAL CHANNELS_D AS CHAN
    
  • EXTERNAL: You define external aliases on the imported source tables.
    Example:
    IMPORT SOURCE CUSTOMERS
    ALIAS EXTERNAL CUSTOMERS AS CUST
    
  • FACTORY: You define factory aliases on tables in the other modules.
    Example:
    IMPORT MODULE FA_GL
    ALIAS FACTORY DW_LEDGER_D AS LEDGER
    

    In this example, DW_LEDGER_D is a warehouse table in the module FA_GL

Note:

  • If multiple tables share the same name across different table source types (LOCAL, FACTORY, EXTERNAL) and you define an alias without specifying table_source_type, Data Augmentation Scripts assigns the alias to the table based on the preference order: LOCAL > FACTORY > EXTERNAL. This means the alias is first created for a LOCAL dataset, followed by a FACTORY table, and then an EXTERNAL source.
  • After you define an alias, you must use the alias in the code instead of the actual table name.