teradataml 20.0.0.2__py3-none-any.whl → 20.0.0.4__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 +315 -2
- teradataml/__init__.py +4 -0
- teradataml/_version.py +1 -1
- teradataml/analytics/analytic_function_executor.py +95 -8
- teradataml/analytics/byom/__init__.py +1 -1
- teradataml/analytics/json_parser/metadata.py +12 -3
- teradataml/analytics/json_parser/utils.py +7 -2
- teradataml/analytics/sqle/__init__.py +5 -1
- teradataml/analytics/table_operator/__init__.py +1 -1
- teradataml/analytics/uaf/__init__.py +1 -1
- teradataml/analytics/utils.py +4 -0
- teradataml/analytics/valib.py +18 -4
- teradataml/automl/__init__.py +51 -6
- teradataml/automl/data_preparation.py +59 -35
- teradataml/automl/data_transformation.py +58 -33
- teradataml/automl/feature_engineering.py +27 -12
- teradataml/automl/model_training.py +73 -46
- teradataml/common/constants.py +88 -29
- teradataml/common/garbagecollector.py +2 -1
- teradataml/common/messagecodes.py +19 -3
- teradataml/common/messages.py +6 -1
- teradataml/common/sqlbundle.py +64 -12
- teradataml/common/utils.py +246 -47
- teradataml/common/warnings.py +11 -0
- teradataml/context/context.py +161 -27
- teradataml/data/amazon_reviews_25.csv +26 -0
- teradataml/data/byom_example.json +11 -0
- teradataml/data/dataframe_example.json +18 -2
- teradataml/data/docs/byom/docs/DataRobotPredict.py +2 -2
- teradataml/data/docs/byom/docs/DataikuPredict.py +40 -1
- teradataml/data/docs/byom/docs/H2OPredict.py +2 -2
- teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
- teradataml/data/docs/byom/docs/ONNXPredict.py +2 -2
- teradataml/data/docs/byom/docs/PMMLPredict.py +2 -2
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +1 -1
- teradataml/data/docs/sqle/docs_17_20/Shap.py +34 -6
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +4 -4
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +3 -3
- teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
- teradataml/data/docs/uaf/docs_17_20/CopyArt.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +4 -1
- teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +18 -21
- teradataml/data/hnsw_alter_data.csv +5 -0
- teradataml/data/hnsw_data.csv +10 -0
- teradataml/data/jsons/byom/h2opredict.json +1 -1
- teradataml/data/jsons/byom/onnxembeddings.json +266 -0
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +0 -1
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +1 -1
- teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
- teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -0
- teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +10 -19
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +3 -1
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +15 -5
- teradataml/data/medical_readings.csv +101 -0
- teradataml/data/patient_profile.csv +101 -0
- teradataml/data/scripts/lightgbm/dataset.template +157 -0
- teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +247 -0
- teradataml/data/scripts/lightgbm/lightgbm_function.template +216 -0
- teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +159 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +194 -167
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +136 -115
- teradataml/data/scripts/sklearn/sklearn_function.template +14 -19
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +155 -137
- teradataml/data/scripts/sklearn/sklearn_transform.py +129 -42
- teradataml/data/target_udt_data.csv +8 -0
- teradataml/data/templates/open_source_ml.json +3 -2
- teradataml/data/teradataml_example.json +8 -0
- teradataml/data/vectordistance_example.json +4 -0
- teradataml/dataframe/copy_to.py +8 -3
- teradataml/dataframe/data_transfer.py +11 -1
- teradataml/dataframe/dataframe.py +1049 -285
- teradataml/dataframe/dataframe_utils.py +152 -20
- teradataml/dataframe/functions.py +578 -35
- teradataml/dataframe/setop.py +11 -6
- teradataml/dataframe/sql.py +185 -16
- teradataml/dbutils/dbutils.py +1049 -115
- teradataml/dbutils/filemgr.py +48 -1
- teradataml/hyperparameter_tuner/optimizer.py +12 -1
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/__init__.py +1 -1
- teradataml/opensource/_base.py +1466 -0
- teradataml/opensource/_class.py +464 -0
- teradataml/opensource/{sklearn/constants.py → _constants.py} +21 -14
- teradataml/opensource/_lightgbm.py +949 -0
- teradataml/opensource/_sklearn.py +1008 -0
- teradataml/opensource/{sklearn/_wrapper_utils.py → _wrapper_utils.py} +5 -6
- teradataml/options/__init__.py +54 -38
- teradataml/options/configure.py +131 -27
- teradataml/options/display.py +13 -2
- teradataml/plot/axis.py +47 -8
- teradataml/plot/figure.py +33 -0
- teradataml/plot/plot.py +63 -13
- teradataml/scriptmgmt/UserEnv.py +5 -5
- teradataml/scriptmgmt/lls_utils.py +130 -40
- teradataml/store/__init__.py +12 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +291 -0
- teradataml/store/feature_store/feature_store.py +2318 -0
- teradataml/store/feature_store/models.py +1505 -0
- teradataml/table_operators/Apply.py +32 -18
- teradataml/table_operators/Script.py +3 -1
- teradataml/table_operators/TableOperator.py +3 -1
- teradataml/table_operators/query_generator.py +3 -0
- teradataml/table_operators/table_operator_query_generator.py +3 -1
- teradataml/table_operators/table_operator_util.py +37 -38
- teradataml/table_operators/templates/dataframe_register.template +69 -0
- teradataml/utils/dtypes.py +51 -2
- teradataml/utils/internal_buffer.py +18 -0
- teradataml/utils/validators.py +99 -8
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/METADATA +321 -5
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/RECORD +121 -94
- teradataml/libaed_0_1.dylib +0 -0
- teradataml/libaed_0_1.so +0 -0
- teradataml/opensource/sklearn/__init__.py +0 -1
- teradataml/opensource/sklearn/_class.py +0 -255
- teradataml/opensource/sklearn/_sklearn_wrapper.py +0 -1800
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/zip-safe +0 -0
|
@@ -13,20 +13,19 @@
|
|
|
13
13
|
#
|
|
14
14
|
# ##################################################################
|
|
15
15
|
|
|
16
|
-
import time
|
|
17
16
|
import functools
|
|
17
|
+
import time
|
|
18
18
|
import uuid
|
|
19
|
-
|
|
20
19
|
from math import floor
|
|
20
|
+
|
|
21
21
|
from teradataml import TeradataMlException
|
|
22
|
+
from teradataml.common.aed_utils import AedUtils
|
|
22
23
|
from teradataml.common.messagecodes import MessageCodes
|
|
23
24
|
from teradataml.common.messages import Messages
|
|
24
|
-
from teradataml.common.aed_utils import AedUtils
|
|
25
|
-
from teradataml.dataframe.dataframe_utils import DataFrameUtils
|
|
26
|
-
from teradataml.dataframe.dataframe import DataFrame, in_schema
|
|
27
25
|
from teradataml.common.utils import UtilFuncs
|
|
26
|
+
from teradataml.dataframe.dataframe import DataFrame
|
|
27
|
+
from teradataml.dataframe.dataframe_utils import DataFrameUtils
|
|
28
28
|
from teradataml.utils.validators import _Validators
|
|
29
|
-
from teradataml.dataframe.sql_interfaces import ColumnExpression
|
|
30
29
|
|
|
31
30
|
aed_utils = AedUtils()
|
|
32
31
|
df_utils = DataFrameUtils()
|
teradataml/options/__init__.py
CHANGED
|
@@ -7,7 +7,6 @@ from teradataml.utils.internal_buffer import _InternalBuffer
|
|
|
7
7
|
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
@argument_deprecation("future", ["auth_token", "ues_url"], False, None)
|
|
11
10
|
@collect_queryband(queryband="StCnfgPrms")
|
|
12
11
|
def set_config_params(**kwargs):
|
|
13
12
|
"""
|
|
@@ -20,21 +19,6 @@ def set_config_params(**kwargs):
|
|
|
20
19
|
Optional Argument.
|
|
21
20
|
Specifies keyword arguments. Accepts following keyword arguments:
|
|
22
21
|
|
|
23
|
-
auth_token:
|
|
24
|
-
Optional Parameter.
|
|
25
|
-
Specifies the authentication token to connect to VantageCloud Lake.
|
|
26
|
-
Notes:
|
|
27
|
-
* Authentication token will expire after a specific time.
|
|
28
|
-
One can get the new authentication token and set it again.
|
|
29
|
-
* if "auth_token" is set through this function, then this function
|
|
30
|
-
should always be used only after create_context.
|
|
31
|
-
Types: str
|
|
32
|
-
|
|
33
|
-
ues_url:
|
|
34
|
-
Optional Parameter.
|
|
35
|
-
Specifies the URL for User Environment Service in VantageCloud Lake.
|
|
36
|
-
Types: str
|
|
37
|
-
|
|
38
22
|
certificate_file:
|
|
39
23
|
Optional Parameter.
|
|
40
24
|
Specifies the path of the certificate file, which is used in
|
|
@@ -42,36 +26,42 @@ def set_config_params(**kwargs):
|
|
|
42
26
|
Types: str
|
|
43
27
|
|
|
44
28
|
default_varchar_size:
|
|
45
|
-
|
|
46
|
-
Specifies the size of varchar datatype in Vantage, the default
|
|
29
|
+
Specifies the size of varchar datatype in Teradata Vantage, the default
|
|
47
30
|
size is 1024.
|
|
31
|
+
User can configure this parameter using options.
|
|
48
32
|
Types: int
|
|
49
33
|
|
|
50
34
|
vantage_version:
|
|
51
|
-
Specifies the Vantage version teradataml is connected to.
|
|
52
|
-
Types:
|
|
35
|
+
Specifies the Vantage version of the system teradataml is connected to.
|
|
36
|
+
Types: string
|
|
53
37
|
|
|
54
38
|
val_install_location:
|
|
55
|
-
Specifies the database
|
|
39
|
+
Specifies the name of the database where Vantage Analytic Library functions
|
|
56
40
|
are installed.
|
|
57
|
-
Types:
|
|
41
|
+
Types: string
|
|
58
42
|
|
|
59
43
|
byom_install_location:
|
|
60
|
-
Specifies the database
|
|
44
|
+
Specifies the name of the database where Bring Your Own Model functions
|
|
61
45
|
are installed.
|
|
62
|
-
Types:
|
|
46
|
+
Types: string
|
|
63
47
|
|
|
64
48
|
database_version:
|
|
65
|
-
Specifies the database version of the system teradataml is connected to.
|
|
66
|
-
Types:
|
|
49
|
+
Specifies the actual database version of the system teradataml is connected to.
|
|
50
|
+
Types: string
|
|
67
51
|
|
|
68
52
|
read_nos_function_mapping:
|
|
69
|
-
Specifies the mapping
|
|
70
|
-
Types:
|
|
53
|
+
Specifies the function mapping name for the read_nos table operator function.
|
|
54
|
+
Types: string
|
|
71
55
|
|
|
72
56
|
write_nos_function_mapping:
|
|
73
|
-
Specifies the mapping
|
|
74
|
-
Types:
|
|
57
|
+
Specifies the function mapping name for the write_nos table operator function.
|
|
58
|
+
Types: string
|
|
59
|
+
|
|
60
|
+
inline_plot:
|
|
61
|
+
Specifies whether to display the plot inline or not.
|
|
62
|
+
Note:
|
|
63
|
+
Not applicable for machines running Linux and Mac OS.
|
|
64
|
+
Types: bool
|
|
75
65
|
|
|
76
66
|
indb_install_location:
|
|
77
67
|
Specifies the installation location of In-DB Python package.
|
|
@@ -82,9 +72,35 @@ def set_config_params(**kwargs):
|
|
|
82
72
|
Older versions of In-DB packages are installed at
|
|
83
73
|
"/opt/teradata/languages/Python/".
|
|
84
74
|
|
|
75
|
+
openml_user_env:
|
|
76
|
+
Specifies the user environment to be used for OpenML.
|
|
77
|
+
Types: UserEnv
|
|
78
|
+
|
|
85
79
|
local_storage:
|
|
86
80
|
Specifies the location on client where garbage collector folder will be created.
|
|
87
|
-
Types:
|
|
81
|
+
Types: string
|
|
82
|
+
|
|
83
|
+
stored_procedure_install_location:
|
|
84
|
+
Specifies the name of the database where stored procedures
|
|
85
|
+
are installed.
|
|
86
|
+
Types: string
|
|
87
|
+
|
|
88
|
+
table_operator:
|
|
89
|
+
Specifies the name of the table operator.
|
|
90
|
+
Permitted Values: "Apply", "Script"
|
|
91
|
+
Types: string
|
|
92
|
+
|
|
93
|
+
temp_object_type:
|
|
94
|
+
Specifies the type of temporary database objects created internally by teradataml.
|
|
95
|
+
Permitted Values:
|
|
96
|
+
* "VT" - Volatile tables.
|
|
97
|
+
Types: String
|
|
98
|
+
Default Value: None
|
|
99
|
+
Note:
|
|
100
|
+
* If this option is set to "VT" and "persist" argument of analytic functions is
|
|
101
|
+
set to True, then volatile tables are not created as volatile table can't be
|
|
102
|
+
persisted and "persist" argument takes precedence.
|
|
103
|
+
* Default behavior is to create views that will be garbage collected at the end.
|
|
88
104
|
|
|
89
105
|
RETURNS:
|
|
90
106
|
bool
|
|
@@ -95,9 +111,7 @@ def set_config_params(**kwargs):
|
|
|
95
111
|
EXAMPLES:
|
|
96
112
|
# Example 1: Set configuration params using set_config_params() function.
|
|
97
113
|
>>> from teradataml import set_config_params
|
|
98
|
-
>>> set_config_params(
|
|
99
|
-
... ues_url="https://teracloud/v1/accounts/xyz-234-76085/open-analytics",
|
|
100
|
-
... certificate_file="cert.crt",
|
|
114
|
+
>>> set_config_params(certificate_file="cert.crt",
|
|
101
115
|
... default_varchar_size=512,
|
|
102
116
|
... val_install_location="VAL_USER",
|
|
103
117
|
... read_nos_function_mapping="read_nos_fm",
|
|
@@ -109,7 +123,6 @@ def set_config_params(**kwargs):
|
|
|
109
123
|
# Example 2: Alternatively, set configuration parameters without using set_config_params() function.
|
|
110
124
|
# To do so, we will use configure module.
|
|
111
125
|
>>> from teradataml import configure
|
|
112
|
-
>>> configure.ues_url="https://teracloud/v1/accounts/xyz-234-76085/open-analytics"
|
|
113
126
|
>>> configure.certificate_file="cert.crt"
|
|
114
127
|
>>> configure.default_varchar_size=512
|
|
115
128
|
>>> configure.val_install_location="VAL_USER"
|
|
@@ -120,9 +133,12 @@ def set_config_params(**kwargs):
|
|
|
120
133
|
"""
|
|
121
134
|
for option in kwargs:
|
|
122
135
|
try:
|
|
123
|
-
if option == "auth_token":
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
if option == "auth_token" or option == 'ues_url':
|
|
137
|
+
raise TeradataMlException(Messages.get_message(
|
|
138
|
+
MessageCodes.FUNC_EXECUTION_FAILED, 'set_config_params',
|
|
139
|
+
'Setting of parameter \'{}\' is prohibited from set_config_params(). '
|
|
140
|
+
'Use set_auth_token() to set parameter.'.format(option)),
|
|
141
|
+
MessageCodes.FUNC_EXECUTION_FAILED)
|
|
126
142
|
else:
|
|
127
143
|
setattr(configure, option, kwargs[option])
|
|
128
144
|
except AttributeError as e:
|
teradataml/options/configure.py
CHANGED
|
@@ -13,6 +13,7 @@ from teradataml.common.exceptions import TeradataMlException
|
|
|
13
13
|
from teradataml.common.messages import Messages
|
|
14
14
|
from teradataml.common.messagecodes import MessageCodes
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
class _ConfigureSuper(object):
|
|
17
18
|
|
|
18
19
|
def __init__(self):
|
|
@@ -59,15 +60,18 @@ class _Configure(_ConfigureSuper):
|
|
|
59
60
|
openml_user_env = _create_property('openml_user_env')
|
|
60
61
|
local_storage = _create_property('local_storage')
|
|
61
62
|
stored_procedure_install_location = _create_property('stored_procedure_install_location')
|
|
63
|
+
table_operator = _create_property('table_operator')
|
|
64
|
+
temp_object_type = _create_property('temp_object_type')
|
|
62
65
|
|
|
63
|
-
def __init__(self, default_varchar_size=1024, column_casesensitive_handler
|
|
66
|
+
def __init__(self, default_varchar_size=1024, column_casesensitive_handler=False,
|
|
64
67
|
vantage_version="vantage1.1", val_install_location=None,
|
|
65
68
|
byom_install_location=None, temp_table_database=None,
|
|
66
69
|
temp_view_database=None, database_version=None,
|
|
67
70
|
read_nos_function_mapping="read_nos", write_nos_function_mapping="write_nos",
|
|
68
|
-
cran_repositories=None, inline_plot=True,
|
|
69
|
-
indb_install_location=
|
|
70
|
-
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB"
|
|
71
|
+
cran_repositories=None, inline_plot=True,
|
|
72
|
+
indb_install_location=None,
|
|
73
|
+
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB",
|
|
74
|
+
table_operator=None, temp_object_type=None):
|
|
71
75
|
|
|
72
76
|
"""
|
|
73
77
|
PARAMETERS:
|
|
@@ -79,17 +83,6 @@ class _Configure(_ConfigureSuper):
|
|
|
79
83
|
Example:
|
|
80
84
|
teradataml.options.configure.default_varchar_size = 512
|
|
81
85
|
|
|
82
|
-
column_casesensitive_handler:
|
|
83
|
-
Specifies a boolean value that sets the value of this option to True or
|
|
84
|
-
False.
|
|
85
|
-
One should set this to True, when ML Engine connector property is
|
|
86
|
-
CASE-SENSITIVE, else set to False, which is CASE-INSENSITIVE.
|
|
87
|
-
Types: bool
|
|
88
|
-
Example:
|
|
89
|
-
# When ML Engine connector property is CASE-SENSITIVE, set this
|
|
90
|
-
# parameter to True.
|
|
91
|
-
teradataml.options.configure.column_casesensitive_handler = True
|
|
92
|
-
|
|
93
86
|
vantage_version:
|
|
94
87
|
Specifies the Vantage version of the system teradataml is connected to.
|
|
95
88
|
Types: string
|
|
@@ -139,7 +132,7 @@ class _Configure(_ConfigureSuper):
|
|
|
139
132
|
inline_plot:
|
|
140
133
|
Specifies whether to display the plot inline or not.
|
|
141
134
|
Note:
|
|
142
|
-
Not applicable for machines running
|
|
135
|
+
Not applicable for machines running Linux and Mac OS.
|
|
143
136
|
Types: bool
|
|
144
137
|
Example:
|
|
145
138
|
# Set the option to display plot in a separate window.
|
|
@@ -149,10 +142,6 @@ class _Configure(_ConfigureSuper):
|
|
|
149
142
|
Specifies the installation location of In-DB Python package.
|
|
150
143
|
Types: string
|
|
151
144
|
Default Value: "/var/opt/teradata/languages/sles12sp3/Python/"
|
|
152
|
-
Note:
|
|
153
|
-
The default value is the installation location of In-DB 2.0.0 packages.
|
|
154
|
-
Older versions of In-DB packages are installed at
|
|
155
|
-
"/opt/teradata/languages/Python/".
|
|
156
145
|
Example:
|
|
157
146
|
# Set the installation location for older versions.
|
|
158
147
|
teradataml.options.configure.indb_install_location = "/opt/teradata/languages/Python/"
|
|
@@ -181,6 +170,29 @@ class _Configure(_ConfigureSuper):
|
|
|
181
170
|
# when stored procedures are installed in 'SYSLIB'.
|
|
182
171
|
teradataml.options.configure.stored_procedure_install_location = "SYSLIB"
|
|
183
172
|
|
|
173
|
+
table_operator:
|
|
174
|
+
Specifies the name of the table operator.
|
|
175
|
+
Permitted Values: "Apply", "Script"
|
|
176
|
+
Types: string
|
|
177
|
+
Example:
|
|
178
|
+
# Set the table operator name to "Script"
|
|
179
|
+
teradataml.options.configure.table_operator = "Script"
|
|
180
|
+
|
|
181
|
+
temp_object_type:
|
|
182
|
+
Specifies the type of temporary database objects created internally by teradataml.
|
|
183
|
+
Permitted Values:
|
|
184
|
+
* "VT" - Volatile tables.
|
|
185
|
+
Types: String
|
|
186
|
+
Default Value: None
|
|
187
|
+
Note:
|
|
188
|
+
* If this option is set to "VT" and "persist" argument of analytic functions is
|
|
189
|
+
set to True, then volatile tables are not created as volatile table can't be
|
|
190
|
+
persisted and "persist" argument takes precedence.
|
|
191
|
+
* Default behavior is to create views that will be garbage collected at the end.
|
|
192
|
+
Example:
|
|
193
|
+
# Set the type of temporary database objects to "VT" to create volatile internal
|
|
194
|
+
# tables.
|
|
195
|
+
teradataml.options.configure.temp_object_type = "VT"
|
|
184
196
|
"""
|
|
185
197
|
super().__init__()
|
|
186
198
|
super().__setattr__('default_varchar_size', default_varchar_size)
|
|
@@ -195,10 +207,12 @@ class _Configure(_ConfigureSuper):
|
|
|
195
207
|
super().__setattr__('write_nos_function_mapping', write_nos_function_mapping)
|
|
196
208
|
super().__setattr__('cran_repositories', cran_repositories)
|
|
197
209
|
super().__setattr__('inline_plot', True)
|
|
198
|
-
super().__setattr__('indb_install_location', indb_install_location)
|
|
199
210
|
super().__setattr__('openml_user_env', openml_user_env)
|
|
200
211
|
super().__setattr__('local_storage', local_storage)
|
|
201
212
|
super().__setattr__('stored_procedure_install_location', stored_procedure_install_location)
|
|
213
|
+
super().__setattr__('table_operator', table_operator)
|
|
214
|
+
super().__setattr__('_indb_install_location', indb_install_location)
|
|
215
|
+
super().__setattr__('temp_object_type', self.__get_temp_object_type(temp_object_type))
|
|
202
216
|
|
|
203
217
|
# internal configurations
|
|
204
218
|
# These configurations are internal and should not be
|
|
@@ -228,6 +242,11 @@ class _Configure(_ConfigureSuper):
|
|
|
228
242
|
# Internal parameter, that is used for specifying the URL to be used as
|
|
229
243
|
# base URL in UES REST calls
|
|
230
244
|
super().__setattr__('ues_url', None)
|
|
245
|
+
# base URL in Vector Store REST calls
|
|
246
|
+
super().__setattr__('_vector_store_base_url', None)
|
|
247
|
+
# Whether tenant is CCP enabled or not.
|
|
248
|
+
# By default, it is set to False, as it can be Enterprise or NON-CCP.
|
|
249
|
+
super().__setattr__('_ccp_enabled', False)
|
|
231
250
|
# Internal parameter, that is used to specify the certificate file in a secured HTTP request.
|
|
232
251
|
super().__setattr__('certificate_file', False)
|
|
233
252
|
# Internal parameter, that is used for specify the maximum size of the file
|
|
@@ -248,6 +267,46 @@ class _Configure(_ConfigureSuper):
|
|
|
248
267
|
# Internal parameter, that is used for specifying the database username associated with current connection.
|
|
249
268
|
super().__setattr__('_database_username', None)
|
|
250
269
|
|
|
270
|
+
@property
|
|
271
|
+
def indb_install_location(self):
|
|
272
|
+
"""
|
|
273
|
+
DESCRIPTION:
|
|
274
|
+
Specifies the installation location of In-DB Python package.
|
|
275
|
+
|
|
276
|
+
RAISES:
|
|
277
|
+
Operational Error.
|
|
278
|
+
"""
|
|
279
|
+
if self._indb_install_location:
|
|
280
|
+
return self._indb_install_location
|
|
281
|
+
from teradataml.context.context import get_context
|
|
282
|
+
if get_context():
|
|
283
|
+
from teradataml.common.constants import TableOperatorConstants
|
|
284
|
+
from teradataml.utils.utils import execute_sql
|
|
285
|
+
_path = execute_sql(TableOperatorConstants.INDB_PYTHON_PATH.value).fetchall()[0][0]
|
|
286
|
+
if 'sles:12:sp3' in _path:
|
|
287
|
+
self._indb_install_location = '/var/opt/teradata/languages/sles12sp3/Python/'
|
|
288
|
+
elif 'sles:15:sp4' in _path:
|
|
289
|
+
self._indb_install_location = '/var/opt/teradata/languages/sles15sp4/Python/'
|
|
290
|
+
else:
|
|
291
|
+
self._indb_install_location = '/opt/teradata/languages/Python/'
|
|
292
|
+
return self._indb_install_location
|
|
293
|
+
else:
|
|
294
|
+
return '/var/opt/teradata/languages/sles12sp3/Python/'
|
|
295
|
+
|
|
296
|
+
@indb_install_location.setter
|
|
297
|
+
def indb_install_location(self, value):
|
|
298
|
+
"""
|
|
299
|
+
DESCRIPTION:
|
|
300
|
+
Sets the value to "indb_install_location" by user.
|
|
301
|
+
|
|
302
|
+
PARAMETERS:
|
|
303
|
+
value:
|
|
304
|
+
Required Argument.
|
|
305
|
+
Specifies the value assigned to "indb_install_location".
|
|
306
|
+
Types: str
|
|
307
|
+
"""
|
|
308
|
+
self._indb_install_location = value
|
|
309
|
+
|
|
251
310
|
def __setattr__(self, name, value):
|
|
252
311
|
if hasattr(self, name):
|
|
253
312
|
if name == 'default_varchar_size':
|
|
@@ -260,7 +319,9 @@ class _Configure(_ConfigureSuper):
|
|
|
260
319
|
"greater than"),
|
|
261
320
|
MessageCodes.TDMLDF_POSITIVE_INT)
|
|
262
321
|
elif name == '_ues_max_file_upload_size':
|
|
263
|
-
|
|
322
|
+
# If the value is bool, isinstance(value, int) returns True
|
|
323
|
+
# which is wrong, hence added the condition on bool.
|
|
324
|
+
if isinstance(value, bool) or not isinstance(value, int):
|
|
264
325
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
265
326
|
'int'),
|
|
266
327
|
MessageCodes.UNSUPPORTED_DATATYPE)
|
|
@@ -269,7 +330,7 @@ class _Configure(_ConfigureSuper):
|
|
|
269
330
|
"greater than or equal to"),
|
|
270
331
|
MessageCodes.TDMLDF_POSITIVE_INT)
|
|
271
332
|
elif name in ['column_casesensitive_handler', '_validate_metaexpression',
|
|
272
|
-
'_validate_gc', 'inline_plot', '_oauth']:
|
|
333
|
+
'_validate_gc', 'inline_plot', '_oauth', '_ccp_enabled']:
|
|
273
334
|
|
|
274
335
|
if not isinstance(value, bool):
|
|
275
336
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
@@ -325,7 +386,7 @@ class _Configure(_ConfigureSuper):
|
|
|
325
386
|
Messages.get_message(MessageCodes.PATH_NOT_FOUND).format(value),
|
|
326
387
|
MessageCodes.PATH_NOT_FOUND)
|
|
327
388
|
|
|
328
|
-
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id'}:
|
|
389
|
+
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id', '_vector_store_base_url'}:
|
|
329
390
|
|
|
330
391
|
if not isinstance(value, str):
|
|
331
392
|
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'str'))
|
|
@@ -333,7 +394,7 @@ class _Configure(_ConfigureSuper):
|
|
|
333
394
|
if len(value) == 0:
|
|
334
395
|
raise ValueError(Messages.get_message(MessageCodes.ARG_EMPTY, name))
|
|
335
396
|
|
|
336
|
-
if name
|
|
397
|
+
if name in ['ues_url', '_vector_store_base_url']:
|
|
337
398
|
value = value[: -1] if value.endswith("/") else value
|
|
338
399
|
|
|
339
400
|
elif name in ['temp_table_database', 'temp_view_database',
|
|
@@ -355,16 +416,59 @@ class _Configure(_ConfigureSuper):
|
|
|
355
416
|
for url in value:
|
|
356
417
|
if not isinstance(url, str):
|
|
357
418
|
raise TypeError(
|
|
358
|
-
Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
419
|
+
Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
420
|
+
'str, list of str or None'))
|
|
359
421
|
|
|
360
422
|
elif name == 'openml_user_env':
|
|
361
423
|
from teradataml.scriptmgmt.UserEnv import UserEnv
|
|
362
424
|
if not isinstance(value, UserEnv) and not isinstance(value, type(None)):
|
|
363
425
|
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'UserEnv or None'))
|
|
364
426
|
|
|
427
|
+
elif name == 'table_operator':
|
|
428
|
+
if not isinstance(value, str) and not isinstance(value, type(None)):
|
|
429
|
+
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'str or None'))
|
|
430
|
+
|
|
431
|
+
if value is not None:
|
|
432
|
+
valid_names = ['script', 'apply']
|
|
433
|
+
value = value.lower()
|
|
434
|
+
if value not in valid_names:
|
|
435
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_ARG_VALUE,
|
|
436
|
+
value,
|
|
437
|
+
name,
|
|
438
|
+
"a value in {}".format(valid_names)),
|
|
439
|
+
MessageCodes.INVALID_ARG_VALUE)
|
|
440
|
+
elif name == "temp_object_type":
|
|
441
|
+
self.__validate_db_tbl_attrs(name, value)
|
|
442
|
+
valid_object_typs = ['VT']
|
|
443
|
+
if value and value.upper() not in valid_object_typs:
|
|
444
|
+
raise ValueError(Messages.get_message(MessageCodes.INVALID_ARG_VALUE,
|
|
445
|
+
value,
|
|
446
|
+
name,
|
|
447
|
+
"a value in {}".format(valid_object_typs)))
|
|
448
|
+
|
|
449
|
+
value = self.__get_temp_object_type(value)
|
|
450
|
+
|
|
365
451
|
super().__setattr__(name, value)
|
|
366
452
|
else:
|
|
367
453
|
raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__.__name__, name))
|
|
368
454
|
|
|
455
|
+
def __get_temp_object_type(self, value):
|
|
456
|
+
"""
|
|
457
|
+
Get the temporary object type based on the value provided.
|
|
458
|
+
Default behavior is to create views that will be garbage collected at the end.
|
|
459
|
+
"""
|
|
460
|
+
from teradataml.common.constants import TeradataConstants
|
|
461
|
+
if value and value.upper() == "VT":
|
|
462
|
+
return TeradataConstants.TERADATA_VOLATILE_TABLE
|
|
463
|
+
# This we will need in the future.
|
|
464
|
+
# elif value and value.upper() in ["TT", "PT"]:
|
|
465
|
+
# return TeradataConstants.TERADATA_TABLE
|
|
466
|
+
return TeradataConstants.TERADATA_VIEW
|
|
467
|
+
|
|
468
|
+
def __validate_db_tbl_attrs(self, name, value):
|
|
469
|
+
if not isinstance(value, str) and not isinstance(value, type(None)):
|
|
470
|
+
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
471
|
+
'str or None'))
|
|
472
|
+
|
|
369
473
|
|
|
370
|
-
configure = _Configure()
|
|
474
|
+
configure = _Configure()
|
teradataml/options/display.py
CHANGED
|
@@ -51,6 +51,7 @@ class _Display(_DisplaySuper):
|
|
|
51
51
|
blob_length = _create_property('blob_length')
|
|
52
52
|
suppress_vantage_runtime_warnings = _create_property('suppress_vantage_runtime_warnings')
|
|
53
53
|
geometry_column_length = _create_property('geometry_column_length')
|
|
54
|
+
enable_ui = _create_property('enable_ui')
|
|
54
55
|
|
|
55
56
|
def __init__(self,
|
|
56
57
|
max_rows = 10,
|
|
@@ -59,7 +60,8 @@ class _Display(_DisplaySuper):
|
|
|
59
60
|
print_sqlmr_query = False,
|
|
60
61
|
blob_length=10,
|
|
61
62
|
suppress_vantage_runtime_warnings=True,
|
|
62
|
-
geometry_column_length=30
|
|
63
|
+
geometry_column_length=30,
|
|
64
|
+
enable_ui=True):
|
|
63
65
|
"""
|
|
64
66
|
PARAMETERS:
|
|
65
67
|
max_rows:
|
|
@@ -115,6 +117,14 @@ class _Display(_DisplaySuper):
|
|
|
115
117
|
Types: bool
|
|
116
118
|
Example:
|
|
117
119
|
display.suppress_vantage_runtime_warnings = True
|
|
120
|
+
|
|
121
|
+
enable_ui:
|
|
122
|
+
Specifies whether to display exploratory data analysis UI when DataFrame is printed or not.
|
|
123
|
+
When set to True, UI is enabled to be displayed, otherwise it is disabled.
|
|
124
|
+
Default Value: True
|
|
125
|
+
Types: bool
|
|
126
|
+
Example:
|
|
127
|
+
display.enable_ui = True
|
|
118
128
|
"""
|
|
119
129
|
super().__init__()
|
|
120
130
|
super().__setattr__('max_rows', max_rows)
|
|
@@ -124,6 +134,7 @@ class _Display(_DisplaySuper):
|
|
|
124
134
|
super().__setattr__('blob_length', blob_length)
|
|
125
135
|
super().__setattr__('suppress_vantage_runtime_warnings', suppress_vantage_runtime_warnings)
|
|
126
136
|
super().__setattr__('geometry_column_length', geometry_column_length)
|
|
137
|
+
super().__setattr__('enable_ui', enable_ui)
|
|
127
138
|
|
|
128
139
|
def __setattr__(self, name, value):
|
|
129
140
|
if hasattr(self, name):
|
|
@@ -149,7 +160,7 @@ class _Display(_DisplaySuper):
|
|
|
149
160
|
name,
|
|
150
161
|
"a value in {}".format(valid_encodings)),
|
|
151
162
|
MessageCodes.INVALID_ARG_VALUE)
|
|
152
|
-
elif name == 'print_sqlmr_query':
|
|
163
|
+
elif name == 'print_sqlmr_query' or name == 'enable_ui':
|
|
153
164
|
if not isinstance(value, bool):
|
|
154
165
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
155
166
|
'bool'),
|
teradataml/plot/axis.py
CHANGED
|
@@ -20,6 +20,7 @@ from teradataml.dataframe.sql import ColumnExpression
|
|
|
20
20
|
from teradataml.plot.constants import MapType
|
|
21
21
|
from teradataml.utils.validators import _Validators
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
class Axis:
|
|
24
25
|
def __init__(self, **kwargs):
|
|
25
26
|
"""
|
|
@@ -421,9 +422,47 @@ class Axis:
|
|
|
421
422
|
self.__series_options = kwargs.get("series_options") # Specifies SQL element - ID_SEQUENCE
|
|
422
423
|
|
|
423
424
|
# Get the series identifier. If it is a column expression, get the column name from it.
|
|
424
|
-
self.
|
|
425
|
-
if not isinstance(self.
|
|
426
|
-
self.
|
|
425
|
+
self.series_identifier = kwargs.get("series_identifier")
|
|
426
|
+
if not isinstance(self.series_identifier, str) and self.series_identifier is not None:
|
|
427
|
+
self.series_identifier = self.series_identifier.name
|
|
428
|
+
|
|
429
|
+
def __eq__(self, other):
|
|
430
|
+
"""
|
|
431
|
+
DESCRIPTION:
|
|
432
|
+
Magic method to check if two Axis objects are equal or not.
|
|
433
|
+
If all the associated parameters are same, then two Axis objects
|
|
434
|
+
are equal. Else, they are not equal.
|
|
435
|
+
|
|
436
|
+
PARAMETERS:
|
|
437
|
+
other:
|
|
438
|
+
Required Argument.
|
|
439
|
+
Specifies the object of Axis.
|
|
440
|
+
Types: Axis
|
|
441
|
+
|
|
442
|
+
RETURNS:
|
|
443
|
+
bool
|
|
444
|
+
|
|
445
|
+
RAISES:
|
|
446
|
+
None.
|
|
447
|
+
|
|
448
|
+
EXAMPLES:
|
|
449
|
+
>>> Axis() == Axis()
|
|
450
|
+
"""
|
|
451
|
+
attrs = ["cmap", "color", "grid_color",
|
|
452
|
+
"grid_format", "grid_linestyle", "grid_linewidth",
|
|
453
|
+
"legend", "legend_style", "linestyle",
|
|
454
|
+
"linewidth", "marker", "markersize", "position",
|
|
455
|
+
"span", "reverse_xaxis", "reverse_yaxis", "series_identifier",
|
|
456
|
+
"title", "xlabel", "xlim", "xtick_format", "ylabel", "ylim", "ytick_format",
|
|
457
|
+
"vmin", "vmax", "ignore_nulls", "kind"]
|
|
458
|
+
|
|
459
|
+
for attr in attrs:
|
|
460
|
+
if getattr(self, attr) == getattr(other, attr):
|
|
461
|
+
continue
|
|
462
|
+
else:
|
|
463
|
+
return False
|
|
464
|
+
|
|
465
|
+
return True
|
|
427
466
|
|
|
428
467
|
def __get_param(self, param):
|
|
429
468
|
"""
|
|
@@ -940,7 +979,7 @@ class Axis:
|
|
|
940
979
|
"""
|
|
941
980
|
from teradataml.dataframe.dataframe import TDSeries
|
|
942
981
|
|
|
943
|
-
if self.
|
|
982
|
+
if self.series_identifier:
|
|
944
983
|
# Remove null values from DataFrame
|
|
945
984
|
if self.ignore_nulls:
|
|
946
985
|
_df = self.__x_axis_data[0]._parent_df
|
|
@@ -954,7 +993,7 @@ class Axis:
|
|
|
954
993
|
self.__y_axis_data[0]._parent_df.materialize()
|
|
955
994
|
|
|
956
995
|
series = TDSeries(data=_df if self.ignore_nulls else self.__x_axis_data[0]._parent_df,
|
|
957
|
-
id=self.
|
|
996
|
+
id=self.series_identifier,
|
|
958
997
|
row_index=self.__x_axis_data[0].name,
|
|
959
998
|
row_index_style=self.__get_index_style(self.__x_axis_data[0]),
|
|
960
999
|
payload_field=self.__y_axis_data[0].name,
|
|
@@ -1038,7 +1077,7 @@ class Axis:
|
|
|
1038
1077
|
"""
|
|
1039
1078
|
from teradataml.dataframe.dataframe import TDMatrix
|
|
1040
1079
|
|
|
1041
|
-
if self.
|
|
1080
|
+
if self.series_identifier:
|
|
1042
1081
|
# Remove null values from DataFrame
|
|
1043
1082
|
if self.ignore_nulls:
|
|
1044
1083
|
_df = self.__x_axis_data[0]._parent_df
|
|
@@ -1052,7 +1091,7 @@ class Axis:
|
|
|
1052
1091
|
self.__y_axis_data[0]._parent_df.materialize()
|
|
1053
1092
|
|
|
1054
1093
|
matrix = TDMatrix(data=_df if self.ignore_nulls else self.__x_axis_data[0]._parent_df,
|
|
1055
|
-
id=self.
|
|
1094
|
+
id=self.series_identifier,
|
|
1056
1095
|
row_index=self.__x_axis_data[0].name,
|
|
1057
1096
|
row_index_style=self.__get_index_style(self.__x_axis_data[0]),
|
|
1058
1097
|
column_index=self.__y_axis_data[0].name,
|
|
@@ -1242,7 +1281,7 @@ class Axis:
|
|
|
1242
1281
|
|
|
1243
1282
|
# For subplot or multiple series, make sure to populate legend.
|
|
1244
1283
|
# For mainplot, leave it to user's choice.
|
|
1245
|
-
if self._is_sub_plot() or self.
|
|
1284
|
+
if self._is_sub_plot() or self.series_identifier or (len(self.__y_axis_data) > 1) and \
|
|
1246
1285
|
self.kind not in (MapType.MESH.value, MapType.WIGGLE.value):
|
|
1247
1286
|
func_params["LEGEND"] = "'{}'".format("best" if not self.legend_style else self.legend_style)
|
|
1248
1287
|
else:
|
teradataml/plot/figure.py
CHANGED
|
@@ -111,6 +111,39 @@ class Figure:
|
|
|
111
111
|
|
|
112
112
|
self._plot_axis = {}
|
|
113
113
|
|
|
114
|
+
def __eq__(self, other):
|
|
115
|
+
"""
|
|
116
|
+
DESCRIPTION:
|
|
117
|
+
Magic method to check if two Figure objects are equal or not.
|
|
118
|
+
If all the associated parameters are same, then two Figure objects
|
|
119
|
+
are equal. Else, they are not equal.
|
|
120
|
+
|
|
121
|
+
PARAMETERS:
|
|
122
|
+
other:
|
|
123
|
+
Required Argument.
|
|
124
|
+
Specifies the object of Figure.
|
|
125
|
+
Types: Figure
|
|
126
|
+
|
|
127
|
+
RETURNS:
|
|
128
|
+
bool
|
|
129
|
+
|
|
130
|
+
RAISES:
|
|
131
|
+
None.
|
|
132
|
+
|
|
133
|
+
EXAMPLES:
|
|
134
|
+
>>> Figure() == Figure()
|
|
135
|
+
"""
|
|
136
|
+
attrs = ["width", "height", "image_type", "dpi", "heading",
|
|
137
|
+
"layout"]
|
|
138
|
+
|
|
139
|
+
for attr in attrs:
|
|
140
|
+
if getattr(self, attr) == getattr(other, attr):
|
|
141
|
+
continue
|
|
142
|
+
else:
|
|
143
|
+
return False
|
|
144
|
+
|
|
145
|
+
return True
|
|
146
|
+
|
|
114
147
|
@property
|
|
115
148
|
def height(self):
|
|
116
149
|
"""
|