teradataml 20.0.0.4__py3-none-any.whl → 20.0.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of teradataml might be problematic. Click here for more details.
- teradataml/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/README.md +182 -13
- teradataml/__init__.py +2 -1
- teradataml/_version.py +2 -2
- teradataml/analytics/analytic_function_executor.py +8 -13
- teradataml/analytics/json_parser/analytic_functions_argument.py +4 -0
- teradataml/analytics/sqle/__init__.py +16 -1
- teradataml/analytics/utils.py +60 -1
- teradataml/automl/__init__.py +290 -106
- teradataml/automl/autodataprep/__init__.py +471 -0
- teradataml/automl/data_preparation.py +29 -10
- teradataml/automl/data_transformation.py +11 -0
- teradataml/automl/feature_engineering.py +64 -4
- teradataml/automl/feature_exploration.py +639 -25
- teradataml/automl/model_training.py +1 -1
- teradataml/clients/auth_client.py +12 -8
- teradataml/clients/keycloak_client.py +165 -0
- teradataml/common/constants.py +71 -26
- teradataml/common/exceptions.py +32 -0
- teradataml/common/messagecodes.py +28 -0
- teradataml/common/messages.py +13 -4
- teradataml/common/sqlbundle.py +3 -2
- teradataml/common/utils.py +345 -45
- teradataml/context/context.py +259 -93
- teradataml/data/apriori_example.json +22 -0
- teradataml/data/docs/sqle/docs_17_20/Apriori.py +138 -0
- teradataml/data/docs/sqle/docs_17_20/NERExtractor.py +121 -0
- teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +3 -3
- teradataml/data/docs/sqle/docs_17_20/SMOTE.py +212 -0
- teradataml/data/docs/sqle/docs_17_20/TextMorph.py +119 -0
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +54 -3
- teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/DFFT.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DFFT2.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +6 -6
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/PACF.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/Resample.py +5 -5
- teradataml/data/docs/uaf/docs_17_20/SAX.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Smoothma.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +1 -1
- teradataml/data/jsons/byom/onnxembeddings.json +1 -0
- teradataml/data/jsons/sqle/17.20/NGramSplitter.json +6 -6
- teradataml/data/jsons/sqle/17.20/TD_Apriori.json +181 -0
- teradataml/data/jsons/sqle/17.20/TD_NERExtractor.json +145 -0
- teradataml/data/jsons/sqle/17.20/TD_SMOTE.json +267 -0
- teradataml/data/jsons/sqle/17.20/TD_TextMorph.json +134 -0
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +114 -9
- teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +420 -0
- teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +343 -0
- teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +359 -0
- teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +360 -0
- teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +343 -0
- teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +343 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +2 -2
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +1 -1
- teradataml/data/ner_dict.csv +8 -0
- teradataml/data/ner_input_eng.csv +7 -0
- teradataml/data/ner_rule.csv +5 -0
- teradataml/data/pattern_matching_data.csv +11 -0
- teradataml/data/pos_input.csv +40 -0
- teradataml/data/sdk/modelops/modelops_spec.json +101737 -0
- teradataml/data/tdnerextractor_example.json +14 -0
- teradataml/data/teradataml_example.json +21 -1
- teradataml/data/textmorph_example.json +5 -0
- teradataml/data/to_num_data.csv +4 -0
- teradataml/data/tochar_data.csv +5 -0
- teradataml/data/trans_dense.csv +16 -0
- teradataml/data/trans_sparse.csv +55 -0
- teradataml/data/url_data.csv +10 -9
- teradataml/dataframe/copy_to.py +38 -27
- teradataml/dataframe/data_transfer.py +61 -45
- teradataml/dataframe/dataframe.py +1110 -132
- teradataml/dataframe/dataframe_utils.py +73 -27
- teradataml/dataframe/functions.py +1070 -9
- teradataml/dataframe/sql.py +750 -959
- teradataml/dbutils/dbutils.py +33 -13
- teradataml/dbutils/filemgr.py +14 -10
- teradataml/hyperparameter_tuner/utils.py +4 -2
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/_base.py +12 -157
- teradataml/options/configure.py +24 -9
- teradataml/scriptmgmt/UserEnv.py +317 -39
- teradataml/scriptmgmt/lls_utils.py +456 -135
- teradataml/sdk/README.md +79 -0
- teradataml/sdk/__init__.py +4 -0
- teradataml/sdk/_auth_modes.py +422 -0
- teradataml/sdk/_func_params.py +487 -0
- teradataml/sdk/_json_parser.py +453 -0
- teradataml/sdk/_openapi_spec_constants.py +249 -0
- teradataml/sdk/_utils.py +236 -0
- teradataml/sdk/api_client.py +897 -0
- teradataml/sdk/constants.py +62 -0
- teradataml/sdk/modelops/__init__.py +98 -0
- teradataml/sdk/modelops/_client.py +406 -0
- teradataml/sdk/modelops/_constants.py +304 -0
- teradataml/sdk/modelops/models.py +2308 -0
- teradataml/sdk/spinner.py +107 -0
- teradataml/store/__init__.py +1 -1
- teradataml/table_operators/Apply.py +16 -1
- teradataml/table_operators/Script.py +20 -1
- teradataml/table_operators/query_generator.py +4 -21
- teradataml/table_operators/table_operator_util.py +58 -9
- teradataml/utils/dtypes.py +4 -2
- teradataml/utils/internal_buffer.py +22 -2
- teradataml/utils/utils.py +0 -1
- teradataml/utils/validators.py +318 -58
- {teradataml-20.0.0.4.dist-info → teradataml-20.0.0.6.dist-info}/METADATA +188 -14
- {teradataml-20.0.0.4.dist-info → teradataml-20.0.0.6.dist-info}/RECORD +131 -84
- {teradataml-20.0.0.4.dist-info → teradataml-20.0.0.6.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.4.dist-info → teradataml-20.0.0.6.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.4.dist-info → teradataml-20.0.0.6.dist-info}/zip-safe +0 -0
teradataml/dbutils/dbutils.py
CHANGED
|
@@ -475,7 +475,7 @@ def _get_select_table_kind(schema_name, table_name, table_kind, datalake_name):
|
|
|
475
475
|
object_name_str = _convert_sql_search_string_to_regex(object_name_str)
|
|
476
476
|
if object_name_str:
|
|
477
477
|
name_filter = pddf['Table/View/Macro Name'].str.strip().str.match(object_name_str, na=False,
|
|
478
|
-
|
|
478
|
+
flags=re.IGNORECASE)
|
|
479
479
|
pddf = pddf[name_filter]
|
|
480
480
|
|
|
481
481
|
if object_table_kind is not None:
|
|
@@ -2089,13 +2089,13 @@ def set_session_param(name, value):
|
|
|
2089
2089
|
either ON or OFF.
|
|
2090
2090
|
10. dot_notation: DEFAULT, LIST, NULL ERROR
|
|
2091
2091
|
11. isolated_loading: NO, '', CONCURRENT
|
|
2092
|
-
12. function_trace:
|
|
2092
|
+
12. function_trace: Should be a list. First item should be "mask_string" and second should be table name.
|
|
2093
2093
|
13. json_ignore_errors: ON, OFF
|
|
2094
|
-
14. searchuifdbpath:
|
|
2094
|
+
14. searchuifdbpath: String in format 'database_name, user_name'
|
|
2095
2095
|
15. transaction_isolation_level: READ UNCOMMITTED, RU, SERIALIZABLE, SR
|
|
2096
|
-
16. query_band:
|
|
2096
|
+
16. query_band: Should be a list. First item should be "band_specification" and second should be either
|
|
2097
2097
|
SESSION or TRANSACTION
|
|
2098
|
-
17. udfsearchpath:
|
|
2098
|
+
17. udfsearchpath: Should be a list. First item should be "database_name" and second should be "udf_name"
|
|
2099
2099
|
Types: str or list of strings
|
|
2100
2100
|
|
|
2101
2101
|
Returns:
|
|
@@ -2106,7 +2106,7 @@ def set_session_param(name, value):
|
|
|
2106
2106
|
|
|
2107
2107
|
EXAMPLES:
|
|
2108
2108
|
# Example 1: Set time zone offset for the session as the system default.
|
|
2109
|
-
>>> set_session_param('timezone',
|
|
2109
|
+
>>> set_session_param('timezone', 'LOCAL')
|
|
2110
2110
|
True
|
|
2111
2111
|
|
|
2112
2112
|
# Example 2: Set time zone to "AMERICA PACIFIC".
|
|
@@ -2195,10 +2195,18 @@ def set_session_param(name, value):
|
|
|
2195
2195
|
"""
|
|
2196
2196
|
# Validate argument types
|
|
2197
2197
|
function_args = []
|
|
2198
|
-
function_args.append(["name", name,
|
|
2199
|
-
function_args.append(["value", value,
|
|
2198
|
+
function_args.append(["name", name, False, str, True])
|
|
2199
|
+
function_args.append(["value", value, False, (int, str, float, list), False])
|
|
2200
2200
|
_Validators._validate_function_arguments(function_args)
|
|
2201
2201
|
|
|
2202
|
+
# Validate Permitted values for session parameter name.
|
|
2203
|
+
permitted_session_parameters = [key.name for key in SessionParamsSQL]
|
|
2204
|
+
_Validators._validate_permitted_values(arg=name,
|
|
2205
|
+
permitted_values=permitted_session_parameters,
|
|
2206
|
+
arg_name='name',
|
|
2207
|
+
case_insensitive=True,
|
|
2208
|
+
includeNone=False)
|
|
2209
|
+
|
|
2202
2210
|
if not isinstance(value, list):
|
|
2203
2211
|
value = [value]
|
|
2204
2212
|
|
|
@@ -2214,8 +2222,7 @@ def set_session_param(name, value):
|
|
|
2214
2222
|
_InternalBuffer.add(function_name=value[0] if name.upper() == 'DEBUG_FUNCTION' else '')
|
|
2215
2223
|
|
|
2216
2224
|
# Set the session parameter.
|
|
2217
|
-
execute_sql(getattr(SessionParamsSQL, name.upper()).format(*value))
|
|
2218
|
-
|
|
2225
|
+
execute_sql(getattr(SessionParamsSQL, name.upper()).value.format(*value))
|
|
2219
2226
|
return True
|
|
2220
2227
|
|
|
2221
2228
|
|
|
@@ -2241,7 +2248,7 @@ def unset_session_param(name):
|
|
|
2241
2248
|
ValueError, teradatasql.OperationalError
|
|
2242
2249
|
|
|
2243
2250
|
EXAMPLES:
|
|
2244
|
-
# Example 1:
|
|
2251
|
+
# Example 1: Unset session's time zone to previous time zone.
|
|
2245
2252
|
>>> set_session_param('timezone', "'GMT+1'")
|
|
2246
2253
|
True
|
|
2247
2254
|
>>> unset_session_param("timezone")
|
|
@@ -2253,6 +2260,17 @@ def unset_session_param(name):
|
|
|
2253
2260
|
function_args.append(["name", name, True, str, True])
|
|
2254
2261
|
_Validators._validate_function_arguments(function_args)
|
|
2255
2262
|
|
|
2263
|
+
# Validate Permitted values for session parameter name which can be unset.
|
|
2264
|
+
permitted_session_parameters = [key.name for key in SessionParamsPythonNames] +\
|
|
2265
|
+
["character_set_unicode", "debug_function",
|
|
2266
|
+
"isolated_loading", "function_trace",
|
|
2267
|
+
"json_ignore_errors", "query_band"]
|
|
2268
|
+
_Validators._validate_permitted_values(arg=name,
|
|
2269
|
+
permitted_values=permitted_session_parameters,
|
|
2270
|
+
arg_name='name',
|
|
2271
|
+
case_insensitive=True,
|
|
2272
|
+
includeNone=False)
|
|
2273
|
+
|
|
2256
2274
|
# Check whether session param is set or not first.
|
|
2257
2275
|
session_params = _InternalBuffer.get('session_params')
|
|
2258
2276
|
if session_params is None:
|
|
@@ -2261,6 +2279,8 @@ def unset_session_param(name):
|
|
|
2261
2279
|
raise TeradataMlException(error_msg, msg_code)
|
|
2262
2280
|
# unset_values stores params which are not available in _InternalBuffer, to unset create a dictionary
|
|
2263
2281
|
# with param as key and unset param as value
|
|
2282
|
+
# TODO: Unset for ISOLATED_LOADING should revert to previous behaviour, but we are setting it to NO.
|
|
2283
|
+
# This is not correct if ISOLATED_LOADING was CONCURRENT before setting it to NO.
|
|
2264
2284
|
unset_values = {"CHARACTER_SET_UNICODE": "OFF", "DEBUG_FUNCTION": [_InternalBuffer.get('function_name'), "OFF"],
|
|
2265
2285
|
"ISOLATED_LOADING": "NO", "FUNCTION_TRACE": "SET SESSION FUNCTION TRACE OFF",
|
|
2266
2286
|
"JSON_IGNORE_ERRORS": "OFF", "QUERY_BAND": ["", "SESSION"]}
|
|
@@ -2275,9 +2295,9 @@ def unset_session_param(name):
|
|
|
2275
2295
|
set_session_param(name, unset_values[name.upper()])
|
|
2276
2296
|
return True
|
|
2277
2297
|
|
|
2278
|
-
previous_value = "{}".format(session_params[getattr(SessionParamsPythonNames, name.upper())]) \
|
|
2298
|
+
previous_value = "{}".format(session_params[getattr(SessionParamsPythonNames, name.upper()).value]) \
|
|
2279
2299
|
if name.upper() != 'TIMEZONE' else "'{}'".format(
|
|
2280
|
-
session_params[getattr(SessionParamsPythonNames, name.upper())])
|
|
2300
|
+
session_params[getattr(SessionParamsPythonNames, name.upper()).value])
|
|
2281
2301
|
|
|
2282
2302
|
if name.upper() == "ACCOUNT":
|
|
2283
2303
|
previous_value = [previous_value, 'SESSION']
|
teradataml/dbutils/filemgr.py
CHANGED
|
@@ -13,18 +13,22 @@ install_file, remove_file, replace_file.
|
|
|
13
13
|
|
|
14
14
|
import os
|
|
15
15
|
from pathlib import Path
|
|
16
|
+
|
|
16
17
|
from sqlalchemy import func
|
|
17
|
-
from sqlalchemy.sql.expression import text
|
|
18
|
-
import teradataml.dataframe as tdmldf
|
|
19
|
-
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
20
18
|
from teradatasql import OperationalError as SqlOperationalError
|
|
19
|
+
|
|
20
|
+
import teradataml.dataframe as tdmldf
|
|
21
|
+
from teradataml.common.constants import TableOperatorConstants
|
|
21
22
|
from teradataml.common.exceptions import TeradataMlException
|
|
22
|
-
from teradataml.common.messages import Messages
|
|
23
23
|
from teradataml.common.messagecodes import MessageCodes
|
|
24
|
-
from teradataml.
|
|
25
|
-
from teradataml.utils
|
|
24
|
+
from teradataml.common.messages import Messages
|
|
25
|
+
from teradataml.common.utils import UtilFuncs
|
|
26
|
+
from teradataml.dbutils.dbutils import (_execute_stored_procedure,
|
|
27
|
+
set_session_param)
|
|
26
28
|
from teradataml.options.configure import configure
|
|
27
|
-
from teradataml.
|
|
29
|
+
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
30
|
+
from teradataml.utils.validators import _Validators
|
|
31
|
+
|
|
28
32
|
|
|
29
33
|
def install_file(file_identifier, file_path = None, file_on_client = True, is_binary = False,
|
|
30
34
|
replace = False, force_replace = False, suppress_output = False):
|
|
@@ -300,15 +304,15 @@ def list_files():
|
|
|
300
304
|
database = context._get_current_databasename()
|
|
301
305
|
|
|
302
306
|
# set_session_param maintains a buffer of session parameters.
|
|
303
|
-
# If the session parameter is not set or if
|
|
307
|
+
# If the session parameter is not set or if already set SearchUIFDBPath is different
|
|
304
308
|
# from the current database, then we will set the SEARCHUIFDBPATH to the current
|
|
305
309
|
# database. This will avoid setting the SEARCHUIFDBPATH multiple times.
|
|
306
310
|
session_params = _InternalBuffer.get('session_params')
|
|
307
311
|
if session_params is None or session_params["SearchUIFDBPath"] != database:
|
|
308
|
-
set_session_param("SEARCHUIFDBPATH", database)
|
|
312
|
+
set_session_param("SEARCHUIFDBPATH", UtilFuncs._get_dialect_quoted_name(database))
|
|
309
313
|
|
|
310
314
|
# Get the query to list files installed in Vantage.
|
|
311
315
|
list_files_query = TableOperatorConstants.SCRIPT_LIST_FILES_QUERY.value \
|
|
312
|
-
.format(database, configure.default_varchar_size)
|
|
316
|
+
.format(UtilFuncs._get_dialect_quoted_name(database), configure.default_varchar_size)
|
|
313
317
|
|
|
314
318
|
return tdmldf.dataframe.DataFrame.from_query(list_files_query)
|
|
@@ -276,6 +276,8 @@ class _ProgressBar:
|
|
|
276
276
|
progress_precent=_progress_percent,
|
|
277
277
|
completed_jobs=self.completed_jobs,
|
|
278
278
|
total_jobs=self.total_jobs)
|
|
279
|
+
# Add padding to clear any leftover characters from the previous message.
|
|
280
|
+
padded_msg = _msg.ljust(self.blank_space_len)
|
|
279
281
|
# Display the formatted bar.
|
|
280
|
-
print(
|
|
281
|
-
self.blank_space_len = len(
|
|
282
|
+
print(padded_msg, end='\r', file=self.STDOUT, flush=True)
|
|
283
|
+
self.blank_space_len = len(padded_msg)
|
teradataml/lib/aed_0_1.dll
CHANGED
|
Binary file
|
teradataml/opensource/_base.py
CHANGED
|
@@ -51,6 +51,7 @@ from teradataml.opensource._wrapper_utils import (_generate_new_name,
|
|
|
51
51
|
_validate_df_query_type)
|
|
52
52
|
from teradataml.options.configure import configure
|
|
53
53
|
from teradataml.utils.validators import _Validators
|
|
54
|
+
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
54
55
|
|
|
55
56
|
logger = pylogger.getLogger()
|
|
56
57
|
|
|
@@ -88,23 +89,19 @@ class _GenericObjectWrapper:
|
|
|
88
89
|
self._env = configure.openml_user_env
|
|
89
90
|
else:
|
|
90
91
|
self._env = UtilFuncs._create_or_get_env("open_source_ml.json")
|
|
91
|
-
|
|
92
|
-
# Raise exception when python versions don't match between Lake user environment and local.
|
|
93
|
-
self._process_python_version_diff_lake()
|
|
94
|
-
|
|
95
92
|
else:
|
|
96
|
-
set_session_param("searchuifdbpath",self._db_name)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
raise TeradataMlException(Messages.get_message(MessageCodes.PYTHON_VERSION_MISMATCH,
|
|
103
|
-
tdmlctx.python_version_vantage, py_major_vantage_version),
|
|
104
|
-
MessageCodes.PYTHON_VERSION_MISMATCH)
|
|
93
|
+
set_session_param("searchuifdbpath", self._db_name)
|
|
94
|
+
|
|
95
|
+
# Check if the Python interpreter major versions are consistent between Vantage and local.
|
|
96
|
+
_check_py_version = _InternalBuffer.get('_check_py_version')
|
|
97
|
+
if _check_py_version:
|
|
98
|
+
UtilFuncs._check_python_version_diff(self._env)
|
|
105
99
|
|
|
106
100
|
# Raise warning when python package versions don't match between Vantage and local.
|
|
107
|
-
|
|
101
|
+
# OPENSOURCE_PACKAGE_NAME is set for each opensource package, but not for the base class.
|
|
102
|
+
# Add a check to avoid running this function for the base class.
|
|
103
|
+
if self.OPENSOURCE_PACKAGE_NAME is not None:
|
|
104
|
+
UtilFuncs._check_package_version_diff(self.OPENSOURCE_PACKAGE_NAME.value, self._pkgs, self._env)
|
|
108
105
|
|
|
109
106
|
global _file_installed
|
|
110
107
|
## Flag to check whether trained model is installed or not.
|
|
@@ -121,149 +118,6 @@ class _GenericObjectWrapper:
|
|
|
121
118
|
|
|
122
119
|
_file_installed = True
|
|
123
120
|
|
|
124
|
-
def _process_python_version_diff_lake(self):
|
|
125
|
-
"""
|
|
126
|
-
DESCRIPTION:
|
|
127
|
-
Internal function to process Python interpreter version differences between Lake user environment and local.
|
|
128
|
-
Note:
|
|
129
|
-
* Raises an exception if the Python interpreter major versions are not consistent between
|
|
130
|
-
Lake user environment and local.
|
|
131
|
-
|
|
132
|
-
PARAMETERS:
|
|
133
|
-
None
|
|
134
|
-
|
|
135
|
-
RETURNS:
|
|
136
|
-
None
|
|
137
|
-
|
|
138
|
-
RAISES:
|
|
139
|
-
TeradataMlException
|
|
140
|
-
|
|
141
|
-
EXAMPLES:
|
|
142
|
-
self._process_python_version_diff_lake()
|
|
143
|
-
"""
|
|
144
|
-
# Get the Python interpreter version of the user environment.
|
|
145
|
-
env_list = list_user_envs()
|
|
146
|
-
user_env_name = self._env.env_name
|
|
147
|
-
env_base_version = env_list[env_list['env_name'] == user_env_name].base_env_name.values[0]
|
|
148
|
-
python_env = env_base_version.split("_")[1]
|
|
149
|
-
|
|
150
|
-
# Get the Python interpreter version of the local environment.
|
|
151
|
-
from teradataml.context import context as tdmlctx
|
|
152
|
-
python_local = tdmlctx.python_version_local.rsplit(".", 1)[0]
|
|
153
|
-
# Check if the Python interpreter major versions are consistent between Lake user environment and local.
|
|
154
|
-
# If not, raise an exception.
|
|
155
|
-
if python_env != python_local:
|
|
156
|
-
raise TeradataMlException(Messages.get_message(MessageCodes.PYTHON_VERSION_MISMATCH_OAF,
|
|
157
|
-
python_env, python_local),
|
|
158
|
-
MessageCodes.PYTHON_VERSION_MISMATCH_OAF)
|
|
159
|
-
|
|
160
|
-
def _process_package_differences(self):
|
|
161
|
-
"""
|
|
162
|
-
DESCRIPTION:
|
|
163
|
-
Internal function to process package differences between Vantage and local.
|
|
164
|
-
Note:
|
|
165
|
-
* Raises a warning if the versions of certain Python packages are not consistent between Vantage and local.
|
|
166
|
-
|
|
167
|
-
PARAMETERS:
|
|
168
|
-
None
|
|
169
|
-
|
|
170
|
-
RETURNS:
|
|
171
|
-
None
|
|
172
|
-
|
|
173
|
-
RAISES:
|
|
174
|
-
PackageNotFoundError: If the package is not found in the local environment for OAF.
|
|
175
|
-
|
|
176
|
-
EXAMPLES:
|
|
177
|
-
self._process_package_differences()
|
|
178
|
-
"""
|
|
179
|
-
# OPENSOURCE_PACKAGE_NAME is set for each opensource package, but not for the base class.
|
|
180
|
-
# Add a check to avoid running this function for the base class.
|
|
181
|
-
if self.OPENSOURCE_PACKAGE_NAME is None:
|
|
182
|
-
return
|
|
183
|
-
_is_packages_verfied_in_vantage = _packages_verified_in_vantage.get(
|
|
184
|
-
self.OPENSOURCE_PACKAGE_NAME.value, None)
|
|
185
|
-
if _is_packages_verfied_in_vantage:
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
if self._is_lake_system:
|
|
189
|
-
env_pkg_df = self._env.libs
|
|
190
|
-
pkgs_dict = dict(zip(env_pkg_df['name'], env_pkg_df['version']))
|
|
191
|
-
|
|
192
|
-
i = 0
|
|
193
|
-
from importlib.metadata import version
|
|
194
|
-
warning_raised = False
|
|
195
|
-
for pkg in self._pkgs:
|
|
196
|
-
env_version = pkgs_dict.get(pkg)
|
|
197
|
-
try:
|
|
198
|
-
local_version = version(pkg)
|
|
199
|
-
except Exception as e:
|
|
200
|
-
raise
|
|
201
|
-
if env_version != local_version:
|
|
202
|
-
warning_raised = True
|
|
203
|
-
if i == 0:
|
|
204
|
-
strr = f"{pkg}=={local_version}\n"
|
|
205
|
-
i += 1
|
|
206
|
-
else:
|
|
207
|
-
strr += f"{pkg}=={local_version}\n"
|
|
208
|
-
|
|
209
|
-
# If there are differences in package versions, display a warning message to the user.
|
|
210
|
-
# about the package differences and the requirements file created for the user to install the packages
|
|
211
|
-
if warning_raised:
|
|
212
|
-
file_name = f"requirements_{self.OPENSOURCE_PACKAGE_NAME.value}.txt"
|
|
213
|
-
req_file = os.path.join(self._tdml_tmp_dir, file_name)
|
|
214
|
-
with open(req_file, "w") as f:
|
|
215
|
-
f.write(strr)
|
|
216
|
-
_pkgs = "', '".join(self._pkgs[:-1]) + "' and '" + self._pkgs[-1]
|
|
217
|
-
warning_msg = "The versions of certain Python packages are not consistent between "\
|
|
218
|
-
"Lake user environment and local. OpenSourceML compares the versions of '{}' "\
|
|
219
|
-
f"(and also matches the patterns of these packages) used by 'td_{self.OPENSOURCE_PACKAGE_NAME.value}'. "\
|
|
220
|
-
"Teradata recommends same versions for all the Python packages between Lake "\
|
|
221
|
-
"user environment and local."
|
|
222
|
-
req = f"\nA requirements file listing all '{self.OPENSOURCE_PACKAGE_NAME.value}' " + \
|
|
223
|
-
f"related packages and their versions has been written to '{req_file}'. "+ \
|
|
224
|
-
"Update the Lake user environment with the required packages.\n"
|
|
225
|
-
|
|
226
|
-
warning_msg += req
|
|
227
|
-
warnings.warn(warning_msg.format(_pkgs), category=OneTimeUserWarning)
|
|
228
|
-
|
|
229
|
-
else:
|
|
230
|
-
# Check if the versions of Python packages are consistent between Vantage and local.
|
|
231
|
-
from teradataml.dbutils.dbutils import _db_python_package_version_diff
|
|
232
|
-
all_package_versions = _db_python_package_version_diff(self._pkgs, only_diff=False)
|
|
233
|
-
package_difference = \
|
|
234
|
-
all_package_versions[all_package_versions.vantage != all_package_versions.local]
|
|
235
|
-
# If there are differences in package versions, raise a warning.
|
|
236
|
-
if package_difference.shape[0] > 0:
|
|
237
|
-
_pkgs = "', '".join(self._pkgs[:-1]) + "' and '" + self._pkgs[-1]
|
|
238
|
-
warning_msg = "The versions of certain Python packages are not consistent between "\
|
|
239
|
-
"Vantage and local. User can identify them using db_python_package_version_diff() "\
|
|
240
|
-
"function. OpenSourceML compares the versions of '{}' (and also matches the "\
|
|
241
|
-
f"patterns of these packages) used by 'td_{self.OPENSOURCE_PACKAGE_NAME.value}'. Teradata "\
|
|
242
|
-
"recommends to maintain same versions for all the Python packages between Vantage "\
|
|
243
|
-
"and local."
|
|
244
|
-
i = 0
|
|
245
|
-
# Write the requirements file listing all the related packages and their versions.
|
|
246
|
-
for rec in all_package_versions.to_records():
|
|
247
|
-
if i == 0:
|
|
248
|
-
strr = f"{rec[1]}=={rec[2]}\n"
|
|
249
|
-
i += 1
|
|
250
|
-
else:
|
|
251
|
-
strr += f"{rec[1]}=={rec[2]}\n"
|
|
252
|
-
file_name = f"requirements_{self.OPENSOURCE_PACKAGE_NAME.value}.txt"
|
|
253
|
-
req_file = os.path.join(self._tdml_tmp_dir, file_name)
|
|
254
|
-
with open(req_file, "w") as f:
|
|
255
|
-
f.write(strr)
|
|
256
|
-
|
|
257
|
-
# Display a warning message to the user about the package differences
|
|
258
|
-
# and the requirements file created for the user to install the packages.
|
|
259
|
-
req = f"\nA requirements file listing all '{self.OPENSOURCE_PACKAGE_NAME.value}' " + \
|
|
260
|
-
f"related packages and their versions has been written to '{req_file}'.\n"
|
|
261
|
-
|
|
262
|
-
warning_msg += req
|
|
263
|
-
warnings.warn(warning_msg.format(_pkgs), category=OneTimeUserWarning)
|
|
264
|
-
|
|
265
|
-
_packages_verified_in_vantage[self.OPENSOURCE_PACKAGE_NAME.value] = True
|
|
266
|
-
|
|
267
121
|
def _get_columns_as_list(self, cols):
|
|
268
122
|
"""
|
|
269
123
|
Internal function to get columns as list of strings.
|
|
@@ -1408,6 +1262,7 @@ class _OpenSourceObjectWrapper(_GenericObjectWrapper):
|
|
|
1408
1262
|
|
|
1409
1263
|
class _FunctionWrapper(_GenericObjectWrapper):
|
|
1410
1264
|
def __init__(self, module_name, func_name, file_type, template_file):
|
|
1265
|
+
|
|
1411
1266
|
super().__init__()
|
|
1412
1267
|
self._module_name = module_name
|
|
1413
1268
|
self._func_name = func_name
|
teradataml/options/configure.py
CHANGED
|
@@ -62,6 +62,7 @@ class _Configure(_ConfigureSuper):
|
|
|
62
62
|
stored_procedure_install_location = _create_property('stored_procedure_install_location')
|
|
63
63
|
table_operator = _create_property('table_operator')
|
|
64
64
|
temp_object_type = _create_property('temp_object_type')
|
|
65
|
+
use_short_object_name = _create_property('use_short_object_name')
|
|
65
66
|
|
|
66
67
|
def __init__(self, default_varchar_size=1024, column_casesensitive_handler=False,
|
|
67
68
|
vantage_version="vantage1.1", val_install_location=None,
|
|
@@ -71,7 +72,7 @@ class _Configure(_ConfigureSuper):
|
|
|
71
72
|
cran_repositories=None, inline_plot=True,
|
|
72
73
|
indb_install_location=None,
|
|
73
74
|
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB",
|
|
74
|
-
table_operator=None, temp_object_type=None):
|
|
75
|
+
table_operator=None, temp_object_type=None, use_short_object_name=False):
|
|
75
76
|
|
|
76
77
|
"""
|
|
77
78
|
PARAMETERS:
|
|
@@ -140,8 +141,8 @@ class _Configure(_ConfigureSuper):
|
|
|
140
141
|
|
|
141
142
|
indb_install_location:
|
|
142
143
|
Specifies the installation location of In-DB Python package.
|
|
143
|
-
Types: string
|
|
144
144
|
Default Value: "/var/opt/teradata/languages/sles12sp3/Python/"
|
|
145
|
+
Types: string
|
|
145
146
|
Example:
|
|
146
147
|
# Set the installation location for older versions.
|
|
147
148
|
teradataml.options.configure.indb_install_location = "/opt/teradata/languages/Python/"
|
|
@@ -182,9 +183,9 @@ class _Configure(_ConfigureSuper):
|
|
|
182
183
|
Specifies the type of temporary database objects created internally by teradataml.
|
|
183
184
|
Permitted Values:
|
|
184
185
|
* "VT" - Volatile tables.
|
|
185
|
-
Types: String
|
|
186
186
|
Default Value: None
|
|
187
|
-
|
|
187
|
+
Types: String
|
|
188
|
+
Notes:
|
|
188
189
|
* If this option is set to "VT" and "persist" argument of analytic functions is
|
|
189
190
|
set to True, then volatile tables are not created as volatile table can't be
|
|
190
191
|
persisted and "persist" argument takes precedence.
|
|
@@ -193,6 +194,16 @@ class _Configure(_ConfigureSuper):
|
|
|
193
194
|
# Set the type of temporary database objects to "VT" to create volatile internal
|
|
194
195
|
# tables.
|
|
195
196
|
teradataml.options.configure.temp_object_type = "VT"
|
|
197
|
+
|
|
198
|
+
use_short_object_name:
|
|
199
|
+
Specifies whether to use shorter names for temporary tables created internally by teradataml.
|
|
200
|
+
When set to True, teradataml generates internal temporary table names with a maximum length
|
|
201
|
+
of 20 characters. Otherwise, there is no restriction on the length of these table names.
|
|
202
|
+
Default Value: False
|
|
203
|
+
Types: bool
|
|
204
|
+
Example:
|
|
205
|
+
# Set the option to use short names for temporary tables.
|
|
206
|
+
teradataml.options.configure.use_short_object_name = True
|
|
196
207
|
"""
|
|
197
208
|
super().__init__()
|
|
198
209
|
super().__setattr__('default_varchar_size', default_varchar_size)
|
|
@@ -213,6 +224,7 @@ class _Configure(_ConfigureSuper):
|
|
|
213
224
|
super().__setattr__('table_operator', table_operator)
|
|
214
225
|
super().__setattr__('_indb_install_location', indb_install_location)
|
|
215
226
|
super().__setattr__('temp_object_type', self.__get_temp_object_type(temp_object_type))
|
|
227
|
+
super().__setattr__('use_short_object_name', use_short_object_name)
|
|
216
228
|
|
|
217
229
|
# internal configurations
|
|
218
230
|
# These configurations are internal and should not be
|
|
@@ -244,9 +256,9 @@ class _Configure(_ConfigureSuper):
|
|
|
244
256
|
super().__setattr__('ues_url', None)
|
|
245
257
|
# base URL in Vector Store REST calls
|
|
246
258
|
super().__setattr__('_vector_store_base_url', None)
|
|
247
|
-
#
|
|
248
|
-
# By default, it is set to
|
|
249
|
-
super().__setattr__('
|
|
259
|
+
# Internal parameter, which is used to specify whether SSL verification is to be done or not.
|
|
260
|
+
# By default, it is set to True.
|
|
261
|
+
super().__setattr__('_ssl_verify', True)
|
|
250
262
|
# Internal parameter, that is used to specify the certificate file in a secured HTTP request.
|
|
251
263
|
super().__setattr__('certificate_file', False)
|
|
252
264
|
# Internal parameter, that is used for specify the maximum size of the file
|
|
@@ -330,7 +342,7 @@ class _Configure(_ConfigureSuper):
|
|
|
330
342
|
"greater than or equal to"),
|
|
331
343
|
MessageCodes.TDMLDF_POSITIVE_INT)
|
|
332
344
|
elif name in ['column_casesensitive_handler', '_validate_metaexpression',
|
|
333
|
-
'_validate_gc', 'inline_plot', '_oauth', '
|
|
345
|
+
'_validate_gc', 'inline_plot', '_oauth', '_ssl_verify']:
|
|
334
346
|
|
|
335
347
|
if not isinstance(value, bool):
|
|
336
348
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
@@ -387,7 +399,6 @@ class _Configure(_ConfigureSuper):
|
|
|
387
399
|
MessageCodes.PATH_NOT_FOUND)
|
|
388
400
|
|
|
389
401
|
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id', '_vector_store_base_url'}:
|
|
390
|
-
|
|
391
402
|
if not isinstance(value, str):
|
|
392
403
|
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'str'))
|
|
393
404
|
|
|
@@ -448,6 +459,10 @@ class _Configure(_ConfigureSuper):
|
|
|
448
459
|
|
|
449
460
|
value = self.__get_temp_object_type(value)
|
|
450
461
|
|
|
462
|
+
elif name == 'use_short_object_name':
|
|
463
|
+
if not isinstance(value, bool):
|
|
464
|
+
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'bool'))
|
|
465
|
+
|
|
451
466
|
super().__setattr__(name, value)
|
|
452
467
|
else:
|
|
453
468
|
raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__.__name__, name))
|