Teradata Package for Python Function Reference | 20.00 - set_session_param - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference - 20.00
- Deployment
- VantageCloud
- VantageCore
- Edition
- Enterprise
- IntelliFlex
- VMware
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Enterprise_2000
- lifecycle
- latest
- Product Category
- Teradata Vantage
- teradataml.dbutils.dbutils.set_session_param = set_session_param(name, value)
- DESCRIPTION:
Function to set the session parameter.
Note:
* Look at Vantage documentation for session parameters.
PARAMETERS:
name:
Required Argument.
Specifies the name of the parameter to set.
Permitted Values: timezone, calendar, account, character_set_unicode,
collation, constraint, database, dateform, debug_function,
dot_notation, isolated_loading, function_trace, json_ignore_errors,
searchuifdbpath, transaction_isolation_level, query_band, udfsearchpath
Types: str
value:
Required Argument.
Specifies the value for the parameter "name" to set.
Permitted Values:
1. timezone: timezone strings
2. calendar: Teradata, ISO, Compatible
3. character_set_unicode: ON, OFF
4. account: should be a list in which first item should be "account string" second should be
either SESSION or REQUEST.
5. collation: ASCII, CHARSET_COLL, EBCDIC, HOST, JIS_COLL, MULTINATIONAL
6. constraint: row_level_security_constraint_name {( level_name | category_name [,...] | NULL )}
where,
row_level_security_constraint_name:
Name of an existing constraint.
The specified constraint_name must be currently assigned to the user.
User can specify a maximum of 6 hierarchical constraints and 2 non-hierarchical
constraints per SET SESSION CONSTRAINT statement.
level_name:
Name of a hierarchical level, valid for the constraint_name, that is to replace the
default level.
The specified level_name must be currently assigned to the user. Otherwise, Vantage
returns an error to the requestor.
category_name:
A set of one or more existing non-hierarchical category names valid for the
constraint_name.
Because all assigned category (non-hierarchical) constraint values assigned to a
user are automatically active, "set_session_param" is only useful to specify a
subset of the assigned categories for the constraint.
For example, assume that User BOB has 3 country codes, and wants to load a table
with data that is to be made available to User CARL who only has rights to see data
for his own country. User BOB can use "set_session_param" to specify only the
country code for User CARL when loading the data so Carl can access the data later.
7. database: Name of the new default database for the remainder of the current session.
8. dateform: ANSIDATE, INTEGERDATE
9. debug_function: should be a list in which first item should be "function_name" second should be
either ON or OFF.
10. dot_notation: DEFAULT, LIST, NULL ERROR
11. isolated_loading: NO, '', CONCURRENT
12. function_trace: should be a list first item should be "mask_string" and second should be table name.
13. json_ignore_errors: ON, OFF
14. searchuifdbpath: string in format 'database_name, user_name'
15. transaction_isolation_level: READ UNCOMMITTED, RU, SERIALIZABLE, SR
16. query_band: should be a list first item should be "band_specification" and second should be either
SESSION or TRANSACTION
17. udfsearchpath: should be a list first item should be "database_name" and second should be "udf_name"
Types: str or list of strings
Returns:
True, if session parameter is set successfully.
RAISES:
ValueError, teradatasql.OperationalError
EXAMPLES:
# Example 1: Set time zone offset for the session as the system default.
>>> set_session_param('timezone', "'LOCAL'")
True
# Example 2: Set time zone to "AMERICA PACIFIC".
>>> set_session_param('timezone', "'AMERICA PACIFIC'")
True
# Example 3: Set time zone to "-07:00".
>>> set_session_param('timezone', "'-07:00'")
True
# Example 4: Set time zone to 3 hours ahead of 'GMT'.
>>> set_session_param('timezone', "3")
True
# Example 6: Set calendar to 'COMPATIBLE'.
>>> set_session_param('calendar', "COMPATIBLE")
True
# Example 7: Dynamically changes your account to 'dbc' for the remainder of the session.
>>> set_session_param('account', ['dbc', 'SESSION'])
True
# Example 8: Enables Unicode Pass Through processing.
>>> set_session_param('character_set_unicode', 'ON')
True
# Example 9: Session set to ASCII collation.
>>> set_session_param('collation', 'ASCII')
True
# Example 10: The resulting session has a row-level security label consisting of an unclassified level
# and nato category.
>>> set_session_param('constraint', 'classification_category (norway)')
True
# Example 11: Changes the default database for the session.
>>> set_session_param('database', 'alice')
True
# Example 12: Changes the DATE format to 'INTEGERDATE'.
>>> set_session_param('dateform', 'INTEGERDATE')
True
# Example 13: Enable Debugging for the Session.
>>> set_session_param('debug_function', ['function_name', 'ON'])
True
# Example 14: Sets the session response for dot notation query result.
>>> set_session_param('dot_notation', 'DEFAULT')
True
# Example 15: DML operations are not performed as concurrent load isolated operations.
>>> set_session_param('isolated_loading', 'NO')
True
# Example 16: Enables function trace output for debugging external user-defined functions and
# external SQL procedures for the current session.
>>> set_session_param('function_trace', ["'diag,3'", 'titanic'])
True
# Example 17: Enables the validation of JSON data on INSERT operations.
>>> set_session_param('json_ignore_errors', 'ON')
True
# Example 18: Sets the database search path for the SCRIPT execution in the SessionTbl.SearchUIFDBPath column.
>>> set_session_param('SEARCHUIFDBPATH', 'dbc, alice')
True
# Example 19: Sets the read-only locking severity for all SELECT requests made against nontemporal tables,
# whether they are outer SELECT requests or subqueries, in the current session to READ regardless
# of the setting for the DBS Control parameter AccessLockForUncomRead.
# Note: SR and SERIALIZABLE are synonyms.
>>> set_session_param('TRANSACTION_ISOLATION_LEVEL', 'SR')
True
# Example 20: This example uses the PROXYROLE name:value pair in a query band to set the proxy
# role in a trusted session to a specific role.
>>> set_session_param('query_band', ["'PROXYUSER=fred;PROXYROLE=administration;'", 'SESSION'])
True
# Example 21: Allows you to specify a custom UDF search path. When you execute a UDF,
# Vantage searches this path first, before looking in the default Vantage
# search path for the UDF.
>>> set_session_param('udfsearchpath', ["alice, SYSLIB, TD_SYSFNLIB", 'bitor'])
True