Installing UDFs - Teradata Vantage

Teradata® Vantage User Guide

Product
Teradata Vantage
Release Number
1.0
Published
January 2019
Language
English (United States)
Last Update
2020-03-11
dita:mapPath
hfp1506029122470.ditamap
dita:ditavalPath
hfp1506029122470.ditaval
dita:id
B700-4002
lifecycle
previous
Product Category
Teradata Vantage
  1. Register your UDF archive file and install it in Teradata nodes database file system.
    The recommended and easiest way to do this is to use Teradata Studio. Log on as an authorized Teradata SQL Engine user and call sysuif.install_file.
    For information on Teradata Studio, see Teradata® Studio™ User Guide, B035-2041.
  2. Install your UDF archive file in Teradata SQL Engine:
    CALL SYSUIF.INSTALL_FILE ('sql_identifier', 'udf_archive_file.zip', 'cb!/directory/udf_archive_file.zip');
    The sql_identifier is the SQL identifier of a UDF that is registered as a user-installed file and stored in directory/udf_archive_file.zip.
    For example, in the following command, the UDF new_kmeans.uif is registered as a user-installed file with SQL identifier 'new_kmeans_uif'and stored in the directory /users/mig:
    CALL SYSUIF.INSTALL_FILE ('new_kmeans_uif', 'new_kmeans.zip','cb!/users/mig/new_kmeans.zip');
    When given this call, the stored procedure sysuif.install_file registers and copies your UDF archive file from /users/mig/new_kmeans.zip on the client machine to all database nodes of your target Teradata system. For more information on this call, see Teradata® Database SQL Functions, Operators, Expressions, and Predicates, B035-1145.
  3. Verify the registered files:
    SELECT databasename, tablename, version FROM dbc.tables WHERE tablekind = 'Z';
  4. Install your UDF in Teradata ML Engine in the default schema:
    CALL PM.INSTALL_AFUNCTION ('sql_identifier');
    The default schema is the private schema with the same name as the current Teradata SQL Engine user. For example, if the current user is alice, the default schema on the Teradata ML Engine is the private schema alice. If the Teradata ML Engine schema and user do not exist, the system creates them.
  5. Verify the installed functions:
    HELP FOREIGN SCHEMA default_schema@coprocessor;
    For example:
    HELP FOREIGN SCHEMA alice@coprocessor;
    For more details on installed functions, run the HELP FOREIGN FUNCTION command. For information about this command, see Help Foreign Function Command and Help Foreign Schema Command.
  6. [Optional] Install your UDF in public schema:
    CALL PM.INSTALL_AFUNCTION_TO_PUBLIC ('sql_identifier');
    CALL PM.INSTALL_AFUNCTION_TO_PUBLIC ('new_kmeans_uif');
  7. [Optional] Create a function alias for your UDF.
    For more information, see Function Alias.