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
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# ################################################################################################
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2025 Teradata. All rights reserved.
|
|
4
|
+
# TERADATA CONFIDENTIAL AND TRADE SECRET
|
|
5
|
+
#
|
|
6
|
+
# Primary Owner: Adithya Avvaru (adithya.avvaru@teradata.com)
|
|
7
|
+
# Secondary Owner: Pankaj Purandare (pankajvinod.purandare@teradata.com)
|
|
8
|
+
#
|
|
9
|
+
# Version: 1.0
|
|
10
|
+
# ModelOps SDK Version: 1.0
|
|
11
|
+
#
|
|
12
|
+
# This file contains the code for spinner which spins during the SDK execution time.
|
|
13
|
+
# NOTE: This is taken from AoA SDK and will be updated/removed in future.
|
|
14
|
+
#
|
|
15
|
+
# ################################################################################################
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
19
|
+
import threading
|
|
20
|
+
|
|
21
|
+
os.system("") # enables ansi escape characters in terminal
|
|
22
|
+
|
|
23
|
+
CODE = {
|
|
24
|
+
"CYAN": "\033[36m",
|
|
25
|
+
"END": "\033[0m",
|
|
26
|
+
"RM_LINE": "\033[2K\r",
|
|
27
|
+
"HIDE_CURSOR": "\033[?25l",
|
|
28
|
+
"SHOW_CURSOR": "\033[?25h",
|
|
29
|
+
"CURSOR_NEXT_LINE": "\033[1E",
|
|
30
|
+
"CURSOR_INIT": "\033[0G",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ProgressBase(threading.Thread):
|
|
35
|
+
inplace = None
|
|
36
|
+
stopFlag = None
|
|
37
|
+
|
|
38
|
+
def __init__(self):
|
|
39
|
+
self.rlock = threading.RLock()
|
|
40
|
+
self.cv = threading.Condition()
|
|
41
|
+
threading.Thread.__init__(self)
|
|
42
|
+
self.setDaemon(True)
|
|
43
|
+
|
|
44
|
+
def __call__(self):
|
|
45
|
+
self.start()
|
|
46
|
+
|
|
47
|
+
def back_step(self):
|
|
48
|
+
if self.inplace:
|
|
49
|
+
sys_print(CODE["CURSOR_NEXT_LINE"])
|
|
50
|
+
|
|
51
|
+
def remove_line(self):
|
|
52
|
+
if self.inplace:
|
|
53
|
+
sys_print(CODE["RM_LINE"])
|
|
54
|
+
|
|
55
|
+
def start(self):
|
|
56
|
+
self.stopFlag = 0
|
|
57
|
+
threading.Thread.start(self)
|
|
58
|
+
|
|
59
|
+
def stop(self):
|
|
60
|
+
self.stopFlag = 1
|
|
61
|
+
sys_print(CODE["SHOW_CURSOR"])
|
|
62
|
+
self.cv.acquire()
|
|
63
|
+
self.cv.notify()
|
|
64
|
+
self.cv.release()
|
|
65
|
+
self.rlock.acquire()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class Spinner(ProgressBase):
|
|
69
|
+
|
|
70
|
+
def __init__(self, msg="", speed=0.1):
|
|
71
|
+
self.__seq = ["⣾", "⣷", "⣯", "⣟", "⡿", "⢿", "⣻", "⣽"]
|
|
72
|
+
self.__speed = speed
|
|
73
|
+
self.__msg = msg
|
|
74
|
+
self.inplace = 1
|
|
75
|
+
ProgressBase.__init__(self)
|
|
76
|
+
|
|
77
|
+
def run(self):
|
|
78
|
+
self.rlock.acquire()
|
|
79
|
+
self.cv.acquire()
|
|
80
|
+
sys_print(CODE["HIDE_CURSOR"])
|
|
81
|
+
while 1:
|
|
82
|
+
for char in self.__seq:
|
|
83
|
+
self.cv.wait(self.__speed)
|
|
84
|
+
if self.stopFlag:
|
|
85
|
+
self.back_step()
|
|
86
|
+
try:
|
|
87
|
+
return
|
|
88
|
+
finally:
|
|
89
|
+
self.rlock.release()
|
|
90
|
+
if self.inplace:
|
|
91
|
+
sys_print(
|
|
92
|
+
f"{CODE['CYAN']}{char}{CODE['END']} {self.__msg}{CODE['CURSOR_INIT']}"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def sys_print(msg):
|
|
97
|
+
sys.stdout.write(msg)
|
|
98
|
+
sys.stdout.flush()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def spin_it(function, msg, speed=0.25, *args, **kwargs):
|
|
102
|
+
indicator = Spinner(msg, speed)
|
|
103
|
+
indicator.start()
|
|
104
|
+
result = function(*args, **kwargs)
|
|
105
|
+
indicator.stop()
|
|
106
|
+
indicator.remove_line()
|
|
107
|
+
return result
|
teradataml/store/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
|
|
|
5
5
|
Primary Owner: pradeep.garre@teradata.com
|
|
6
6
|
Secondary Owner: aanchal.kavedia@teradata.com
|
|
7
7
|
|
|
8
|
-
This file imports components from Feature Store
|
|
8
|
+
This file imports components from Feature Store.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
from teradataml.store.feature_store.feature_store import FeatureStore
|
|
@@ -51,7 +51,8 @@ class Apply(TableOperator):
|
|
|
51
51
|
data_order_column=None,
|
|
52
52
|
is_local_order=False,
|
|
53
53
|
sort_ascending=True,
|
|
54
|
-
nulls_first=True
|
|
54
|
+
nulls_first=True,
|
|
55
|
+
**kwargs):
|
|
55
56
|
"""
|
|
56
57
|
DESCRIPTION:
|
|
57
58
|
The fastpath Apply table operator executes a user-installed script or
|
|
@@ -343,6 +344,20 @@ class Apply(TableOperator):
|
|
|
343
344
|
self.style = style
|
|
344
345
|
self.returns = returns
|
|
345
346
|
|
|
347
|
+
# Internal variable to check if validation is required for Python and python package versions mismatch.
|
|
348
|
+
_validation_required = kwargs.pop('_validate_version', False)
|
|
349
|
+
# Interval variable to store the function name for which validation is required.
|
|
350
|
+
_func_name = kwargs.pop('_func_name', None)
|
|
351
|
+
# Internal variable to store the list of packages required for the function.
|
|
352
|
+
_packages = kwargs.pop('_packages', None)
|
|
353
|
+
|
|
354
|
+
# Check if validation for Python and python package versions mismatch is required.
|
|
355
|
+
if _validation_required:
|
|
356
|
+
# Check if the Python interpreter major versions are consistent between Vantage and local.
|
|
357
|
+
UtilFuncs._check_python_version_diff(self.env_name)
|
|
358
|
+
# Check if the package versions are consistent between Vantage and local.
|
|
359
|
+
UtilFuncs._check_package_version_diff(_func_name, _packages, self.env_name)
|
|
360
|
+
|
|
346
361
|
|
|
347
362
|
@property
|
|
348
363
|
def env(self):
|
|
@@ -67,7 +67,8 @@ class Script(TableOperator):
|
|
|
67
67
|
data_order_column=None,
|
|
68
68
|
is_local_order=False,
|
|
69
69
|
sort_ascending=True,
|
|
70
|
-
nulls_first=True
|
|
70
|
+
nulls_first=True,
|
|
71
|
+
**kwargs):
|
|
71
72
|
"""
|
|
72
73
|
DESCRIPTION:
|
|
73
74
|
The Script table operator function executes a user-installed script or
|
|
@@ -354,6 +355,24 @@ class Script(TableOperator):
|
|
|
354
355
|
# Perform the function validations
|
|
355
356
|
self.__validate()
|
|
356
357
|
|
|
358
|
+
# Add the prefix OPENBLAS_NUM_THREADS to the script command.
|
|
359
|
+
self.script_command = f"{TableOperatorConstants.OPENBLAS_NUM_THREADS.value} {self.script_command}"
|
|
360
|
+
|
|
361
|
+
# Internal variable to check if validation is required for Python and python package versions mismatch.
|
|
362
|
+
_validation_required = kwargs.pop('_validate_version', False)
|
|
363
|
+
# Interval variable to store the function name for which validation is required.
|
|
364
|
+
_func_name = kwargs.pop('_func_name', None)
|
|
365
|
+
# Internal variable to store the list of packages required for the function.
|
|
366
|
+
_packages = kwargs.pop('_packages', None)
|
|
367
|
+
|
|
368
|
+
# Check if validation for Python and python package versions mismatch is required.
|
|
369
|
+
if _validation_required:
|
|
370
|
+
# Check if the Python interpreter major versions are consistent between Vantage and local.
|
|
371
|
+
UtilFuncs._check_python_version_diff()
|
|
372
|
+
# Check if the package versions are consistent between Vantage and local.
|
|
373
|
+
UtilFuncs._check_package_version_diff(_func_name, _packages)
|
|
374
|
+
|
|
375
|
+
|
|
357
376
|
@property
|
|
358
377
|
def skip_argument_validation(self):
|
|
359
378
|
"""
|
|
@@ -484,27 +484,10 @@ class QueryGenerator:
|
|
|
484
484
|
# If Table Operator function is IMAGE2MATRIX, then return alias name as TD_IMAGE2MATRIX.
|
|
485
485
|
elif "IMAGE2MATRIX".lower() == function_name.lower():
|
|
486
486
|
return "TD_IMAGE2MATRIX"
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
function_mappings = _get_function_mappings()
|
|
492
|
-
|
|
493
|
-
try:
|
|
494
|
-
return function_mappings[configure.vantage_version][engine_name][function_name.lower()]
|
|
495
|
-
except KeyError as ke:
|
|
496
|
-
if str(ke) == "'{}'".format(function_name.lower()):
|
|
497
|
-
raise TeradataMlException(Messages.get_message(
|
|
498
|
-
MessageCodes.FUNCTION_NOT_SUPPORTED).format(configure.vantage_version),
|
|
499
|
-
MessageCodes.FUNCTION_NOT_SUPPORTED) from ke
|
|
500
|
-
else:
|
|
501
|
-
raise
|
|
502
|
-
except TeradataMlException:
|
|
503
|
-
raise
|
|
504
|
-
except Exception as err:
|
|
505
|
-
raise TeradataMlException(Messages.get_message(
|
|
506
|
-
MessageCodes.CONFIG_ALIAS_ANLY_FUNC_NOT_FOUND).format(function_name, config_folder),
|
|
507
|
-
MessageCodes.CONFIG_ALIAS_ANLY_FUNC_NOT_FOUND) from err
|
|
487
|
+
elif "Script".lower() == function_name.lower():
|
|
488
|
+
return "Script"
|
|
489
|
+
elif "Apply".lower() == function_name.lower():
|
|
490
|
+
return "Apply"
|
|
508
491
|
|
|
509
492
|
def _get_string_size(self, string):
|
|
510
493
|
return len(string.encode("utf8"))
|
|
@@ -249,6 +249,9 @@ class _TableOperatorUtils:
|
|
|
249
249
|
self.data_partition_column = data_partition_column
|
|
250
250
|
self.data_hash_column = data_hash_column
|
|
251
251
|
self.__env = None
|
|
252
|
+
self.debug = kwargs.pop('debug', False)
|
|
253
|
+
self._validate_version = False
|
|
254
|
+
self.packages = []
|
|
252
255
|
# Add all entries from kwargs as class attributes.
|
|
253
256
|
self.__dict__.update(kwargs)
|
|
254
257
|
|
|
@@ -464,7 +467,10 @@ class _TableOperatorUtils:
|
|
|
464
467
|
# Remove local copy of file to free up the disk space immediately.
|
|
465
468
|
# Garbage collection will take care of it as a failsafe.
|
|
466
469
|
# We may end up here after the script was created, but even before executing it.
|
|
467
|
-
|
|
470
|
+
if not self.debug:
|
|
471
|
+
GarbageCollector._delete_local_file(self.script_path)
|
|
472
|
+
elif not self.__dict__.get('is_printed', False):
|
|
473
|
+
self._print_script_path()
|
|
468
474
|
|
|
469
475
|
def __get_script_name(self):
|
|
470
476
|
"""
|
|
@@ -486,7 +492,7 @@ class _TableOperatorUtils:
|
|
|
486
492
|
script_entry, script_alias, script_name, script_base_name = self.__get_script_name()
|
|
487
493
|
"""
|
|
488
494
|
script_entry = UtilFuncs._generate_temp_script_name(prefix="" if self.operation is None else self.operation,
|
|
489
|
-
extension="py")
|
|
495
|
+
extension="py", gc_on_quit=(self.debug^True))
|
|
490
496
|
# script_alias is the file ID.
|
|
491
497
|
script_alias = UtilFuncs._teradata_unquote_arg(UtilFuncs._extract_table_name(script_entry), quote='"')
|
|
492
498
|
|
|
@@ -530,6 +536,12 @@ class _TableOperatorUtils:
|
|
|
530
536
|
# User can provide the installation location of previous version in case they are not using the latest.
|
|
531
537
|
# This fix is done for ELE-5958 - https://teradata-pe.atlassian.net/browse/ELE-5958
|
|
532
538
|
|
|
539
|
+
# If operation is map_row or map_partition, then it should validate the python and
|
|
540
|
+
# 'dill' package version mismatch.
|
|
541
|
+
if self.operation in ["map_row", "map_partition"]:
|
|
542
|
+
self._validate_version = True
|
|
543
|
+
self.packages = ['dill']
|
|
544
|
+
|
|
533
545
|
from teradataml.table_operators.Script import Script
|
|
534
546
|
table_op_obj = Script(data=self.data,
|
|
535
547
|
script_name=self.script_name,
|
|
@@ -546,7 +558,10 @@ class _TableOperatorUtils:
|
|
|
546
558
|
nulls_first=self.nulls_first,
|
|
547
559
|
charset=self.charset,
|
|
548
560
|
data_partition_column=self.data_partition_column,
|
|
549
|
-
data_hash_column=self.data_hash_column
|
|
561
|
+
data_hash_column=self.data_hash_column,
|
|
562
|
+
_validate_version = self._validate_version,
|
|
563
|
+
_func_name = self.operation,
|
|
564
|
+
_packages = self.packages
|
|
550
565
|
)
|
|
551
566
|
table_op_obj.check_reserved_keyword = check_reserved_keyword
|
|
552
567
|
|
|
@@ -588,6 +603,12 @@ class _TableOperatorUtils:
|
|
|
588
603
|
EXAMPLES:
|
|
589
604
|
return_obj = self.__execute_apply_table_operator()
|
|
590
605
|
"""
|
|
606
|
+
|
|
607
|
+
# If operation is apply, then it should validate the python and 'dill' package version mismatch.
|
|
608
|
+
if self.operation == "apply":
|
|
609
|
+
self._validate_version = True
|
|
610
|
+
self.packages = ['dill']
|
|
611
|
+
|
|
591
612
|
# First create Apply Table operator object so that validations are done on inputs.
|
|
592
613
|
from teradataml.table_operators.Apply import Apply
|
|
593
614
|
apply_op_obj = Apply(data=self.data,
|
|
@@ -604,7 +625,10 @@ class _TableOperatorUtils:
|
|
|
604
625
|
nulls_first=self.nulls_first,
|
|
605
626
|
data_partition_column=self.data_partition_column,
|
|
606
627
|
data_hash_column=self.data_hash_column,
|
|
607
|
-
style=self.style
|
|
628
|
+
style=self.style,
|
|
629
|
+
_validate_version=self._validate_version,
|
|
630
|
+
_func_name = self.operation,
|
|
631
|
+
_packages = self.packages
|
|
608
632
|
)
|
|
609
633
|
|
|
610
634
|
# APPLY operator requires installation and deletion of script file.
|
|
@@ -670,8 +694,33 @@ class _TableOperatorUtils:
|
|
|
670
694
|
TableOperatorConstants.MAP_PARTITION_OP.value,
|
|
671
695
|
TableOperatorConstants.APPLY_OP.value,
|
|
672
696
|
TableOperatorConstants.UDF_OP.value]:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
697
|
+
if self.debug:
|
|
698
|
+
self._print_script_path()
|
|
699
|
+
self.is_printed = True
|
|
700
|
+
else:
|
|
701
|
+
GarbageCollector._delete_object_entry(
|
|
702
|
+
object_to_delete=self.script_entry,
|
|
703
|
+
object_type=TeradataConstants.TERADATA_SCRIPT,
|
|
704
|
+
remove_entry_from_gc_list=True
|
|
705
|
+
)
|
|
706
|
+
def _print_script_path(self):
|
|
707
|
+
"""
|
|
708
|
+
DESCRIPTION:
|
|
709
|
+
Internal function to print the path of the script file.
|
|
710
|
+
|
|
711
|
+
PARAMETERS:
|
|
712
|
+
None.
|
|
713
|
+
|
|
714
|
+
RAISES:
|
|
715
|
+
None.
|
|
716
|
+
|
|
717
|
+
RETURNS:
|
|
718
|
+
None.
|
|
719
|
+
"""
|
|
720
|
+
mssg1 = f"Path for the script {self.script_path}"
|
|
721
|
+
mssg2 = "The user should delete the script file since it is not being garbage collected."
|
|
722
|
+
mssg_len = max(len(mssg1), len(mssg2))
|
|
723
|
+
print("-" * mssg_len)
|
|
724
|
+
print(mssg1)
|
|
725
|
+
print(mssg2)
|
|
726
|
+
print("-" * mssg_len)
|
teradataml/utils/dtypes.py
CHANGED
|
@@ -8,6 +8,7 @@ from teradatasqlalchemy import (INTERVAL_YEAR, INTERVAL_YEAR_TO_MONTH, INTERVAL_
|
|
|
8
8
|
INTERVAL_HOUR, INTERVAL_HOUR_TO_MINUTE, INTERVAL_HOUR_TO_SECOND,
|
|
9
9
|
INTERVAL_MINUTE, INTERVAL_MINUTE_TO_SECOND, INTERVAL_SECOND)
|
|
10
10
|
from teradatasqlalchemy import (GEOMETRY, MBB, MBR)
|
|
11
|
+
from teradatasqlalchemy import VECTOR
|
|
11
12
|
from teradataml.common.td_coltype_code_to_tdtype import HELP_COL_TYPE_TO_TDTYPE
|
|
12
13
|
from teradataml.common.constants import TeradataTypes, PythonTypes
|
|
13
14
|
from datetime import datetime, time, date
|
|
@@ -148,7 +149,7 @@ _GET_DATATYPES = {
|
|
|
148
149
|
INTERVAL_DAY_TO_SECOND, INTERVAL_HOUR, INTERVAL_HOUR_TO_MINUTE, INTERVAL_HOUR_TO_SECOND,
|
|
149
150
|
INTERVAL_MINUTE, INTERVAL_MINUTE_TO_SECOND, INTERVAL_MONTH, INTERVAL_SECOND, INTERVAL_YEAR,
|
|
150
151
|
INTERVAL_YEAR_TO_MONTH, PERIOD_DATE, PERIOD_TIME, PERIOD_TIMESTAMP, TIME, TIMESTAMP, VARBYTE,
|
|
151
|
-
VARCHAR, GEOMETRY, MBB, MBR],
|
|
152
|
+
VARCHAR, GEOMETRY, MBB, MBR, VECTOR],
|
|
152
153
|
'NON_NUM_DATE_INTERVAL': [BLOB, BYTE, CHAR, CLOB, PERIOD_DATE, PERIOD_TIME, PERIOD_TIMESTAMP, TIME, TIMESTAMP,
|
|
153
154
|
VARBYTE, VARCHAR, GEOMETRY, MBB, MBR],
|
|
154
155
|
'NON_NUM_INTERVAL': [BLOB, BYTE, CHAR, CLOB, DATE, PERIOD_DATE, PERIOD_TIME, PERIOD_TIMESTAMP, TIME, TIMESTAMP,
|
|
@@ -252,7 +253,8 @@ class _DtypesMappers:
|
|
|
252
253
|
bool: BYTEINT,
|
|
253
254
|
datetime: TIMESTAMP,
|
|
254
255
|
date: DATE,
|
|
255
|
-
time: TIME
|
|
256
|
+
time: TIME,
|
|
257
|
+
bytes: BLOB
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
# Mapper which stores the mapping between TD type specified in in analytic JSON files to Python type.
|
|
@@ -96,7 +96,27 @@ class _InternalBuffer:
|
|
|
96
96
|
None
|
|
97
97
|
|
|
98
98
|
EXAMPLES:
|
|
99
|
-
# Remove
|
|
100
|
-
_InternalBuffer.remove_key("vs_session_id")
|
|
99
|
+
# Remove key "vs_session_id" from _InternalBuffer.
|
|
100
|
+
>>> _InternalBuffer.remove_key("vs_session_id")
|
|
101
101
|
"""
|
|
102
102
|
del cls.__data[key]
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def remove_keys(cls, keys):
|
|
106
|
+
"""
|
|
107
|
+
DESCRIPTION:
|
|
108
|
+
Removes specified keys from the internal buffer.
|
|
109
|
+
|
|
110
|
+
RETURNS:
|
|
111
|
+
None
|
|
112
|
+
|
|
113
|
+
RAISES:
|
|
114
|
+
None
|
|
115
|
+
|
|
116
|
+
EXAMPLES:
|
|
117
|
+
# Remove keys "list_base_envs" and "default_base_env" from _InternalBuffer.
|
|
118
|
+
>>> _InternalBuffer.remove_keys(['list_base_envs', 'default_base_env'])
|
|
119
|
+
"""
|
|
120
|
+
for key in keys:
|
|
121
|
+
if cls.__data.get(key) is not None:
|
|
122
|
+
del cls.__data[key]
|
teradataml/utils/utils.py
CHANGED
|
@@ -85,7 +85,6 @@ def execute_sql(statement, parameters=None):
|
|
|
85
85
|
raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_CONTEXT_CONNECTION),
|
|
86
86
|
MessageCodes.INVALID_CONTEXT_CONNECTION)
|
|
87
87
|
|
|
88
|
-
|
|
89
88
|
class _AsyncDBExecutor:
|
|
90
89
|
"""
|
|
91
90
|
An internal utility to run teradataml API's parallelly by opening
|