column_casesensitive_handler | Configuration Options | Teradata Python Package - 17.00 - column_casesensitive_handler - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Release Date
November 2021
Content Type
User Guide
Publication ID
B700-4006-070K
Language
English (United States)
The column_casesensitive_handler is a boolean configuration property that controls whether to treat the column names passed to analytic function arguments as 'Case Sensitive' or 'Case Insensitive'.
  • When the property is set to False (default), column names passed to analytic function wrappers are treated as 'Case Insensitive'.
  • When the property is set to True, column names are treated as 'Case Sensitive'.

When using teradataml with Vantage 1.1 or later, you must set the value of this property match the Column Name Handling property of the QueryGrid ML Engine connector. When QueryGrid ML Engine connector property Column Name Handling is set to CASE-SENSITIVE, you must set the column_casesensitive_handler to True, otherwise False.

Set the value of the column_casesensitive_handler property to match the Column Name Handling property of the QueryGrid ML Engine connector. This makes sure that column case sensitivity errors are not observed while executing the analytic functions.

For detailed information about QueryGrid ML Engine connector property, see the section "ML Engine Connector Properties" in Teradata Vantage™ User Guide, B700-4002.

When using teradataml with Vantage 1.0 MU 2 or previous versions, set the column_casesensitive_handler property to True.

Example Setup

>>> from teradataml.analytics.mle import Antiselect
>>> # Load the example dataset
... load_example_data("antiselect", "antiselect_input_mixed_case")
>>> # Create required DataFrame on a table with column names with mixed case.
... antiselect_input_mixed_case  = DataFrame.from_table("antiselect_input_mixed_case")
>>> antiselect_input_mixed_case
       OrderId ORDERDATE       PRIORITY quantity       sales  Discount        shipmode            custname province   region     custsegment          prodcat
rowids                                                                                                                                                      
86         515  10/08/28  not specified       21    146.6900      0.05     regular air      carlos soltero  nunavut  nunavut        consumer        furniture
50         293  12/10/01           high       27    244.5700      0.01     regular air        barry french  nunavut  nunavut        consumer  office supplies
49         293  12/10/01           high       49  10123.0200      0.07  delivery truck        barry french  nunavut  nunavut        consumer  office supplies
1            3  10/10/13            low        6    261.5400      0.04     regular air  muhammed macintyre  nunavut  nunavut  small business  office supplies
80         483  11/07/10           high       30   4965.7595      0.08     regular air       clay rozendal  nunavut  nunavut       corporate       technology
85         515  10/08/28  not specified       19    394.2700      0.08     regular air      carlos soltero  nunavut  nunavut        consumer  office supplies
97         613  11/06/17           high       12     93.5400      0.03     regular air        carl jackson  nunavut  nunavut       corporate  office supplies

Example 1: When QueryGrid ML Engine Connector Property Column Name Handling is set to CASE-SENSITIVE

If column_casesensitive_handler configuration option is set to False (default), error is raised for cases where mixed case columns are present and QueryGrid ML Engine Connector property values does not match the teradataml configuration property.
>>> # Set the teradataml Configuration property 'column_casesensitive_handler' False
>>> configure.column_casesensitive_handler = False
>>> # Check the configuration property value for teradataml
>>> print("configure.column_casesensitive_handler is set to: {}".format(str(configure.column_casesensitive_handler)))
configure.column_casesensitive_handler is set to: False
>>> # Execute the Antiselect function.
>>> result = Antiselect(data=antiselect_input_mixed_case,
...                     exclude=['rowids','ORDERDATE','Discount','province','custsegment']
...                    )
Traceback (most recent call last):
  File "/Users/pp186043/Github_Repos/teradataml_repo/pyTeradata/teradataml/analytics/mle/Antiselect.py", line 223, in __execute
    UtilFuncs._create_view(sqlmr_stdout_temp_tablename, self.sqlmr_query)
.
.
.
teradatasql.OperationalError: [Version 16.20.0.39] [Session 10534] [Teradata Database] [Error 9134] QGIEC: 60104: (afb007ce-ed78-4d17-995b-000000002c85) tdap1110t1 : FFMeta : ANTISELECT: The column ORDERDATE in Exclude cannot be found. ()
.
.
.
 at runtime.goexit asm_amd64.s:2361'
Set the column_casesensitive_handler configuration option to True.
>>> # Set the teradataml Configuration property 'column_casesensitive_handler' True
>>> configure.column_casesensitive_handler = True

>>> # Check the configuration property value for teradataml
>>> print("configure.column_casesensitive_handler is set to: {}".format(str(configure.column_casesensitive_handler)))
configure.column_casesensitive_handler is set to: True
>>> # Execute the Antiselect function.
>>> result = Antiselect(data=antiselect_input_mixed_case,
...                     exclude=['rowids','ORDERDATE','Discount','province','custsegment']
...                    )
>>>
>>> result
############ STDOUT Output ############
 
  OrderId       PRIORITY quantity       sales        shipmode            custname   region          prodcat
0     515  not specified       21    146.6900     regular air      carlos soltero  nunavut        furniture
1     293           high       27    244.5700     regular air        barry french  nunavut  office supplies
2     293           high       49  10123.0200  delivery truck        barry french  nunavut  office supplies
3       3            low        6    261.5400     regular air  muhammed macintyre  nunavut  office supplies
4     483           high       30   4965.7595     regular air       clay rozendal  nunavut       technology
5     515  not specified       19    394.2700     regular air      carlos soltero  nunavut  office supplies
6     613           high       12     93.5400     regular air        carl jackson  nunavut  office supplies

Example 2: When QueryGrid ML Engine Connector Property Column Name Handling is set to CASE-INSENSITIVE

The column_casesensitive_handler configuration option is set to False (Default). teradataml configuration property matches with the QueryGrid ML Engine Connector property value.
>>> from teradataml.analytics.mle import Antiselect
>>> # Set the teradataml Configuration property 'column_casesensitive_handler' False
>>> configure.column_casesensitive_handler = False

>>> # Check the configuration property value for teradataml
>>> print("configure.column_casesensitive_handler is set to: {}".format(str(configure.column_casesensitive_handler)))
configure.column_casesensitive_handler is set to: False
>>>
>>> result = Antiselect(data=antiselect_input_mixed_case,
...                     exclude=['rowids','ORDERDATE','Discount','province','custsegment']
...                    )
>>>
>>> result
############ STDOUT Output ############
 
  orderid       priority quantity       sales        shipmode            custname   region          prodcat
0     613           high       12     93.5400     regular air        carl jackson  nunavut  office supplies
1     515  not specified       21    146.6900     regular air      carlos soltero  nunavut        furniture
2     293           high       49  10123.0200  delivery truck        barry french  nunavut  office supplies
3       3            low        6    261.5400     regular air  muhammed macintyre  nunavut  office supplies
4     515  not specified       19    394.2700     regular air      carlos soltero  nunavut  office supplies
5     293           high       27    244.5700     regular air        barry french  nunavut  office supplies
6     483           high       30   4965.7595     regular air       clay rozendal  nunavut       technology
If the column_casesensitive_handler configuration option is set to True, error is raised for cases where mixed case columns are present and QueryGrid ML Engine Connector property values does not match the teradataml configuration property.
>>> from teradataml.analytics.mle import Antiselect
>>> # Set the teradataml Configuration property 'column_casesensitive_handler' True
>>> configure.column_casesensitive_handler = True
>>> # Check the configuration property value for teradataml
>>> print("configure.column_casesensitive_handler is set to: {}".format(str(configure.column_casesensitive_handler)))
configure.column_casesensitive_handler is set to: True
>>>
>>> # Execute the Antiselect function
>>> result = Antiselect(data=antiselect_input_mixed_case,
...                     exclude=['rowids','ORDERDATE','Discount','province','custsegment']
...                    )
Traceback (most recent call last):
  File "/Users/pp186043/Github_Repos/teradataml_repo/pyTeradata/teradataml/analytics/mle/Antiselect.py", line 223, in __execute
    UtilFuncs._create_view(sqlmr_stdout_temp_tablename, self.sqlmr_query)
.
.
.
teradatasql.OperationalError: [Version 16.20.0.39] [Session 10559] [Teradata Database] [Error 9134] QGIEC: 60104: (afb007ce-ed78-4d17-995b-000000002c9f) tdap1110t1 : FFMeta : ANTISELECT: The column "ORDERDATE" in Exclude cannot be found. ()
 at github.td.teradata.com/gosql/gosqldriver.git/teradatasql.(*teradataConnection).formatDatabaseError TeradataConnection.go:1057
.
.
.
 at runtime.goexit asm_amd64.s:2361'