About Replacing External Language Scripts
To replace a previously registered external language script, use the external language script SYSUIF.REPLACE_FILE procedure.
Before You Begin
Verify that you have the EXECUTE privilege on the REPLACE_FILE external stored procedure, and the CREATE EXTERNAL PROCEDURE privilege on the current database.
SYSUIF.REPLACE_FILE
The SYSUIF.REPLACE_FILE external stored procedure has the following definition:
SYSUIF.REPLACE_FILE(
IN uif_name VARCHAR(128)NOT CASESPECIFIC CHARACTER SET UNICODE,
IN uif_filename VARCHAR(256) CASESPECIFIC CHARACTER SET UNICODE,
IN locspec VARCHAR(1024)CASESPECIFIC CHARACTER SET UNICODE, IN override_lock int);
where:
Argument … |
Specifies … |
|||
uif_name |
the SQL name associated with the user-installed file. It cannot have a database name associated with it, as the file is always installed in the current database. The uif_name should be unique within a database. The uif_name can be any valid Teradata identifier. |
|||
uif_filename |
the name of file with the extension (if any). This can be any valid LINUX file name. |
|||
locspec |
the location of the replacement file. The format is identical to the SYSUIF.INSTALL_FILE locspec parameter. The first two characters of the locspec string specify whether the replacement archive file is on the client or on the database server. If the first two characters are... The third character of the locspec string is a delimiter that you choose to separate the first two characters from the remaining characters in the locspec string. The remaining characters in the locspec string specify the file path. If the external language script is on the… If the file path is relative, the full path to the file is formed by appending the relative path to the default path for source code on the server. To determine the default path for source code, use the -o option of the cufconfig utility and find the setting for the SourceDirectoryPath field: cufconfig -o
For information on cufconfig, see Utilities: Volume 1 (A-K). If the replacement file does not exist in the current database, the REPLACE_FILE creates and registers a new file with the database. The new file is updated and distributed to all nodes. If a node is down, the pending file copy is recorded and copied as soon as the node comes back up. |
|||
override_lock |
an integer value for the override lock. If a script is being executed in the database where the file is being replaced, then all files in that database are locked with read-only access. REPLACE_FILE must wait until the script is executed and permission is granted to write the file. If override_lock is set to 1, then the file is replaced even if a script is being executed. The value of override_lock is 1 or 0. |
Example
The following statement replaces the existing file mapper with the new file mapper.py:
CALL SYSUIF.REPLACE_FILE('mapper', 'mapper.py',
'cz!mapper.py!/tmp/mapper.py',0);