teradataml 20.0.0.0__py3-none-any.whl → 20.0.0.2__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/LICENSE.pdf +0 -0
- teradataml/README.md +183 -0
- teradataml/__init__.py +6 -3
- teradataml/_version.py +2 -2
- teradataml/analytics/__init__.py +3 -2
- teradataml/analytics/analytic_function_executor.py +275 -40
- teradataml/analytics/analytic_query_generator.py +92 -0
- teradataml/analytics/byom/__init__.py +3 -2
- teradataml/analytics/json_parser/metadata.py +1 -0
- teradataml/analytics/json_parser/utils.py +17 -21
- teradataml/analytics/meta_class.py +40 -1
- teradataml/analytics/sqle/DecisionTreePredict.py +1 -1
- teradataml/analytics/sqle/__init__.py +10 -2
- teradataml/analytics/table_operator/__init__.py +3 -2
- teradataml/analytics/uaf/__init__.py +21 -2
- teradataml/analytics/utils.py +62 -1
- teradataml/analytics/valib.py +1 -1
- teradataml/automl/__init__.py +1553 -319
- teradataml/automl/custom_json_utils.py +139 -61
- teradataml/automl/data_preparation.py +276 -319
- teradataml/automl/data_transformation.py +163 -81
- teradataml/automl/feature_engineering.py +402 -239
- teradataml/automl/feature_exploration.py +9 -2
- teradataml/automl/model_evaluation.py +48 -51
- teradataml/automl/model_training.py +291 -189
- teradataml/catalog/byom.py +8 -8
- teradataml/catalog/model_cataloging_utils.py +1 -1
- teradataml/clients/auth_client.py +133 -0
- teradataml/clients/pkce_client.py +1 -1
- teradataml/common/aed_utils.py +3 -2
- teradataml/common/constants.py +48 -6
- teradataml/common/deprecations.py +13 -7
- teradataml/common/garbagecollector.py +156 -120
- teradataml/common/messagecodes.py +6 -1
- teradataml/common/messages.py +3 -1
- teradataml/common/sqlbundle.py +1 -1
- teradataml/common/utils.py +103 -11
- teradataml/common/wrapper_utils.py +1 -1
- teradataml/context/context.py +121 -31
- teradataml/data/advertising.csv +201 -0
- teradataml/data/bank_marketing.csv +11163 -0
- teradataml/data/bike_sharing.csv +732 -0
- teradataml/data/boston2cols.csv +721 -0
- teradataml/data/breast_cancer.csv +570 -0
- teradataml/data/complaints_test_tokenized.csv +353 -0
- teradataml/data/complaints_tokens_model.csv +348 -0
- teradataml/data/covid_confirm_sd.csv +83 -0
- teradataml/data/customer_segmentation_test.csv +2628 -0
- teradataml/data/customer_segmentation_train.csv +8069 -0
- teradataml/data/dataframe_example.json +10 -0
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +3 -1
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +6 -0
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +5 -1
- teradataml/data/docs/sqle/docs_17_20/ANOVA.py +61 -1
- teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
- teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +2 -0
- teradataml/data/docs/sqle/docs_17_20/FTest.py +105 -26
- teradataml/data/docs/sqle/docs_17_20/GLM.py +162 -1
- teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +5 -3
- teradataml/data/docs/sqle/docs_17_20/KMeans.py +48 -1
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +3 -2
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +5 -0
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +6 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +2 -0
- teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
- teradataml/data/docs/sqle/docs_17_20/ROC.py +3 -2
- teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +13 -2
- teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +119 -1
- teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +93 -1
- teradataml/data/docs/sqle/docs_17_20/Shap.py +197 -0
- teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +163 -1
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
- teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
- teradataml/data/docs/sqle/docs_17_20/XGBoost.py +12 -4
- teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +7 -1
- teradataml/data/docs/sqle/docs_17_20/ZTest.py +72 -7
- teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -10
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +35 -5
- teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +3 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
- teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +3 -2
- teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Convolve.py +13 -10
- teradataml/data/docs/uaf/docs_17_20/Convolve2.py +4 -1
- teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +5 -4
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +214 -0
- teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +9 -31
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +4 -2
- teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +1 -8
- teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
- teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/MAMean.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
- teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +15 -6
- teradataml/data/docs/uaf/docs_17_20/PACF.py +0 -1
- teradataml/data/docs/uaf/docs_17_20/Portman.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/Resample.py +9 -1
- teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
- teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +17 -10
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +3 -1
- teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
- teradataml/data/dwt2d_dataTable.csv +65 -0
- teradataml/data/dwt_dataTable.csv +8 -0
- teradataml/data/dwt_filterTable.csv +3 -0
- teradataml/data/finance_data4.csv +13 -0
- teradataml/data/glm_example.json +28 -1
- teradataml/data/grocery_transaction.csv +19 -0
- teradataml/data/housing_train_segment.csv +201 -0
- teradataml/data/idwt2d_dataTable.csv +5 -0
- teradataml/data/idwt_dataTable.csv +8 -0
- teradataml/data/idwt_filterTable.csv +3 -0
- teradataml/data/insect2Cols.csv +61 -0
- teradataml/data/interval_data.csv +5 -0
- teradataml/data/jsons/paired_functions.json +14 -0
- teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +99 -27
- teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
- teradataml/data/jsons/sqle/17.20/TD_FTest.json +166 -83
- teradataml/data/jsons/sqle/17.20/TD_GLM.json +90 -14
- teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +48 -5
- teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +5 -3
- teradataml/data/jsons/sqle/17.20/TD_KMeans.json +31 -11
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +3 -2
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +9 -9
- teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
- teradataml/data/jsons/sqle/17.20/TD_ROC.json +2 -1
- teradataml/data/jsons/sqle/17.20/TD_SVM.json +16 -16
- teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +19 -1
- teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +168 -15
- teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +50 -1
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +222 -0
- teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
- teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
- teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +25 -7
- teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +17 -4
- teradataml/data/jsons/sqle/17.20/TD_ZTest.json +157 -80
- teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
- teradataml/data/jsons/uaf/17.20/TD_ACF.json +1 -18
- teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +3 -16
- teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +0 -3
- teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +5 -3
- teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
- teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +0 -3
- teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +0 -2
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +2 -1
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +2 -5
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +3 -6
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +1 -3
- teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +0 -5
- teradataml/data/jsons/uaf/17.20/TD_DFFT.json +1 -4
- teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +2 -7
- teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +1 -2
- teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +0 -2
- teradataml/data/jsons/uaf/17.20/TD_DTW.json +3 -6
- teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
- teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +16 -30
- teradataml/data/jsons/uaf/17.20/{TD_HOLT_WINTERS_FORECAST.json → TD_HOLT_WINTERS_FORECASTER.json} +1 -2
- teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +1 -15
- teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
- teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
- teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +1 -3
- teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
- teradataml/data/jsons/uaf/17.20/TD_PACF.json +2 -2
- teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +5 -5
- teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +48 -28
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +208 -0
- teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +12 -6
- teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +0 -1
- teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +8 -8
- teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +400 -0
- teradataml/data/kmeans_example.json +5 -0
- teradataml/data/kmeans_table.csv +10 -0
- teradataml/data/load_example_data.py +8 -2
- teradataml/data/naivebayestextclassifier_example.json +1 -1
- teradataml/data/naivebayestextclassifierpredict_example.json +11 -0
- teradataml/data/onehot_encoder_train.csv +4 -0
- teradataml/data/openml_example.json +29 -0
- teradataml/data/peppers.png +0 -0
- teradataml/data/real_values.csv +14 -0
- teradataml/data/sax_example.json +8 -0
- teradataml/data/scale_attributes.csv +3 -0
- teradataml/data/scale_example.json +52 -1
- teradataml/data/scale_input_part_sparse.csv +31 -0
- teradataml/data/scale_input_partitioned.csv +16 -0
- teradataml/data/scale_input_sparse.csv +11 -0
- teradataml/data/scale_parameters.csv +3 -0
- teradataml/data/scripts/deploy_script.py +21 -2
- teradataml/data/scripts/sklearn/sklearn_fit.py +40 -37
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +22 -30
- teradataml/data/scripts/sklearn/sklearn_function.template +42 -24
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +23 -33
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +19 -28
- teradataml/data/scripts/sklearn/sklearn_score.py +32 -32
- teradataml/data/scripts/sklearn/sklearn_transform.py +85 -42
- teradataml/data/star_pivot.csv +8 -0
- teradataml/data/templates/open_source_ml.json +2 -1
- teradataml/data/teradataml_example.json +97 -1
- teradataml/data/timestamp_data.csv +4 -0
- teradataml/data/titanic_dataset_unpivoted.csv +19 -0
- teradataml/data/uaf_example.json +55 -1
- teradataml/data/unpivot_example.json +15 -0
- teradataml/data/url_data.csv +9 -0
- teradataml/data/windowdfft.csv +16 -0
- teradataml/data/ztest_example.json +16 -0
- teradataml/dataframe/copy_to.py +9 -4
- teradataml/dataframe/data_transfer.py +125 -64
- teradataml/dataframe/dataframe.py +575 -57
- teradataml/dataframe/dataframe_utils.py +47 -9
- teradataml/dataframe/fastload.py +273 -90
- teradataml/dataframe/functions.py +339 -0
- teradataml/dataframe/row.py +160 -0
- teradataml/dataframe/setop.py +2 -2
- teradataml/dataframe/sql.py +740 -18
- teradataml/dataframe/window.py +1 -1
- teradataml/dbutils/dbutils.py +324 -18
- teradataml/geospatial/geodataframe.py +1 -1
- teradataml/geospatial/geodataframecolumn.py +1 -1
- teradataml/hyperparameter_tuner/optimizer.py +13 -13
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/sklearn/_sklearn_wrapper.py +254 -122
- teradataml/options/__init__.py +16 -5
- teradataml/options/configure.py +39 -6
- teradataml/options/display.py +2 -2
- teradataml/plot/axis.py +4 -4
- teradataml/scriptmgmt/UserEnv.py +26 -19
- teradataml/scriptmgmt/lls_utils.py +120 -16
- teradataml/table_operators/Script.py +4 -5
- teradataml/table_operators/TableOperator.py +160 -26
- teradataml/table_operators/table_operator_util.py +88 -41
- teradataml/table_operators/templates/dataframe_udf.template +63 -0
- teradataml/telemetry_utils/__init__.py +0 -0
- teradataml/telemetry_utils/queryband.py +52 -0
- teradataml/utils/validators.py +41 -3
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/METADATA +191 -6
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/RECORD +263 -185
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/zip-safe +0 -0
teradataml/options/__init__.py
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
from teradataml.common.deprecations import argument_deprecation
|
|
1
2
|
from teradataml.common.exceptions import TeradataMlException
|
|
2
3
|
from teradataml.common.messagecodes import MessageCodes
|
|
3
4
|
from teradataml.common.messages import Messages
|
|
4
5
|
from teradataml.options.configure import configure
|
|
5
6
|
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
6
|
-
from
|
|
7
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
7
8
|
|
|
8
9
|
|
|
10
|
+
@argument_deprecation("future", ["auth_token", "ues_url"], False, None)
|
|
9
11
|
@collect_queryband(queryband="StCnfgPrms")
|
|
10
12
|
def set_config_params(**kwargs):
|
|
11
13
|
"""
|
|
@@ -21,9 +23,11 @@ def set_config_params(**kwargs):
|
|
|
21
23
|
auth_token:
|
|
22
24
|
Optional Parameter.
|
|
23
25
|
Specifies the authentication token to connect to VantageCloud Lake.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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.
|
|
27
31
|
Types: str
|
|
28
32
|
|
|
29
33
|
ues_url:
|
|
@@ -77,6 +81,11 @@ def set_config_params(**kwargs):
|
|
|
77
81
|
The default value is the installation location of In-DB 2.0.0 packages.
|
|
78
82
|
Older versions of In-DB packages are installed at
|
|
79
83
|
"/opt/teradata/languages/Python/".
|
|
84
|
+
|
|
85
|
+
local_storage:
|
|
86
|
+
Specifies the location on client where garbage collector folder will be created.
|
|
87
|
+
Types: str
|
|
88
|
+
|
|
80
89
|
RETURNS:
|
|
81
90
|
bool
|
|
82
91
|
|
|
@@ -93,7 +102,8 @@ def set_config_params(**kwargs):
|
|
|
93
102
|
... val_install_location="VAL_USER",
|
|
94
103
|
... read_nos_function_mapping="read_nos_fm",
|
|
95
104
|
... write_nos_function_mapping="write_nos_fm",
|
|
96
|
-
... indb_install_location="/opt/teradata/languages/Python"
|
|
105
|
+
... indb_install_location="/opt/teradata/languages/Python",
|
|
106
|
+
... local_storage="/Users/gc")
|
|
97
107
|
True
|
|
98
108
|
|
|
99
109
|
# Example 2: Alternatively, set configuration parameters without using set_config_params() function.
|
|
@@ -106,6 +116,7 @@ def set_config_params(**kwargs):
|
|
|
106
116
|
>>> configure.read_nos_function_mapping="read_nos_fm"
|
|
107
117
|
>>> configure.write_nos_function_mapping="write_nos_fm"
|
|
108
118
|
>>> configure.indb_install_location="/opt/teradata/languages/Python"
|
|
119
|
+
>>> configure.local_storage = "/Users/gc/"
|
|
109
120
|
"""
|
|
110
121
|
for option in kwargs:
|
|
111
122
|
try:
|
teradataml/options/configure.py
CHANGED
|
@@ -13,7 +13,6 @@ 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
|
-
|
|
17
16
|
class _ConfigureSuper(object):
|
|
18
17
|
|
|
19
18
|
def __init__(self):
|
|
@@ -58,6 +57,8 @@ class _Configure(_ConfigureSuper):
|
|
|
58
57
|
inline_plot = _create_property('inline_plot')
|
|
59
58
|
indb_install_location = _create_property('indb_install_location')
|
|
60
59
|
openml_user_env = _create_property('openml_user_env')
|
|
60
|
+
local_storage = _create_property('local_storage')
|
|
61
|
+
stored_procedure_install_location = _create_property('stored_procedure_install_location')
|
|
61
62
|
|
|
62
63
|
def __init__(self, default_varchar_size=1024, column_casesensitive_handler = False,
|
|
63
64
|
vantage_version="vantage1.1", val_install_location=None,
|
|
@@ -66,7 +67,7 @@ class _Configure(_ConfigureSuper):
|
|
|
66
67
|
read_nos_function_mapping="read_nos", write_nos_function_mapping="write_nos",
|
|
67
68
|
cran_repositories=None, inline_plot=True,
|
|
68
69
|
indb_install_location="/var/opt/teradata/languages/sles12sp3/Python/",
|
|
69
|
-
openml_user_env=None):
|
|
70
|
+
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB"):
|
|
70
71
|
|
|
71
72
|
"""
|
|
72
73
|
PARAMETERS:
|
|
@@ -163,6 +164,23 @@ class _Configure(_ConfigureSuper):
|
|
|
163
164
|
# Set the environment to be used for OpenML.
|
|
164
165
|
_env_name = "OpenAF" # Name of the user defined environment.
|
|
165
166
|
teradataml.options.configure.openml_user_env = get_env(_env_name)
|
|
167
|
+
|
|
168
|
+
local_storage:
|
|
169
|
+
Specifies the location on client where garbage collector folder will be created.
|
|
170
|
+
Types: string
|
|
171
|
+
Example:
|
|
172
|
+
# Set the garbage collector location to "/Users/gc/"
|
|
173
|
+
teradataml.options.configure.local_storage = "/Users/gc/"
|
|
174
|
+
|
|
175
|
+
stored_procedure_install_location:
|
|
176
|
+
Specifies the name of the database where stored procedures
|
|
177
|
+
are installed.
|
|
178
|
+
Types: string
|
|
179
|
+
Example:
|
|
180
|
+
# Set the Stored Procedure install location to 'SYSLIB'
|
|
181
|
+
# when stored procedures are installed in 'SYSLIB'.
|
|
182
|
+
teradataml.options.configure.stored_procedure_install_location = "SYSLIB"
|
|
183
|
+
|
|
166
184
|
"""
|
|
167
185
|
super().__init__()
|
|
168
186
|
super().__setattr__('default_varchar_size', default_varchar_size)
|
|
@@ -179,6 +197,8 @@ class _Configure(_ConfigureSuper):
|
|
|
179
197
|
super().__setattr__('inline_plot', True)
|
|
180
198
|
super().__setattr__('indb_install_location', indb_install_location)
|
|
181
199
|
super().__setattr__('openml_user_env', openml_user_env)
|
|
200
|
+
super().__setattr__('local_storage', local_storage)
|
|
201
|
+
super().__setattr__('stored_procedure_install_location', stored_procedure_install_location)
|
|
182
202
|
|
|
183
203
|
# internal configurations
|
|
184
204
|
# These configurations are internal and should not be
|
|
@@ -221,6 +241,12 @@ class _Configure(_ConfigureSuper):
|
|
|
221
241
|
super().__setattr__('_oauth_client_id', None)
|
|
222
242
|
# Internal parameter, that is used for specifying the Authentication token expiry time.
|
|
223
243
|
super().__setattr__('_auth_token_expiry_time', None)
|
|
244
|
+
# Internal parameter, that is used for specifying the OAuth authentication.
|
|
245
|
+
super().__setattr__('_oauth', None)
|
|
246
|
+
# Internal parameter, that is used for specifying the current database associated with current connection.
|
|
247
|
+
super().__setattr__('_current_database_name', None)
|
|
248
|
+
# Internal parameter, that is used for specifying the database username associated with current connection.
|
|
249
|
+
super().__setattr__('_database_username', None)
|
|
224
250
|
|
|
225
251
|
def __setattr__(self, name, value):
|
|
226
252
|
if hasattr(self, name):
|
|
@@ -243,7 +269,7 @@ class _Configure(_ConfigureSuper):
|
|
|
243
269
|
"greater than or equal to"),
|
|
244
270
|
MessageCodes.TDMLDF_POSITIVE_INT)
|
|
245
271
|
elif name in ['column_casesensitive_handler', '_validate_metaexpression',
|
|
246
|
-
'_validate_gc', 'inline_plot']:
|
|
272
|
+
'_validate_gc', 'inline_plot', '_oauth']:
|
|
247
273
|
|
|
248
274
|
if not isinstance(value, bool):
|
|
249
275
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
@@ -283,15 +309,21 @@ class _Configure(_ConfigureSuper):
|
|
|
283
309
|
"a value in {}".format(valid_versions)),
|
|
284
310
|
MessageCodes.INVALID_ARG_VALUE)
|
|
285
311
|
|
|
286
|
-
elif name in ['val_install_location', 'byom_install_location',
|
|
312
|
+
elif name in ['val_install_location', 'byom_install_location',
|
|
287
313
|
'read_nos_function_mapping', 'write_nos_function_mapping',
|
|
288
314
|
'_byom_model_catalog_database', '_byom_model_catalog_table',
|
|
289
315
|
'_byom_model_catalog_license', '_byom_model_catalog_license_source',
|
|
290
|
-
'indb_install_location']:
|
|
316
|
+
'indb_install_location', 'local_storage', 'stored_procedure_install_location']:
|
|
291
317
|
if not isinstance(value, str):
|
|
292
318
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
293
319
|
'str'),
|
|
294
320
|
MessageCodes.UNSUPPORTED_DATATYPE)
|
|
321
|
+
if name == 'local_storage':
|
|
322
|
+
# Validate if path exists.
|
|
323
|
+
if not os.path.exists(value):
|
|
324
|
+
raise TeradataMlException(
|
|
325
|
+
Messages.get_message(MessageCodes.PATH_NOT_FOUND).format(value),
|
|
326
|
+
MessageCodes.PATH_NOT_FOUND)
|
|
295
327
|
|
|
296
328
|
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id'}:
|
|
297
329
|
|
|
@@ -305,7 +337,8 @@ class _Configure(_ConfigureSuper):
|
|
|
305
337
|
value = value[: -1] if value.endswith("/") else value
|
|
306
338
|
|
|
307
339
|
elif name in ['temp_table_database', 'temp_view_database',
|
|
308
|
-
"_byom_model_catalog_license_table", "_byom_model_catalog_license_database"
|
|
340
|
+
"_byom_model_catalog_license_table", "_byom_model_catalog_license_database",
|
|
341
|
+
"_current_database_name", "_database_username", "database_version"]:
|
|
309
342
|
if not isinstance(value, str) and not isinstance(value, type(None)):
|
|
310
343
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
311
344
|
'str or None'),
|
teradataml/options/display.py
CHANGED
|
@@ -58,7 +58,7 @@ class _Display(_DisplaySuper):
|
|
|
58
58
|
byte_encoding = 'base16',
|
|
59
59
|
print_sqlmr_query = False,
|
|
60
60
|
blob_length=10,
|
|
61
|
-
suppress_vantage_runtime_warnings=
|
|
61
|
+
suppress_vantage_runtime_warnings=True,
|
|
62
62
|
geometry_column_length=30):
|
|
63
63
|
"""
|
|
64
64
|
PARAMETERS:
|
|
@@ -111,7 +111,7 @@ class _Display(_DisplaySuper):
|
|
|
111
111
|
Specifies whether to display the warnings raised by the Vantage or not.
|
|
112
112
|
When set to True, warnings raised by Vantage are not displayed.
|
|
113
113
|
Otherwise, warnings are displayed.
|
|
114
|
-
Default Value:
|
|
114
|
+
Default Value: True
|
|
115
115
|
Types: bool
|
|
116
116
|
Example:
|
|
117
117
|
display.suppress_vantage_runtime_warnings = True
|
teradataml/plot/axis.py
CHANGED
|
@@ -951,7 +951,7 @@ class Axis:
|
|
|
951
951
|
# Execute the node and create the table in Vantage.
|
|
952
952
|
if self.__y_axis_data[0]._parent_df._table_name is None:
|
|
953
953
|
# Assuming all the columns are from same DataFrame.
|
|
954
|
-
|
|
954
|
+
self.__y_axis_data[0]._parent_df.materialize()
|
|
955
955
|
|
|
956
956
|
series = TDSeries(data=_df if self.ignore_nulls else self.__x_axis_data[0]._parent_df,
|
|
957
957
|
id=self.__series_identifier,
|
|
@@ -994,7 +994,7 @@ class Axis:
|
|
|
994
994
|
# Remove null values from DataFrame
|
|
995
995
|
if self.ignore_nulls:
|
|
996
996
|
_df = _df.dropna()
|
|
997
|
-
|
|
997
|
+
_df.materialize()
|
|
998
998
|
series = TDSeries(data=_df,
|
|
999
999
|
id="id",
|
|
1000
1000
|
row_index="x",
|
|
@@ -1049,7 +1049,7 @@ class Axis:
|
|
|
1049
1049
|
|
|
1050
1050
|
# Execute the node and create the table/view in Vantage.
|
|
1051
1051
|
if self.__y_axis_data[0]._parent_df._table_name is None:
|
|
1052
|
-
|
|
1052
|
+
self.__y_axis_data[0]._parent_df.materialize()
|
|
1053
1053
|
|
|
1054
1054
|
matrix = TDMatrix(data=_df if self.ignore_nulls else self.__x_axis_data[0]._parent_df,
|
|
1055
1055
|
id=self.__series_identifier,
|
|
@@ -1077,7 +1077,7 @@ class Axis:
|
|
|
1077
1077
|
# Remove null values from DataFrame
|
|
1078
1078
|
if self.ignore_nulls:
|
|
1079
1079
|
_df = _df.dropna()
|
|
1080
|
-
|
|
1080
|
+
_df.materialize()
|
|
1081
1081
|
matrix = TDMatrix(data=_df,
|
|
1082
1082
|
id="id",
|
|
1083
1083
|
row_index="x",
|
teradataml/scriptmgmt/UserEnv.py
CHANGED
|
@@ -23,6 +23,7 @@ from teradataml import configure
|
|
|
23
23
|
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
24
24
|
from concurrent.futures import ThreadPoolExecutor, wait
|
|
25
25
|
from teradataml.clients.pkce_client import _DAWorkflow
|
|
26
|
+
from teradataml.clients.auth_client import _AuthWorkflow
|
|
26
27
|
from teradataml.context.context import _get_user
|
|
27
28
|
from teradataml.common.constants import HTTPRequest, CloudProvider
|
|
28
29
|
from teradataml.common.exceptions import TeradataMlException
|
|
@@ -31,7 +32,7 @@ from teradataml.common.messagecodes import MessageCodes
|
|
|
31
32
|
from teradataml.common.utils import UtilFuncs
|
|
32
33
|
from teradataml.utils.validators import _Validators
|
|
33
34
|
from urllib.parse import urlparse
|
|
34
|
-
from
|
|
35
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
def _get_ues_url(env_type="users", **kwargs):
|
|
@@ -219,22 +220,24 @@ def _get_auth_token():
|
|
|
219
220
|
>>>_get_auth_token()
|
|
220
221
|
"""
|
|
221
222
|
# Check the current time. If token is expiring, get another one from refresh token.
|
|
222
|
-
if configure.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
if configure._oauth:
|
|
224
|
+
if configure._auth_token_expiry_time and time.time() > configure._auth_token_expiry_time:
|
|
225
|
+
# Extract the base URL from "ues_url".
|
|
226
|
+
ues_url = configure.ues_url
|
|
227
|
+
client_id = configure._oauth_client_id
|
|
226
228
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
url_parser = urlparse(ues_url)
|
|
230
|
+
base_url = "{}://{}".format(url_parser.scheme, url_parser.netloc)
|
|
229
231
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
# Get the JWT Token details.
|
|
233
|
+
da_wf = _DAWorkflow(base_url, client_id)
|
|
234
|
+
token_data = da_wf._get_token_data()
|
|
233
235
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
# Replace the options with new values.
|
|
237
|
+
configure._auth_token_expiry_time = time.time() + token_data["expires_in"] - 15
|
|
238
|
+
|
|
239
|
+
# Store the jwt token in internal class attribute.
|
|
240
|
+
_InternalBuffer.add(auth_token=_AuthToken(token=token_data["access_token"]))
|
|
238
241
|
|
|
239
242
|
return {"Authorization": "Bearer {}".format(_InternalBuffer.get("auth_token").value)}
|
|
240
243
|
|
|
@@ -532,6 +535,8 @@ class UserEnv:
|
|
|
532
535
|
|
|
533
536
|
# Check if file exists or not.
|
|
534
537
|
_Validators._validate_file_exists(file_path)
|
|
538
|
+
# Check if file is empty or not.
|
|
539
|
+
_Validators._check_empty_file(file_path)
|
|
535
540
|
|
|
536
541
|
try:
|
|
537
542
|
# If file size is more than 10 MB, upload the file to cloud and export it to UES.
|
|
@@ -678,11 +683,11 @@ class UserEnv:
|
|
|
678
683
|
"x-ms-blob-type": CloudProvider.X_MS_BLOB_TYPE.value}
|
|
679
684
|
|
|
680
685
|
# Initiate file upload to cloud.
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
+
with open(file_path, 'rb') as fp:
|
|
687
|
+
response = UtilFuncs._http_request(cloud_storage_url,
|
|
688
|
+
HTTPRequest.PUT,
|
|
689
|
+
data=fp,
|
|
690
|
+
headers=headers)
|
|
686
691
|
|
|
687
692
|
# Since the API is not for UES, it is better to validate and raise error separately.
|
|
688
693
|
if not (200 <= response.status_code < 300):
|
|
@@ -3518,6 +3523,8 @@ class UserEnv:
|
|
|
3518
3523
|
user environment created in Vantage Languages Ecosystem. If
|
|
3519
3524
|
model with same name already exists in the remote user
|
|
3520
3525
|
environment, error is thrown.
|
|
3526
|
+
Note:
|
|
3527
|
+
Maximum size of the model should be less than or equal to 5GB.
|
|
3521
3528
|
|
|
3522
3529
|
PARAMETERS:
|
|
3523
3530
|
model_path:
|
|
@@ -21,13 +21,14 @@ import requests
|
|
|
21
21
|
|
|
22
22
|
from json.decoder import JSONDecodeError
|
|
23
23
|
from teradataml import configure
|
|
24
|
-
from teradataml.context.context import _get_user
|
|
24
|
+
from teradataml.context.context import _get_user, get_connection
|
|
25
25
|
from teradataml.common.constants import HTTPRequest, AsyncStatusColumns
|
|
26
26
|
from teradataml.common.exceptions import TeradataMlException
|
|
27
27
|
from teradataml.common.messages import Messages
|
|
28
28
|
from teradataml.common.messagecodes import MessageCodes
|
|
29
29
|
from teradataml.common.utils import UtilFuncs
|
|
30
30
|
from teradataml.clients.pkce_client import _DAWorkflow
|
|
31
|
+
from teradataml.clients.auth_client import _AuthWorkflow
|
|
31
32
|
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
32
33
|
from teradataml.scriptmgmt.UserEnv import UserEnv, _get_auth_token, \
|
|
33
34
|
_process_ues_response, _get_ues_url, _AuthToken
|
|
@@ -37,7 +38,7 @@ import warnings
|
|
|
37
38
|
import webbrowser
|
|
38
39
|
from urllib.parse import parse_qs, urlparse
|
|
39
40
|
from teradataml.utils.utils import _async_run_id_info
|
|
40
|
-
from
|
|
41
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
@collect_queryband(queryband="LstBsEnv")
|
|
@@ -1120,7 +1121,8 @@ def get_env(env_name):
|
|
|
1120
1121
|
# Get environments created by the current logged in user.
|
|
1121
1122
|
user_envs_df = list_user_envs()
|
|
1122
1123
|
|
|
1123
|
-
if
|
|
1124
|
+
if (user_envs_df is None or
|
|
1125
|
+
(not user_envs_df.empty and env_name not in user_envs_df.env_name.values)):
|
|
1124
1126
|
msg_code = MessageCodes.FUNC_EXECUTION_FAILED
|
|
1125
1127
|
error_msg = Messages.get_message(msg_code, "get_env()", "User environment '{}' not found."
|
|
1126
1128
|
" Use 'create_env()' function to create"
|
|
@@ -1548,15 +1550,17 @@ def get_user_env():
|
|
|
1548
1550
|
|
|
1549
1551
|
|
|
1550
1552
|
@collect_queryband(queryband="StAthTkn")
|
|
1551
|
-
def set_auth_token(ues_url, client_id=None):
|
|
1553
|
+
def set_auth_token(ues_url, client_id=None, pat_token=None, pem_file=None, **kwargs):
|
|
1552
1554
|
"""
|
|
1553
1555
|
DESCRIPTION:
|
|
1554
1556
|
Function to set the Authentication token to connect to User Environment Service
|
|
1555
1557
|
in VantageCloud Lake.
|
|
1556
1558
|
Note:
|
|
1557
|
-
User must have a
|
|
1559
|
+
User must have a privilege to login with a NULL password to use set_auth_token().
|
|
1558
1560
|
Please refer to GRANT LOGON section in Teradata Documentation for more details.
|
|
1559
|
-
|
|
1561
|
+
If ues_url and client_id are specified then authentication is through OAuth.
|
|
1562
|
+
If ues_url, pat_token, pem_file are specified then authentication is through PAT.
|
|
1563
|
+
Refresh token still works but only for OAuth authentication.
|
|
1560
1564
|
|
|
1561
1565
|
PARAMETERS:
|
|
1562
1566
|
ues_url:
|
|
@@ -1570,6 +1574,32 @@ def set_auth_token(ues_url, client_id=None):
|
|
|
1570
1574
|
VantageCloud Lake.
|
|
1571
1575
|
Types: str
|
|
1572
1576
|
|
|
1577
|
+
pat_token:
|
|
1578
|
+
Required, if PAT authentication is to be used, optional otherwise.
|
|
1579
|
+
Specifies the PAT token generated from VantageCloud Lake Console.
|
|
1580
|
+
Types: str
|
|
1581
|
+
|
|
1582
|
+
pem_file:
|
|
1583
|
+
Required, if PAT authentication is to be used, optional otherwise.
|
|
1584
|
+
Specifies the path to private key file which is generated from VantageCloud Lake Console.
|
|
1585
|
+
Types: str
|
|
1586
|
+
|
|
1587
|
+
**kwargs:
|
|
1588
|
+
username:
|
|
1589
|
+
Specifies the user for which authentication is to be requested.
|
|
1590
|
+
If not specified, then user associated with current connection is used.
|
|
1591
|
+
Note:
|
|
1592
|
+
1. Use this option only if name of the database username has lower case letters.
|
|
1593
|
+
2. This option is used only for PAT and not for OAuth.
|
|
1594
|
+
Types: str
|
|
1595
|
+
|
|
1596
|
+
expiration_time:
|
|
1597
|
+
Specifies the expiration time of the token in seconds. After expiry time JWT token expires and
|
|
1598
|
+
UserEnv methods does not work, user should regenerate the token.
|
|
1599
|
+
Note:
|
|
1600
|
+
This option is used only for PAT and not for OAuth.
|
|
1601
|
+
Default Value: 31536000
|
|
1602
|
+
Types: int
|
|
1573
1603
|
|
|
1574
1604
|
RETURNS:
|
|
1575
1605
|
True, if the operation is successful.
|
|
@@ -1586,31 +1616,105 @@ def set_auth_token(ues_url, client_id=None):
|
|
|
1586
1616
|
# Example 2: Set the Authentication token by specifying the client_id.
|
|
1587
1617
|
>>> set_auth_token(ues_url=getpass.getpass("ues_url : "),
|
|
1588
1618
|
... client_id=getpass.getpass("client_id : "))
|
|
1619
|
+
|
|
1620
|
+
# Example 3: Set the Authentication token by specifying the "pem_file" and "pat_token"
|
|
1621
|
+
# without specifying "username".
|
|
1622
|
+
>>> import getpass
|
|
1623
|
+
>>> set_auth_token(ues_url=getpass.getpass("ues_url : "),
|
|
1624
|
+
... pat_token=getpass.getpass("pat_token : "),
|
|
1625
|
+
... pem_file=getpass.getpass("pem_file : "))
|
|
1626
|
+
True
|
|
1627
|
+
|
|
1628
|
+
# Example 4: Set the Authentication token by specifying the "pem_file" and "pat_token"
|
|
1629
|
+
# and "username".
|
|
1630
|
+
>>> import getpass
|
|
1631
|
+
>>> set_auth_token(ues_url=getpass.getpass("ues_url : "),
|
|
1632
|
+
... pat_token=getpass.getpass("pat_token : "),
|
|
1633
|
+
... pem_file=getpass.getpass("pem_file : "))
|
|
1634
|
+
... username = "alice")
|
|
1635
|
+
True
|
|
1589
1636
|
"""
|
|
1637
|
+
# Deriving global connection using get_connection().
|
|
1638
|
+
con = get_connection()
|
|
1639
|
+
if con is None:
|
|
1640
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_CONTEXT_CONNECTION),
|
|
1641
|
+
MessageCodes.INVALID_CONTEXT_CONNECTION)
|
|
1642
|
+
|
|
1590
1643
|
__arg_info_matrix = []
|
|
1591
1644
|
__arg_info_matrix.append(["ues_url", ues_url, False, (str), True])
|
|
1592
1645
|
__arg_info_matrix.append(["client_id", client_id, True, (str), True])
|
|
1646
|
+
__arg_info_matrix.append(["pat_token", pat_token, True, (str), True])
|
|
1647
|
+
__arg_info_matrix.append(["pem_file", pem_file, True, (str), True])
|
|
1648
|
+
|
|
1649
|
+
username = kwargs.get("username", None)
|
|
1650
|
+
__arg_info_matrix.append((["username", username, True, (str), True]))
|
|
1651
|
+
|
|
1652
|
+
expiration_time = kwargs.get("expiration_time", 31536000)
|
|
1653
|
+
__arg_info_matrix.append((["expiration_time", expiration_time, True, (int), True]))
|
|
1593
1654
|
|
|
1594
1655
|
# Validate arguments.
|
|
1595
1656
|
_Validators._validate_function_arguments(__arg_info_matrix)
|
|
1596
1657
|
|
|
1658
|
+
if client_id and any([pat_token, pem_file]):
|
|
1659
|
+
message = Messages.get_message(MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT,
|
|
1660
|
+
"client_id", "pat_token' and 'pem_file")
|
|
1661
|
+
raise TeradataMlException(message, MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT)
|
|
1662
|
+
|
|
1663
|
+
if client_id is None:
|
|
1664
|
+
if (pat_token and pem_file is None) or (pem_file and pat_token is None):
|
|
1665
|
+
message = Messages.get_message(MessageCodes.MUST_PASS_ARGUMENT,
|
|
1666
|
+
"pat_token", "pem_file")
|
|
1667
|
+
raise TeradataMlException(message, MessageCodes.MUST_PASS_ARGUMENT)
|
|
1668
|
+
|
|
1669
|
+
# Check if pem file exists.
|
|
1670
|
+
if pem_file is not None:
|
|
1671
|
+
_Validators._validate_file_exists(pem_file)
|
|
1672
|
+
|
|
1597
1673
|
# Extract the base URL from "ues_url".
|
|
1598
1674
|
url_parser = urlparse(ues_url)
|
|
1599
1675
|
base_url = "{}://{}".format(url_parser.scheme, url_parser.netloc)
|
|
1676
|
+
netloc = url_parser.netloc.split('.')[0]
|
|
1600
1677
|
|
|
1601
|
-
if
|
|
1602
|
-
|
|
1603
|
-
|
|
1678
|
+
# Check if the authentication is PAT based or OAuth.
|
|
1679
|
+
if all(arg is None for arg in [pat_token, pem_file]):
|
|
1680
|
+
configure._oauth = True
|
|
1681
|
+
client_id = "{}-oaf-device".format(netloc) if client_id is None else client_id
|
|
1682
|
+
da_wf = _DAWorkflow(base_url, client_id)
|
|
1683
|
+
token_data = da_wf._get_token_data()
|
|
1684
|
+
|
|
1685
|
+
# Set Open AF parameters.
|
|
1686
|
+
configure._oauth_client_id = client_id
|
|
1687
|
+
configure._oauth_end_point = da_wf.device_auth_end_point
|
|
1688
|
+
configure._auth_token_expiry_time = time() + token_data["expires_in"] - 15
|
|
1689
|
+
|
|
1690
|
+
# Store the jwt token in internal class attribute.
|
|
1691
|
+
_InternalBuffer.add(auth_token=_AuthToken(token=token_data["access_token"]))
|
|
1692
|
+
|
|
1693
|
+
else:
|
|
1694
|
+
configure._oauth = False
|
|
1695
|
+
|
|
1696
|
+
if username is None:
|
|
1697
|
+
# If username is not specified then the database username associated with the current context will be
|
|
1698
|
+
# considered.
|
|
1699
|
+
username = _get_user()
|
|
1700
|
+
|
|
1701
|
+
org_id = netloc
|
|
1702
|
+
|
|
1703
|
+
# Construct a dictionary to be passed to _AuthWorkflow().
|
|
1704
|
+
state_dict = {}
|
|
1705
|
+
state_dict["base_url"] = base_url
|
|
1706
|
+
state_dict["org_id"] = org_id
|
|
1707
|
+
state_dict["pat_token"] = pat_token
|
|
1708
|
+
state_dict["pem_file"] = pem_file
|
|
1709
|
+
state_dict["username"] = username
|
|
1710
|
+
state_dict["expiration_time"] = expiration_time
|
|
1604
1711
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1712
|
+
auth_wf = _AuthWorkflow(state_dict)
|
|
1713
|
+
token_data = auth_wf._proxy_jwt()
|
|
1714
|
+
# Store the jwt token in internal class attribute.
|
|
1715
|
+
_InternalBuffer.add(auth_token=_AuthToken(token=token_data))
|
|
1607
1716
|
|
|
1608
1717
|
# Set Open AF parameters.
|
|
1609
|
-
configure._oauth_client_id = client_id
|
|
1610
1718
|
configure.ues_url = ues_url
|
|
1611
|
-
configure._oauth_end_point = da_wf.device_auth_end_point
|
|
1612
|
-
configure._auth_token_expiry_time = time() + token_data["expires_in"] - 15
|
|
1613
|
-
# Store the jwt token in internal class attribute.
|
|
1614
|
-
_InternalBuffer.add(auth_token=_AuthToken(token=token_data["access_token"]))
|
|
1615
1719
|
|
|
1616
1720
|
return True
|
|
@@ -431,8 +431,8 @@ class Script(TableOperator):
|
|
|
431
431
|
from teradataml import list_td_reserved_keywords
|
|
432
432
|
if get_connection():
|
|
433
433
|
# Checking for reserved keywords and raising error if present.
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
columns = self.returns
|
|
435
|
+
list_td_reserved_keywords(key=columns, raise_error=True)
|
|
436
436
|
|
|
437
437
|
def __validate(self):
|
|
438
438
|
"""
|
|
@@ -728,7 +728,7 @@ class Script(TableOperator):
|
|
|
728
728
|
5 1 1
|
|
729
729
|
|
|
730
730
|
# Example 2 -
|
|
731
|
-
#
|
|
731
|
+
# Input data is barrier_new and script is executed on Vantage.
|
|
732
732
|
# use set_data() to reset arguments.
|
|
733
733
|
# Create teradataml DataFrame objects.
|
|
734
734
|
>>> load_example_data("Script", ["barrier_new"])
|
|
@@ -751,7 +751,7 @@ class Script(TableOperator):
|
|
|
751
751
|
... sort_ascending=False,
|
|
752
752
|
... charset='latin',
|
|
753
753
|
... returns=OrderedDict([("word", VARCHAR(15)),("count_input", VARCHAR(2))]))
|
|
754
|
-
# Script is
|
|
754
|
+
# Script is executed on Vantage.
|
|
755
755
|
>>> sto.execute_script()
|
|
756
756
|
############ STDOUT Output ############
|
|
757
757
|
word count_input
|
|
@@ -786,7 +786,6 @@ class Script(TableOperator):
|
|
|
786
786
|
5 1 1
|
|
787
787
|
|
|
788
788
|
# Example 3
|
|
789
|
-
# Script is tested using test_script and executed on Vantage.
|
|
790
789
|
# In order to run the script with same dataset but different data related
|
|
791
790
|
# arguments, use set_data() to reset arguments.
|
|
792
791
|
# Note:
|