Setting Up a Test User and Privileges
As an administrative user, set up a test user and grant the necessary privileges to the user to run the following examples.
CREATE USER nos_usr FROM dbc AS PERMANENT=30e8 PASSWORD=nos; GRANT CREATE TABLE on nos_usr to nos_usr; GRANT EXECUTE FUNCTION on TD_SYSFNLIB.READ_NOS to nos_usr; GRANT CREATE AUTHORIZATION on nos_usr to nos_usr; GRANT CREATE DATASET SCHEMA ON SYSUDTLIB TO nos_usr; GRANT CREATE FUNCTION ON nos_usr to nos_usr;
Setting Up an Authorization Object and a Function Mapping
- Log on as a user with the required privileges. For example log in as the user just created, nos_usr.
- Create an authorization object with the credentials to external object store:
CREATE AUTHORIZATION DefAuth AS DEFINER TRUSTED USER '' PASSWORD '';
To access the Teradata-supplied public buckets, enclose an empty string in single straight quotes for USER and PASSWORD. - Create a function mapping:
CREATE FUNCTION MAPPING READ_NOS_FM FOR READ_NOS EXTERNAL SECURITY DEFINER TRUSTED DefAuth USING BUFFERSIZE, SAMPLE_PERC, ROWFORMAT, RETURNTYPE, HEADER, MANIFEST, LOCATION, STOREDAS, FULLSCAN, ANY IN TABLE;
For more details, see Controlling Foreign Table Access with an AUTHORIZATION Object and Controlling READ_NOS and WRITE_NOS Access with a Function Mapping.