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/catalog/byom.py
CHANGED
|
@@ -26,7 +26,7 @@ from teradataml.options.display import display
|
|
|
26
26
|
from teradataml.common.constants import ModelCatalogingConstants as mac
|
|
27
27
|
from teradataml.options.configure import configure
|
|
28
28
|
from teradataml.utils.utils import execute_sql
|
|
29
|
-
from
|
|
29
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
30
30
|
|
|
31
31
|
validator = _Validators()
|
|
32
32
|
|
|
@@ -541,13 +541,12 @@ def save_byom(model_id,
|
|
|
541
541
|
# If exists, extract required information about table columns types
|
|
542
542
|
# else extract from additional_columns_types.
|
|
543
543
|
# Also validate model_id against allowed length.
|
|
544
|
-
table_exists = connection.dialect.has_table(connection, table_name=table_name,
|
|
544
|
+
table_exists = connection.dialect.has_table(connection, table_name=table_name,
|
|
545
|
+
schema=schema_name, table_only=True)
|
|
545
546
|
if table_exists:
|
|
546
547
|
# Check if model exists or not. If exists, raise error.
|
|
547
548
|
__check_if_model_exists(
|
|
548
549
|
model_id, table_name, schema_name, raise_error_if_model_found=True)
|
|
549
|
-
if len(additional_columns_types) != 0:
|
|
550
|
-
warnings.warn("Argument additional_columns_types is ignored since table already exists.", stacklevel=2)
|
|
551
550
|
|
|
552
551
|
# Gather column name and type information from existing table
|
|
553
552
|
existing_table_df = DataFrame(in_schema(schema_name, table_name))
|
|
@@ -807,7 +806,7 @@ def delete_byom(model_id, table_name=None, schema_name=None):
|
|
|
807
806
|
|
|
808
807
|
# Before proceed further, check whether table exists or not.
|
|
809
808
|
conn = get_connection()
|
|
810
|
-
if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name):
|
|
809
|
+
if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name, table_only=True):
|
|
811
810
|
error_code = MessageCodes.MODEL_CATALOGING_OPERATION_FAILED
|
|
812
811
|
error_msg = Messages.get_message(
|
|
813
812
|
error_code, "delete", 'Table "{}.{}" does not exist.'.format(schema_name, table_name))
|
|
@@ -1472,7 +1471,7 @@ def retrieve_byom(model_id,
|
|
|
1472
1471
|
|
|
1473
1472
|
# Before proceeding further, check whether table exists or not.
|
|
1474
1473
|
conn = get_connection()
|
|
1475
|
-
if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name):
|
|
1474
|
+
if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name, table_only=True):
|
|
1476
1475
|
error_code = MessageCodes.MODEL_CATALOGING_OPERATION_FAILED
|
|
1477
1476
|
error_msg = Messages.get_message(
|
|
1478
1477
|
error_code, "retrieve", 'Table "{}.{}" does not exist.'.format(schema_name, table_name))
|
|
@@ -1535,7 +1534,8 @@ def retrieve_byom(model_id,
|
|
|
1535
1534
|
license_table = in_schema(license_schema_name, license_table_name)
|
|
1536
1535
|
|
|
1537
1536
|
# Check whether license table exists or not before proceed further.
|
|
1538
|
-
if not conn.dialect.has_table(conn, table_name=license_table_name, schema=license_schema_name
|
|
1537
|
+
if not conn.dialect.has_table(conn, table_name=license_table_name, schema=license_schema_name,
|
|
1538
|
+
table_only=True):
|
|
1539
1539
|
error_code = MessageCodes.EXECUTION_FAILED
|
|
1540
1540
|
error_msg = Messages.get_message(
|
|
1541
1541
|
error_code, "retrieve the model", 'Table "{}" does not exist.'.format(license_table))
|
|
@@ -1723,7 +1723,7 @@ def list_byom(table_name=None, schema_name=None, model_id=None):
|
|
|
1723
1723
|
|
|
1724
1724
|
# Before proceeding further, check whether table exists or not.
|
|
1725
1725
|
conn = get_connection()
|
|
1726
|
-
if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name):
|
|
1726
|
+
if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name, table_only=True):
|
|
1727
1727
|
error_code = MessageCodes.MODEL_CATALOGING_OPERATION_FAILED
|
|
1728
1728
|
error_msg = Messages.get_message(
|
|
1729
1729
|
error_code, "list", 'Table "{}.{}" does not exist.'.format(schema_name, table_name))
|
|
@@ -179,7 +179,7 @@ def __get_model_inputs_outputs(model, function_arg_map):
|
|
|
179
179
|
tdp = preparer(td_dialect)
|
|
180
180
|
nrows, ncols = member.shape
|
|
181
181
|
db_schema = UtilFuncs._extract_db_name(member._table_name)
|
|
182
|
-
# Add quotes around the DB name in case we are getting it using _get_current_databasename()
|
|
182
|
+
# Add quotes around the DB name in case we are getting it using _get_current_databasename().
|
|
183
183
|
db_schema = tdp.quote(_get_current_databasename()) if db_schema is None else db_schema
|
|
184
184
|
db_table_name = UtilFuncs._extract_table_name(member._table_name)
|
|
185
185
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Unpublished work.
|
|
3
|
+
Copyright (c) 2024 by Teradata Corporation. All rights reserved.
|
|
4
|
+
TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
|
|
5
|
+
Primary Owner: gouri.patwardhan@teradata.com
|
|
6
|
+
Secondary Owner: Pradeep.Garre@teradata.com
|
|
7
|
+
This file implements workflow for generating JWT token.
|
|
8
|
+
"""
|
|
9
|
+
import base64
|
|
10
|
+
import jwt
|
|
11
|
+
import time
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
import pathlib
|
|
14
|
+
from teradataml import configure
|
|
15
|
+
|
|
16
|
+
class _AuthWorkflow:
|
|
17
|
+
"""
|
|
18
|
+
Get the JWT token for requested user.
|
|
19
|
+
"""
|
|
20
|
+
def __init__(self, state):
|
|
21
|
+
"""
|
|
22
|
+
DESCRIPTION:
|
|
23
|
+
Constructor to initiate Authentication work flow.
|
|
24
|
+
|
|
25
|
+
PARAMETERS:
|
|
26
|
+
state:
|
|
27
|
+
Required Argument.
|
|
28
|
+
Specifies the dictionary containing following:
|
|
29
|
+
1. "base_url" which is extracted from "ues_url".
|
|
30
|
+
2. "org_id" which is also extracted from "ues_url".
|
|
31
|
+
3. "pat_token" which is obtained from VantageCloud Lake Console, and it is specific to the user.
|
|
32
|
+
4. "pem_file" which is obtained from VantageCloud Lake Console, and it is specific to the user.
|
|
33
|
+
5. "username" which is the DB user.
|
|
34
|
+
5. "expiration_time" which is the expiration time for the token and has a default value of
|
|
35
|
+
31536000 seconds.
|
|
36
|
+
Types: dict
|
|
37
|
+
|
|
38
|
+
RETURNS:
|
|
39
|
+
Instance of _AuthWorkflow.
|
|
40
|
+
|
|
41
|
+
RAISES:
|
|
42
|
+
None
|
|
43
|
+
|
|
44
|
+
EXAMPLES :
|
|
45
|
+
>>> _AuthWorkflow(state)
|
|
46
|
+
"""
|
|
47
|
+
self.state = state
|
|
48
|
+
|
|
49
|
+
def _get_epoch_time(self):
|
|
50
|
+
"""
|
|
51
|
+
DESCRIPTION:
|
|
52
|
+
Generate expiry epoch time.
|
|
53
|
+
|
|
54
|
+
RETURNS:
|
|
55
|
+
float
|
|
56
|
+
"""
|
|
57
|
+
current_epoch_time = int(time.time())
|
|
58
|
+
expiry_epoch_time = current_epoch_time + self.state.get('expiration_time')
|
|
59
|
+
return current_epoch_time, expiry_epoch_time
|
|
60
|
+
|
|
61
|
+
def _generate_header(self):
|
|
62
|
+
"""
|
|
63
|
+
DESCRIPTION:
|
|
64
|
+
Generate JWT header.
|
|
65
|
+
|
|
66
|
+
RETURNS:
|
|
67
|
+
dict
|
|
68
|
+
"""
|
|
69
|
+
# Extract the pem file name without extension.
|
|
70
|
+
kid = pathlib.Path(self.state.get('pem_file')).stem
|
|
71
|
+
header = {
|
|
72
|
+
"alg": "RS256",
|
|
73
|
+
"kid": kid,
|
|
74
|
+
"typ": "JWT"
|
|
75
|
+
}
|
|
76
|
+
return header
|
|
77
|
+
|
|
78
|
+
def _generate_payload(self):
|
|
79
|
+
"""
|
|
80
|
+
DESCRIPTION:
|
|
81
|
+
Generate JWT payload.
|
|
82
|
+
|
|
83
|
+
RETURNS:
|
|
84
|
+
A dictionary with the JWT payload.
|
|
85
|
+
"""
|
|
86
|
+
iat, exp= self._get_epoch_time()
|
|
87
|
+
payload = {
|
|
88
|
+
"aud": [
|
|
89
|
+
"td:service:authentication"
|
|
90
|
+
],
|
|
91
|
+
"iat": iat,
|
|
92
|
+
"exp": exp,
|
|
93
|
+
"iss": "teradataml",
|
|
94
|
+
"multi-use": True,
|
|
95
|
+
"org_id": self.state['org_id'],
|
|
96
|
+
"pat": self.state['pat_token'],
|
|
97
|
+
"sub": self.state['username']
|
|
98
|
+
}
|
|
99
|
+
return payload
|
|
100
|
+
|
|
101
|
+
def _sign_jwt(self, payload, header):
|
|
102
|
+
"""
|
|
103
|
+
DESCRIPTION:
|
|
104
|
+
Encode JWT using private key.
|
|
105
|
+
|
|
106
|
+
PARAMETERS:
|
|
107
|
+
payload:
|
|
108
|
+
Required Argument.
|
|
109
|
+
Specifies the payload required for encoding the JWT token.
|
|
110
|
+
Types: dict
|
|
111
|
+
header:
|
|
112
|
+
Required Argument.
|
|
113
|
+
Specified the header required for encoding the JWT token.
|
|
114
|
+
Types: dict
|
|
115
|
+
|
|
116
|
+
RETURNS:
|
|
117
|
+
str
|
|
118
|
+
"""
|
|
119
|
+
with open(self.state['pem_file'], "r") as f:
|
|
120
|
+
private_key = f.read()
|
|
121
|
+
return jwt.encode(payload=payload, key=private_key, algorithm=header["alg"], headers=header)
|
|
122
|
+
|
|
123
|
+
def _proxy_jwt(self):
|
|
124
|
+
"""
|
|
125
|
+
DESCRIPTION:
|
|
126
|
+
Generate JWT token and add the value in dictionary.
|
|
127
|
+
|
|
128
|
+
RETURNS:
|
|
129
|
+
str
|
|
130
|
+
"""
|
|
131
|
+
jwt = self._sign_jwt(self._generate_payload(), self._generate_header())
|
|
132
|
+
self.state['jwt'] = jwt
|
|
133
|
+
return(jwt)
|
|
@@ -425,7 +425,7 @@ class _DAWorkflow:
|
|
|
425
425
|
"""
|
|
426
426
|
device_cfg = requests.post(
|
|
427
427
|
url=self.device_auth_end_point,
|
|
428
|
-
data={'client_id': self.__client_id})
|
|
428
|
+
data={'client_id': self.__client_id, 'scope': 'openid'})
|
|
429
429
|
|
|
430
430
|
# Check the status. If response is not 200, raise error.
|
|
431
431
|
_Validators._validate_http_response(device_cfg, 200, "get the device metadata")
|
teradataml/common/aed_utils.py
CHANGED
|
@@ -1287,8 +1287,9 @@ class AedUtils:
|
|
|
1287
1287
|
arg_name = ["group by"]
|
|
1288
1288
|
# If option is passed, add prefix of the option to the groupby_expr,
|
|
1289
1289
|
# else, add prefix as empty string.
|
|
1290
|
-
|
|
1291
|
-
|
|
1290
|
+
if isinstance(groupby_expr, str):
|
|
1291
|
+
arg_value = ["{} | {}".format(option, groupby_expr)] if option \
|
|
1292
|
+
else ["{}| {}".format("", groupby_expr)]
|
|
1292
1293
|
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="groupby_", use_default_database=True, quote=False)
|
|
1293
1294
|
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1294
1295
|
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
teradataml/common/constants.py
CHANGED
|
@@ -65,6 +65,7 @@ class TeradataConstants(Enum):
|
|
|
65
65
|
CONTAINER = 5
|
|
66
66
|
TERADATA_TEXT_FILE = 6
|
|
67
67
|
TERADATA_APPLY = 7
|
|
68
|
+
TERADATA_VOLATILE_TABLE = 8
|
|
68
69
|
TABLE_COLUMN_LIMIT = 2048
|
|
69
70
|
TERADATA_JOINS = ["inner", "left", "right", "full", "cross"]
|
|
70
71
|
TERADATA_JOIN_OPERATORS = ['>=', '<=', '<>', '!=', '>', '<', '=']
|
|
@@ -424,6 +425,8 @@ class TableOperatorConstants(Enum):
|
|
|
424
425
|
MAP_TEMPLATE = "dataframe_map.template"
|
|
425
426
|
# Template of the intermediate script that will be generated.
|
|
426
427
|
APPLY_TEMPLATE = "dataframe_apply.template"
|
|
428
|
+
# Template of the intermediate script that will be generated for UDF.
|
|
429
|
+
UDF_TEMPLATE = "dataframe_udf.template"
|
|
427
430
|
# In-DB execution mode.
|
|
428
431
|
INDB_EXEC = "IN-DB"
|
|
429
432
|
# Local execution mode.
|
|
@@ -438,6 +441,8 @@ class TableOperatorConstants(Enum):
|
|
|
438
441
|
MAP_PARTITION_OP = "map_partition"
|
|
439
442
|
# apply operation.
|
|
440
443
|
APPLY_OP = "apply"
|
|
444
|
+
# udf operation.
|
|
445
|
+
UDF_OP = "udf"
|
|
441
446
|
# Template of the script_executor that will be used to generate the temporary script_executor file.
|
|
442
447
|
SCRIPT_TEMPLATE = "script_executor.template"
|
|
443
448
|
# Log Type.
|
|
@@ -463,18 +468,18 @@ class TableOperatorConstants(Enum):
|
|
|
463
468
|
ON (select 1) PARTITION BY ANY
|
|
464
469
|
SCRIPT_COMMAND('{}/bin/pip3 --version')
|
|
465
470
|
returns('package VARCHAR(256)'))
|
|
466
|
-
"""
|
|
471
|
+
"""
|
|
467
472
|
|
|
468
473
|
# Script Query to get Python packages and corresponding versions.
|
|
469
474
|
# Location of In-DB packages is indicated by configure.indb_install_location.
|
|
470
475
|
partial_version_query = "SELECT distinct * FROM SCRIPT( ON (select 1) " \
|
|
471
|
-
"PARTITION BY ANY SCRIPT_COMMAND('{}/bin/pip3 freeze | "
|
|
472
|
-
|
|
473
|
-
PACKAGE_VERSION_QUERY = partial_version_query + "{
|
|
476
|
+
"PARTITION BY ANY SCRIPT_COMMAND('{0}/bin/pip3 freeze | "
|
|
477
|
+
|
|
478
|
+
PACKAGE_VERSION_QUERY = partial_version_query + "{1}awk -F ''=='' " \
|
|
474
479
|
"''{{print $1, $2}}''') " \
|
|
475
480
|
"delimiter(' ') " \
|
|
476
|
-
"returns('package VARCHAR({
|
|
477
|
-
"version VARCHAR({
|
|
481
|
+
"returns('package VARCHAR({2}), " \
|
|
482
|
+
"version VARCHAR({2})'))"
|
|
478
483
|
|
|
479
484
|
class ValibConstants(Enum):
|
|
480
485
|
# A dictionary that maps teradataml name of the exposed VALIB function name
|
|
@@ -1368,6 +1373,7 @@ class TeradataAnalyticFunctionTypes(Enum):
|
|
|
1368
1373
|
UAF = "UAF"
|
|
1369
1374
|
TABLEOPERATOR = "TABLE_OPERATOR"
|
|
1370
1375
|
BYOM = "BYOM"
|
|
1376
|
+
STORED_PROCEDURE = "STORED_PROCEDURE"
|
|
1371
1377
|
|
|
1372
1378
|
|
|
1373
1379
|
class TeradataAnalyticFunctionInfo(Enum):
|
|
@@ -1378,6 +1384,8 @@ class TeradataAnalyticFunctionInfo(Enum):
|
|
|
1378
1384
|
TABLE_OPERATOR = {"func_type": "tableoperator", "lowest_version": "17.00 ",
|
|
1379
1385
|
"display_function_type_name" :"TABLE OPERATOR"}
|
|
1380
1386
|
BYOM = {"func_type": "byom", "lowest_version": None, "display_function_type_name": "BYOM"}
|
|
1387
|
+
STORED_PROCEDURE = {"func_type": "storedprocedure", "lowest_version": "17.20", "display_function_type_name": "UAF",
|
|
1388
|
+
"metadata_class" : "_AnlyFuncMetadataUAF"}
|
|
1381
1389
|
|
|
1382
1390
|
class TeradataUAFSpecificArgs(Enum):
|
|
1383
1391
|
INPUT_MODE = "input_mode"
|
|
@@ -1404,6 +1412,10 @@ class DriverEscapeFunctions(Enum):
|
|
|
1404
1412
|
WRITE_TO_CSV = "{{fn teradata_write_csv({0})}}"
|
|
1405
1413
|
FIELD_QUOTE = "{{fn teradata_field_quote({0})}}"
|
|
1406
1414
|
FIELD_SEP = "{{fn teradata_field_sep({0})}}"
|
|
1415
|
+
ERR_TBL_1 = "{{fn teradata_error_table_1_suffix({0})}}"
|
|
1416
|
+
ERR_TBL_2 = "{{fn teradata_error_table_2_suffix({0})}}"
|
|
1417
|
+
ERR_STAGING_DB = "{{fn teradata_error_table_database({0})}}"
|
|
1418
|
+
ERR_TBL_MNG_FLAG = "{{fn teradata_manage_error_tables_{0}}}"
|
|
1407
1419
|
|
|
1408
1420
|
|
|
1409
1421
|
class HTTPRequest(Enum):
|
|
@@ -1431,3 +1443,33 @@ class CloudProvider(Enum):
|
|
|
1431
1443
|
# and '2018-03-28', using the latest one.
|
|
1432
1444
|
X_MS_VERSION = "2019-12-12"
|
|
1433
1445
|
X_MS_BLOB_TYPE = "BlockBlob"
|
|
1446
|
+
|
|
1447
|
+
class SessionParamsSQL:
|
|
1448
|
+
# Holds the SQL Statements for Session params.
|
|
1449
|
+
TIMEZONE = "SET TIME ZONE {}"
|
|
1450
|
+
ACCOUNT = "SET SESSION ACCOUNT = '{}' FOR {}"
|
|
1451
|
+
CALENDAR = "SET SESSION CALENDAR = {}"
|
|
1452
|
+
CHARACTER_SET_UNICODE = "SET SESSION CHARACTER SET UNICODE PASS THROUGH {}"
|
|
1453
|
+
COLLATION = "SET SESSION COLLATION {}"
|
|
1454
|
+
CONSTRAINT = "SET SESSION CONSTRAINT = {}"
|
|
1455
|
+
DATABASE = "SET SESSION DATABASE {}"
|
|
1456
|
+
DATEFORM = "SET SESSION DATEFORM = {}"
|
|
1457
|
+
DEBUG_FUNCTION = "SET SESSION DEBUG FUNCTION {} {}"
|
|
1458
|
+
DOT_NOTATION = "SET SESSION DOT NOTATION {} ON ERROR"
|
|
1459
|
+
ISOLATED_LOADING = "SET SESSION FOR {} ISOLATED LOADING"
|
|
1460
|
+
FUNCTION_TRACE = "SET SESSION FUNCTION TRACE USING {} FOR TABLE {}"
|
|
1461
|
+
JSON_IGNORE_ERRORS = "SET SESSION JSON IGNORE ERRORS {}"
|
|
1462
|
+
SEARCHUIFDBPATH = "SET SESSION SEARCHUIFDBPATH = {}"
|
|
1463
|
+
TRANSACTION_ISOLATION_LEVEL = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL {}"
|
|
1464
|
+
QUERY_BAND = "SET QUERY_BAND = {} FOR {}"
|
|
1465
|
+
UDFSEARCHPATH = "SET SESSION UDFSEARCHPATH = {} FOR FUNCTION = {}"
|
|
1466
|
+
|
|
1467
|
+
class SessionParamsPythonNames:
|
|
1468
|
+
# Holds the SQL Statements for Session params.
|
|
1469
|
+
TIMEZONE = "Session Time Zone"
|
|
1470
|
+
ACCOUNT = "Account Name"
|
|
1471
|
+
CALENDAR = "Calendar"
|
|
1472
|
+
COLLATION = "Collation"
|
|
1473
|
+
DATABASE = "Current DataBase"
|
|
1474
|
+
DATEFORM = 'Current DateForm'
|
|
1475
|
+
|
|
@@ -87,13 +87,19 @@ def argument_deprecation(tdml_version, deprecated_arguments, behaviour=False, al
|
|
|
87
87
|
|
|
88
88
|
def decorator(func):
|
|
89
89
|
def wrapper(*args, **kwargs):
|
|
90
|
-
|
|
91
|
-
if
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
# Check if deprecated arguments is a list, if not convert it to a list
|
|
91
|
+
deprecated_args_list = deprecated_arguments if isinstance(deprecated_arguments, list) \
|
|
92
|
+
else [deprecated_arguments]
|
|
93
|
+
# Check list of deprecated arguments are used in the function call
|
|
94
|
+
deprecated_arguments_used = [arg for arg in deprecated_args_list if arg in kwargs]
|
|
95
|
+
if deprecated_arguments_used:
|
|
96
|
+
msg = "\nThe argument(s) \"{}\" will be deprecated in {}."
|
|
97
|
+
if behaviour:
|
|
98
|
+
msg = "\nBehaviour of the argument(s) \"{}\" will change in {}."
|
|
99
|
+
msg = msg.format(deprecated_arguments_used, tdml_version)
|
|
100
|
+
if alternatives is not None:
|
|
101
|
+
msg += "\nUse argument(s) \"{}\" instead.".format(alternatives)
|
|
102
|
+
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
|
|
97
103
|
return func(*args, **kwargs)
|
|
98
104
|
|
|
99
105
|
return wraps(func)(wrapper)
|