teradataml 20.0.0.2__py3-none-any.whl → 20.0.0.3__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 +196 -2
- teradataml/__init__.py +4 -0
- teradataml/_version.py +1 -1
- teradataml/analytics/analytic_function_executor.py +79 -4
- teradataml/analytics/json_parser/metadata.py +12 -3
- teradataml/analytics/json_parser/utils.py +7 -2
- teradataml/analytics/sqle/__init__.py +1 -0
- teradataml/analytics/table_operator/__init__.py +1 -1
- teradataml/analytics/uaf/__init__.py +1 -1
- teradataml/analytics/utils.py +4 -0
- teradataml/automl/data_preparation.py +3 -2
- teradataml/automl/feature_engineering.py +15 -7
- teradataml/automl/model_training.py +39 -33
- teradataml/common/__init__.py +2 -1
- teradataml/common/constants.py +35 -0
- teradataml/common/garbagecollector.py +2 -1
- teradataml/common/messagecodes.py +8 -2
- teradataml/common/messages.py +3 -1
- teradataml/common/sqlbundle.py +25 -3
- teradataml/common/utils.py +134 -9
- teradataml/context/context.py +20 -10
- teradataml/data/SQL_Fundamentals.pdf +0 -0
- teradataml/data/dataframe_example.json +18 -2
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +1 -1
- teradataml/data/docs/sqle/docs_17_20/Shap.py +7 -1
- 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/DickeyFuller.py +18 -21
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +1 -1
- 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/vectordistance_example.json +4 -0
- teradataml/dataframe/dataframe.py +543 -175
- teradataml/dataframe/functions.py +553 -25
- teradataml/dataframe/sql.py +184 -15
- teradataml/dbutils/dbutils.py +556 -18
- teradataml/dbutils/filemgr.py +48 -1
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/__init__.py +1 -1
- teradataml/opensource/{sklearn/_class.py → _class.py} +102 -17
- teradataml/opensource/_lightgbm.py +950 -0
- teradataml/opensource/{sklearn/_wrapper_utils.py → _wrapper_utils.py} +1 -2
- teradataml/opensource/{sklearn/constants.py → constants.py} +13 -10
- teradataml/opensource/sklearn/__init__.py +0 -1
- teradataml/opensource/sklearn/_sklearn_wrapper.py +798 -438
- teradataml/options/__init__.py +7 -23
- teradataml/options/configure.py +29 -3
- teradataml/scriptmgmt/UserEnv.py +3 -3
- teradataml/scriptmgmt/lls_utils.py +74 -21
- teradataml/store/__init__.py +13 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +291 -0
- teradataml/store/feature_store/feature_store.py +2223 -0
- teradataml/store/feature_store/models.py +1505 -0
- teradataml/store/vector_store/__init__.py +1586 -0
- 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 +4 -2
- teradataml/utils/validators.py +33 -1
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.3.dist-info}/METADATA +200 -5
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.3.dist-info}/RECORD +88 -65
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.3.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.3.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.3.dist-info}/zip-safe +0 -0
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
|
|
@@ -95,9 +79,7 @@ def set_config_params(**kwargs):
|
|
|
95
79
|
EXAMPLES:
|
|
96
80
|
# Example 1: Set configuration params using set_config_params() function.
|
|
97
81
|
>>> 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",
|
|
82
|
+
>>> set_config_params(certificate_file="cert.crt",
|
|
101
83
|
... default_varchar_size=512,
|
|
102
84
|
... val_install_location="VAL_USER",
|
|
103
85
|
... read_nos_function_mapping="read_nos_fm",
|
|
@@ -109,7 +91,6 @@ def set_config_params(**kwargs):
|
|
|
109
91
|
# Example 2: Alternatively, set configuration parameters without using set_config_params() function.
|
|
110
92
|
# To do so, we will use configure module.
|
|
111
93
|
>>> from teradataml import configure
|
|
112
|
-
>>> configure.ues_url="https://teracloud/v1/accounts/xyz-234-76085/open-analytics"
|
|
113
94
|
>>> configure.certificate_file="cert.crt"
|
|
114
95
|
>>> configure.default_varchar_size=512
|
|
115
96
|
>>> configure.val_install_location="VAL_USER"
|
|
@@ -120,9 +101,12 @@ def set_config_params(**kwargs):
|
|
|
120
101
|
"""
|
|
121
102
|
for option in kwargs:
|
|
122
103
|
try:
|
|
123
|
-
if option == "auth_token":
|
|
124
|
-
|
|
125
|
-
|
|
104
|
+
if option == "auth_token" or option == 'ues_url':
|
|
105
|
+
raise TeradataMlException(Messages.get_message(
|
|
106
|
+
MessageCodes.FUNC_EXECUTION_FAILED, 'set_config_params',
|
|
107
|
+
'Setting of parameter \'{}\' is prohibited from set_config_params(). '
|
|
108
|
+
'Use set_auth_token() to set parameter.'.format(option)),
|
|
109
|
+
MessageCodes.FUNC_EXECUTION_FAILED)
|
|
126
110
|
else:
|
|
127
111
|
setattr(configure, option, kwargs[option])
|
|
128
112
|
except AttributeError as e:
|
teradataml/options/configure.py
CHANGED
|
@@ -59,6 +59,7 @@ class _Configure(_ConfigureSuper):
|
|
|
59
59
|
openml_user_env = _create_property('openml_user_env')
|
|
60
60
|
local_storage = _create_property('local_storage')
|
|
61
61
|
stored_procedure_install_location = _create_property('stored_procedure_install_location')
|
|
62
|
+
table_operator = _create_property('table_operator')
|
|
62
63
|
|
|
63
64
|
def __init__(self, default_varchar_size=1024, column_casesensitive_handler = False,
|
|
64
65
|
vantage_version="vantage1.1", val_install_location=None,
|
|
@@ -67,7 +68,8 @@ class _Configure(_ConfigureSuper):
|
|
|
67
68
|
read_nos_function_mapping="read_nos", write_nos_function_mapping="write_nos",
|
|
68
69
|
cran_repositories=None, inline_plot=True,
|
|
69
70
|
indb_install_location="/var/opt/teradata/languages/sles12sp3/Python/",
|
|
70
|
-
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB"
|
|
71
|
+
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB",
|
|
72
|
+
table_operator=None):
|
|
71
73
|
|
|
72
74
|
"""
|
|
73
75
|
PARAMETERS:
|
|
@@ -181,6 +183,13 @@ class _Configure(_ConfigureSuper):
|
|
|
181
183
|
# when stored procedures are installed in 'SYSLIB'.
|
|
182
184
|
teradataml.options.configure.stored_procedure_install_location = "SYSLIB"
|
|
183
185
|
|
|
186
|
+
table_operator:
|
|
187
|
+
Specifies the name of the table operator.
|
|
188
|
+
Types: string
|
|
189
|
+
Example:
|
|
190
|
+
# Set the table operator name to "Script"
|
|
191
|
+
teradataml.options.configure.table_operator = "Script"
|
|
192
|
+
|
|
184
193
|
"""
|
|
185
194
|
super().__init__()
|
|
186
195
|
super().__setattr__('default_varchar_size', default_varchar_size)
|
|
@@ -199,6 +208,7 @@ class _Configure(_ConfigureSuper):
|
|
|
199
208
|
super().__setattr__('openml_user_env', openml_user_env)
|
|
200
209
|
super().__setattr__('local_storage', local_storage)
|
|
201
210
|
super().__setattr__('stored_procedure_install_location', stored_procedure_install_location)
|
|
211
|
+
super().__setattr__('table_operator', table_operator)
|
|
202
212
|
|
|
203
213
|
# internal configurations
|
|
204
214
|
# These configurations are internal and should not be
|
|
@@ -228,6 +238,8 @@ class _Configure(_ConfigureSuper):
|
|
|
228
238
|
# Internal parameter, that is used for specifying the URL to be used as
|
|
229
239
|
# base URL in UES REST calls
|
|
230
240
|
super().__setattr__('ues_url', None)
|
|
241
|
+
# base URL in Vector Store REST calls
|
|
242
|
+
super().__setattr__('_vector_store_base_url', None)
|
|
231
243
|
# Internal parameter, that is used to specify the certificate file in a secured HTTP request.
|
|
232
244
|
super().__setattr__('certificate_file', False)
|
|
233
245
|
# Internal parameter, that is used for specify the maximum size of the file
|
|
@@ -325,7 +337,7 @@ class _Configure(_ConfigureSuper):
|
|
|
325
337
|
Messages.get_message(MessageCodes.PATH_NOT_FOUND).format(value),
|
|
326
338
|
MessageCodes.PATH_NOT_FOUND)
|
|
327
339
|
|
|
328
|
-
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id'}:
|
|
340
|
+
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id', '_vector_store_base_url'}:
|
|
329
341
|
|
|
330
342
|
if not isinstance(value, str):
|
|
331
343
|
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'str'))
|
|
@@ -333,7 +345,7 @@ class _Configure(_ConfigureSuper):
|
|
|
333
345
|
if len(value) == 0:
|
|
334
346
|
raise ValueError(Messages.get_message(MessageCodes.ARG_EMPTY, name))
|
|
335
347
|
|
|
336
|
-
if name
|
|
348
|
+
if name in ['ues_url', '_vector_store_base_url']:
|
|
337
349
|
value = value[: -1] if value.endswith("/") else value
|
|
338
350
|
|
|
339
351
|
elif name in ['temp_table_database', 'temp_view_database',
|
|
@@ -362,6 +374,20 @@ class _Configure(_ConfigureSuper):
|
|
|
362
374
|
if not isinstance(value, UserEnv) and not isinstance(value, type(None)):
|
|
363
375
|
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'UserEnv or None'))
|
|
364
376
|
|
|
377
|
+
elif name == 'table_operator':
|
|
378
|
+
if not isinstance(value, str) and not isinstance(value, type(None)):
|
|
379
|
+
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'str or None'))
|
|
380
|
+
|
|
381
|
+
if value is not None:
|
|
382
|
+
valid_names = ['script', 'apply']
|
|
383
|
+
value = value.lower()
|
|
384
|
+
if value not in valid_names:
|
|
385
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_ARG_VALUE,
|
|
386
|
+
value,
|
|
387
|
+
name,
|
|
388
|
+
"a value in {}".format(valid_names)),
|
|
389
|
+
MessageCodes.INVALID_ARG_VALUE)
|
|
390
|
+
|
|
365
391
|
super().__setattr__(name, value)
|
|
366
392
|
else:
|
|
367
393
|
raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__.__name__, name))
|
teradataml/scriptmgmt/UserEnv.py
CHANGED
|
@@ -205,7 +205,7 @@ def _process_ues_response(api_name, response, success_status_code=None):
|
|
|
205
205
|
def _get_auth_token():
|
|
206
206
|
"""
|
|
207
207
|
DESCRIPTION:
|
|
208
|
-
Internal function to get Authentication token for all
|
|
208
|
+
Internal function to get Authentication token for all CCP enabled REST calls
|
|
209
209
|
|
|
210
210
|
PARAMETERS:
|
|
211
211
|
None
|
|
@@ -238,8 +238,8 @@ def _get_auth_token():
|
|
|
238
238
|
|
|
239
239
|
# Store the jwt token in internal class attribute.
|
|
240
240
|
_InternalBuffer.add(auth_token=_AuthToken(token=token_data["access_token"]))
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
if _InternalBuffer.get("auth_token"):
|
|
242
|
+
return {"Authorization": "Bearer {}".format(_InternalBuffer.get("auth_token").value)}
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
class UserEnv:
|
|
@@ -23,6 +23,7 @@ from json.decoder import JSONDecodeError
|
|
|
23
23
|
from teradataml import configure
|
|
24
24
|
from teradataml.context.context import _get_user, get_connection
|
|
25
25
|
from teradataml.common.constants import HTTPRequest, AsyncStatusColumns
|
|
26
|
+
from teradataml.common.deprecations import argument_deprecation
|
|
26
27
|
from teradataml.common.exceptions import TeradataMlException
|
|
27
28
|
from teradataml.common.messages import Messages
|
|
28
29
|
from teradataml.common.messagecodes import MessageCodes
|
|
@@ -40,7 +41,6 @@ from urllib.parse import parse_qs, urlparse
|
|
|
40
41
|
from teradataml.utils.utils import _async_run_id_info
|
|
41
42
|
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
42
43
|
|
|
43
|
-
|
|
44
44
|
@collect_queryband(queryband="LstBsEnv")
|
|
45
45
|
def list_base_envs():
|
|
46
46
|
"""
|
|
@@ -437,11 +437,18 @@ def __create_envs(template):
|
|
|
437
437
|
if libs or libs_file_path:
|
|
438
438
|
print("Installing libraries in environment '{}'...".format(env_name))
|
|
439
439
|
try:
|
|
440
|
-
env_handle.install_lib(libs, libs_file_path)
|
|
441
|
-
|
|
440
|
+
status = env_handle.install_lib(libs, libs_file_path)
|
|
441
|
+
if status['Stage'][1] == 'Errored':
|
|
442
|
+
err_message = status['Additional Details'][1].replace("Error with package maintenance -> ", "\n")
|
|
443
|
+
raise Exception(err_message)
|
|
444
|
+
else:
|
|
445
|
+
print("Libraries installation in environment '{}' - Completed.".format(env_name))
|
|
442
446
|
except Exception as lib_installation_failure:
|
|
443
|
-
|
|
444
|
-
|
|
447
|
+
error_code = MessageCodes.FUNC_EXECUTION_FAILED
|
|
448
|
+
error_msg = Messages.get_message(error_code,
|
|
449
|
+
"'install_lib' request for enviornment: '{}'".format(env_name),
|
|
450
|
+
'\n'+str(lib_installation_failure))
|
|
451
|
+
print(error_msg)
|
|
445
452
|
errored = errored or True
|
|
446
453
|
pass
|
|
447
454
|
|
|
@@ -741,9 +748,11 @@ def create_env(env_name=None, base_env=None, desc=None, template=None, conda_env
|
|
|
741
748
|
# Validate arguments
|
|
742
749
|
_Validators._validate_function_arguments(__arg_info_matrix, skip_empty_check=False)
|
|
743
750
|
|
|
744
|
-
# Get the latest python base env in OpenAF, if base_env is not provided
|
|
751
|
+
# Get the latest python base env in OpenAF, if base_env is not provided,
|
|
752
|
+
# Or if base_env is provided and not in the list of base envs.
|
|
745
753
|
# Note: By default python base env is obtained.
|
|
746
|
-
if not base_env
|
|
754
|
+
if not base_env or \
|
|
755
|
+
(base_env and base_env.lower() not in list_base_envs()['base_name'].str.lower().to_list()):
|
|
747
756
|
base_env = __get_default_base_env()
|
|
748
757
|
if not desc:
|
|
749
758
|
desc = "This env '{}' is created with base env '{}'.".format(env_name, base_env)
|
|
@@ -1550,7 +1559,8 @@ def get_user_env():
|
|
|
1550
1559
|
|
|
1551
1560
|
|
|
1552
1561
|
@collect_queryband(queryband="StAthTkn")
|
|
1553
|
-
|
|
1562
|
+
@argument_deprecation("20.00.00.04", "ues_url", False, "base_url")
|
|
1563
|
+
def set_auth_token(base_url=None, client_id=None, pat_token=None, pem_file=None, **kwargs):
|
|
1554
1564
|
"""
|
|
1555
1565
|
DESCRIPTION:
|
|
1556
1566
|
Function to set the Authentication token to connect to User Environment Service
|
|
@@ -1563,11 +1573,17 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1563
1573
|
Refresh token still works but only for OAuth authentication.
|
|
1564
1574
|
|
|
1565
1575
|
PARAMETERS:
|
|
1576
|
+
|
|
1566
1577
|
ues_url:
|
|
1567
1578
|
Required Argument.
|
|
1568
1579
|
Specifies the URL for User Environment Service in VantageCloud Lake.
|
|
1569
1580
|
Types: str
|
|
1570
1581
|
|
|
1582
|
+
base_url:
|
|
1583
|
+
Required Argument.
|
|
1584
|
+
Specifies the CCP endpoint URL.
|
|
1585
|
+
Types: str
|
|
1586
|
+
|
|
1571
1587
|
client_id:
|
|
1572
1588
|
Optional Argument.
|
|
1573
1589
|
Specifies the id of the application that requests the access token from
|
|
@@ -1601,6 +1617,16 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1601
1617
|
Default Value: 31536000
|
|
1602
1618
|
Types: int
|
|
1603
1619
|
|
|
1620
|
+
auth_token:
|
|
1621
|
+
Optional Parameter.
|
|
1622
|
+
Specifies the authentication token to connect to VantageCloud Lake.
|
|
1623
|
+
Notes:
|
|
1624
|
+
* if "auth_token" is set through this function, then this function
|
|
1625
|
+
should always be used only after create_context.
|
|
1626
|
+
* use this option only if user has got JWT token and wants to set the same
|
|
1627
|
+
instead of generating it again from this function.
|
|
1628
|
+
Types: str
|
|
1629
|
+
|
|
1604
1630
|
RETURNS:
|
|
1605
1631
|
True, if the operation is successful.
|
|
1606
1632
|
|
|
@@ -1611,16 +1637,16 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1611
1637
|
|
|
1612
1638
|
# Example 1: Set the Authentication token using default client_id.
|
|
1613
1639
|
>>> import getpass
|
|
1614
|
-
>>> set_auth_token(
|
|
1640
|
+
>>> set_auth_token(base_url=getpass.getpass("ues_url : "))
|
|
1615
1641
|
|
|
1616
1642
|
# Example 2: Set the Authentication token by specifying the client_id.
|
|
1617
|
-
>>> set_auth_token(
|
|
1643
|
+
>>> set_auth_token(base_url=getpass.getpass("base_url : "),
|
|
1618
1644
|
... client_id=getpass.getpass("client_id : "))
|
|
1619
1645
|
|
|
1620
1646
|
# Example 3: Set the Authentication token by specifying the "pem_file" and "pat_token"
|
|
1621
1647
|
# without specifying "username".
|
|
1622
1648
|
>>> import getpass
|
|
1623
|
-
>>> set_auth_token(
|
|
1649
|
+
>>> set_auth_token(base_url=getpass.getpass("base_url : "),
|
|
1624
1650
|
... pat_token=getpass.getpass("pat_token : "),
|
|
1625
1651
|
... pem_file=getpass.getpass("pem_file : "))
|
|
1626
1652
|
True
|
|
@@ -1628,7 +1654,7 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1628
1654
|
# Example 4: Set the Authentication token by specifying the "pem_file" and "pat_token"
|
|
1629
1655
|
# and "username".
|
|
1630
1656
|
>>> import getpass
|
|
1631
|
-
>>> set_auth_token(
|
|
1657
|
+
>>> set_auth_token(base_url=getpass.getpass("base_url : "),
|
|
1632
1658
|
... pat_token=getpass.getpass("pat_token : "),
|
|
1633
1659
|
... pem_file=getpass.getpass("pem_file : "))
|
|
1634
1660
|
... username = "alice")
|
|
@@ -1640,8 +1666,12 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1640
1666
|
raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_CONTEXT_CONNECTION),
|
|
1641
1667
|
MessageCodes.INVALID_CONTEXT_CONNECTION)
|
|
1642
1668
|
|
|
1669
|
+
# Getting the ues_url.
|
|
1670
|
+
ues_url = kwargs.get("ues_url", None)
|
|
1671
|
+
|
|
1643
1672
|
__arg_info_matrix = []
|
|
1644
|
-
__arg_info_matrix.append(["
|
|
1673
|
+
__arg_info_matrix.append(["base_url", base_url, True, (str), True])
|
|
1674
|
+
__arg_info_matrix.append(["ues_url", ues_url, True, (str), True])
|
|
1645
1675
|
__arg_info_matrix.append(["client_id", client_id, True, (str), True])
|
|
1646
1676
|
__arg_info_matrix.append(["pat_token", pat_token, True, (str), True])
|
|
1647
1677
|
__arg_info_matrix.append(["pem_file", pem_file, True, (str), True])
|
|
@@ -1649,12 +1679,38 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1649
1679
|
username = kwargs.get("username", None)
|
|
1650
1680
|
__arg_info_matrix.append((["username", username, True, (str), True]))
|
|
1651
1681
|
|
|
1682
|
+
auth_token = kwargs.get("auth_token")
|
|
1683
|
+
__arg_info_matrix.append((["auth_token", auth_token, True, (str), True]))
|
|
1684
|
+
|
|
1652
1685
|
expiration_time = kwargs.get("expiration_time", 31536000)
|
|
1653
1686
|
__arg_info_matrix.append((["expiration_time", expiration_time, True, (int), True]))
|
|
1654
1687
|
|
|
1655
1688
|
# Validate arguments.
|
|
1656
1689
|
_Validators._validate_function_arguments(__arg_info_matrix)
|
|
1657
1690
|
|
|
1691
|
+
# base_url should not end with 'open-analytics' or 'data-insights'
|
|
1692
|
+
if base_url:
|
|
1693
|
+
if base_url.endswith('open-analytics') or base_url.endswith('data-insights'):
|
|
1694
|
+
message = Messages.get_message(MessageCodes.ARG_NONE,
|
|
1695
|
+
"base_url", "ending with 'data-insights' or 'open-analytics", None)
|
|
1696
|
+
raise TeradataMlException(message, MessageCodes.ARG_NONE)
|
|
1697
|
+
|
|
1698
|
+
# Set the vector_store_base_url. This should only be done if base_url is set.
|
|
1699
|
+
# In case ues_url is set, vector_store_base_url should not be set.
|
|
1700
|
+
configure._vector_store_base_url = f'{base_url}/data-insights'
|
|
1701
|
+
|
|
1702
|
+
# If ues_url is provided, then use it as base_url.
|
|
1703
|
+
base_url = kwargs.get("ues_url", base_url)
|
|
1704
|
+
|
|
1705
|
+
# Set the OpenAF url.
|
|
1706
|
+
# If ues_url is present use that otherwise generate it from base_url.
|
|
1707
|
+
configure.ues_url = ues_url if ues_url else f'{base_url}/open-analytics'
|
|
1708
|
+
|
|
1709
|
+
# If user pass Auth token, set it.
|
|
1710
|
+
if auth_token:
|
|
1711
|
+
_InternalBuffer.add(auth_token=_AuthToken(token=auth_token))
|
|
1712
|
+
return True
|
|
1713
|
+
|
|
1658
1714
|
if client_id and any([pat_token, pem_file]):
|
|
1659
1715
|
message = Messages.get_message(MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT,
|
|
1660
1716
|
"client_id", "pat_token' and 'pem_file")
|
|
@@ -1670,16 +1726,16 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1670
1726
|
if pem_file is not None:
|
|
1671
1727
|
_Validators._validate_file_exists(pem_file)
|
|
1672
1728
|
|
|
1673
|
-
# Extract the base URL
|
|
1674
|
-
url_parser = urlparse(
|
|
1675
|
-
|
|
1729
|
+
# Extract the base URL.
|
|
1730
|
+
url_parser = urlparse(base_url)
|
|
1731
|
+
parsed_base_url = "{}://{}".format(url_parser.scheme, url_parser.netloc)
|
|
1676
1732
|
netloc = url_parser.netloc.split('.')[0]
|
|
1677
1733
|
|
|
1678
1734
|
# Check if the authentication is PAT based or OAuth.
|
|
1679
1735
|
if all(arg is None for arg in [pat_token, pem_file]):
|
|
1680
1736
|
configure._oauth = True
|
|
1681
1737
|
client_id = "{}-oaf-device".format(netloc) if client_id is None else client_id
|
|
1682
|
-
da_wf = _DAWorkflow(
|
|
1738
|
+
da_wf = _DAWorkflow(parsed_base_url, client_id)
|
|
1683
1739
|
token_data = da_wf._get_token_data()
|
|
1684
1740
|
|
|
1685
1741
|
# Set Open AF parameters.
|
|
@@ -1702,7 +1758,7 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1702
1758
|
|
|
1703
1759
|
# Construct a dictionary to be passed to _AuthWorkflow().
|
|
1704
1760
|
state_dict = {}
|
|
1705
|
-
state_dict["base_url"] =
|
|
1761
|
+
state_dict["base_url"] = parsed_base_url
|
|
1706
1762
|
state_dict["org_id"] = org_id
|
|
1707
1763
|
state_dict["pat_token"] = pat_token
|
|
1708
1764
|
state_dict["pem_file"] = pem_file
|
|
@@ -1714,7 +1770,4 @@ def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwa
|
|
|
1714
1770
|
# Store the jwt token in internal class attribute.
|
|
1715
1771
|
_InternalBuffer.add(auth_token=_AuthToken(token=token_data))
|
|
1716
1772
|
|
|
1717
|
-
# Set Open AF parameters.
|
|
1718
|
-
configure.ues_url = ues_url
|
|
1719
|
-
|
|
1720
1773
|
return True
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2024 by Teradata Corporation. All rights reserved.
|
|
3
|
+
TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
|
|
4
|
+
|
|
5
|
+
Primary Owner: pradeep.garre@teradata.com
|
|
6
|
+
Secondary Owner: aanchal.kavedia@teradata.com
|
|
7
|
+
|
|
8
|
+
This file imports components from Feature Store and Vector Store.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from teradataml.store.feature_store.feature_store import FeatureStore
|
|
12
|
+
from teradataml.store.feature_store.models import *
|
|
13
|
+
from teradataml.store.vector_store import *
|
|
File without changes
|