teradataml 17.20.0.7__py3-none-any.whl → 20.0.0.0__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 +1864 -1640
- teradataml/__init__.py +70 -60
- teradataml/_version.py +11 -11
- teradataml/analytics/Transformations.py +2995 -2995
- teradataml/analytics/__init__.py +81 -83
- teradataml/analytics/analytic_function_executor.py +2013 -2010
- teradataml/analytics/analytic_query_generator.py +958 -958
- teradataml/analytics/byom/H2OPredict.py +514 -514
- teradataml/analytics/byom/PMMLPredict.py +437 -437
- teradataml/analytics/byom/__init__.py +14 -14
- teradataml/analytics/json_parser/__init__.py +130 -130
- teradataml/analytics/json_parser/analytic_functions_argument.py +1707 -1707
- teradataml/analytics/json_parser/json_store.py +191 -191
- teradataml/analytics/json_parser/metadata.py +1637 -1637
- teradataml/analytics/json_parser/utils.py +804 -803
- teradataml/analytics/meta_class.py +196 -196
- teradataml/analytics/sqle/DecisionTreePredict.py +455 -470
- teradataml/analytics/sqle/NaiveBayesPredict.py +419 -428
- teradataml/analytics/sqle/__init__.py +97 -110
- teradataml/analytics/sqle/json/decisiontreepredict_sqle.json +78 -78
- teradataml/analytics/sqle/json/naivebayespredict_sqle.json +62 -62
- teradataml/analytics/table_operator/__init__.py +10 -10
- teradataml/analytics/uaf/__init__.py +63 -63
- teradataml/analytics/utils.py +693 -692
- teradataml/analytics/valib.py +1603 -1600
- teradataml/automl/__init__.py +1628 -0
- teradataml/automl/custom_json_utils.py +1270 -0
- teradataml/automl/data_preparation.py +993 -0
- teradataml/automl/data_transformation.py +727 -0
- teradataml/automl/feature_engineering.py +1648 -0
- teradataml/automl/feature_exploration.py +547 -0
- teradataml/automl/model_evaluation.py +163 -0
- teradataml/automl/model_training.py +887 -0
- teradataml/catalog/__init__.py +1 -3
- teradataml/catalog/byom.py +1759 -1716
- teradataml/catalog/function_argument_mapper.py +859 -861
- teradataml/catalog/model_cataloging_utils.py +491 -1510
- teradataml/clients/pkce_client.py +481 -481
- teradataml/common/aed_utils.py +6 -2
- teradataml/common/bulk_exposed_utils.py +111 -111
- teradataml/common/constants.py +1433 -1441
- teradataml/common/deprecations.py +160 -0
- teradataml/common/exceptions.py +73 -73
- teradataml/common/formula.py +742 -742
- teradataml/common/garbagecollector.py +592 -635
- teradataml/common/messagecodes.py +422 -431
- teradataml/common/messages.py +227 -231
- teradataml/common/sqlbundle.py +693 -693
- teradataml/common/td_coltype_code_to_tdtype.py +48 -48
- teradataml/common/utils.py +2418 -2500
- teradataml/common/warnings.py +25 -25
- teradataml/common/wrapper_utils.py +1 -110
- teradataml/config/dummy_file1.cfg +4 -4
- teradataml/config/dummy_file2.cfg +2 -2
- teradataml/config/sqlengine_alias_definitions_v1.0 +13 -13
- teradataml/config/sqlengine_alias_definitions_v1.1 +19 -19
- teradataml/config/sqlengine_alias_definitions_v1.3 +18 -18
- teradataml/context/aed_context.py +217 -217
- teradataml/context/context.py +1071 -999
- teradataml/data/A_loan.csv +19 -19
- teradataml/data/BINARY_REALS_LEFT.csv +11 -11
- teradataml/data/BINARY_REALS_RIGHT.csv +11 -11
- teradataml/data/B_loan.csv +49 -49
- teradataml/data/BuoyData2.csv +17 -17
- teradataml/data/CONVOLVE2_COMPLEX_LEFT.csv +5 -5
- teradataml/data/CONVOLVE2_COMPLEX_RIGHT.csv +5 -5
- teradataml/data/Convolve2RealsLeft.csv +5 -5
- teradataml/data/Convolve2RealsRight.csv +5 -5
- teradataml/data/Convolve2ValidLeft.csv +11 -11
- teradataml/data/Convolve2ValidRight.csv +11 -11
- teradataml/data/DFFTConv_Real_8_8.csv +65 -65
- teradataml/data/Orders1_12mf.csv +24 -24
- teradataml/data/Pi_loan.csv +7 -7
- teradataml/data/SMOOTHED_DATA.csv +7 -7
- teradataml/data/TestDFFT8.csv +9 -9
- teradataml/data/TestRiver.csv +109 -109
- teradataml/data/Traindata.csv +28 -28
- teradataml/data/acf.csv +17 -17
- teradataml/data/adaboost_example.json +34 -34
- teradataml/data/adaboostpredict_example.json +24 -24
- teradataml/data/additional_table.csv +10 -10
- teradataml/data/admissions_test.csv +21 -21
- teradataml/data/admissions_train.csv +41 -41
- teradataml/data/admissions_train_nulls.csv +41 -41
- teradataml/data/ageandheight.csv +13 -13
- teradataml/data/ageandpressure.csv +31 -31
- teradataml/data/antiselect_example.json +36 -36
- teradataml/data/antiselect_input.csv +8 -8
- teradataml/data/antiselect_input_mixed_case.csv +8 -8
- teradataml/data/applicant_external.csv +6 -6
- teradataml/data/applicant_reference.csv +6 -6
- teradataml/data/arima_example.json +9 -9
- teradataml/data/assortedtext_input.csv +8 -8
- teradataml/data/attribution_example.json +33 -33
- teradataml/data/attribution_sample_table.csv +27 -27
- teradataml/data/attribution_sample_table1.csv +6 -6
- teradataml/data/attribution_sample_table2.csv +11 -11
- teradataml/data/bank_churn.csv +10001 -0
- teradataml/data/bank_web_clicks1.csv +42 -42
- teradataml/data/bank_web_clicks2.csv +91 -91
- teradataml/data/bank_web_url.csv +85 -85
- teradataml/data/barrier.csv +2 -2
- teradataml/data/barrier_new.csv +3 -3
- teradataml/data/betweenness_example.json +13 -13
- teradataml/data/bin_breaks.csv +8 -8
- teradataml/data/bin_fit_ip.csv +3 -3
- teradataml/data/binary_complex_left.csv +11 -11
- teradataml/data/binary_complex_right.csv +11 -11
- teradataml/data/binary_matrix_complex_left.csv +21 -21
- teradataml/data/binary_matrix_complex_right.csv +21 -21
- teradataml/data/binary_matrix_real_left.csv +21 -21
- teradataml/data/binary_matrix_real_right.csv +21 -21
- teradataml/data/blood2ageandweight.csv +26 -26
- teradataml/data/bmi.csv +501 -0
- teradataml/data/boston.csv +507 -507
- teradataml/data/buoydata_mix.csv +11 -11
- teradataml/data/burst_data.csv +5 -5
- teradataml/data/burst_example.json +20 -20
- teradataml/data/byom_example.json +17 -17
- teradataml/data/bytes_table.csv +3 -3
- teradataml/data/cal_housing_ex_raw.csv +70 -70
- teradataml/data/callers.csv +7 -7
- teradataml/data/calls.csv +10 -10
- teradataml/data/cars_hist.csv +33 -33
- teradataml/data/cat_table.csv +24 -24
- teradataml/data/ccm_example.json +31 -31
- teradataml/data/ccm_input.csv +91 -91
- teradataml/data/ccm_input2.csv +13 -13
- teradataml/data/ccmexample.csv +101 -101
- teradataml/data/ccmprepare_example.json +8 -8
- teradataml/data/ccmprepare_input.csv +91 -91
- teradataml/data/cfilter_example.json +12 -12
- teradataml/data/changepointdetection_example.json +18 -18
- teradataml/data/changepointdetectionrt_example.json +8 -8
- teradataml/data/chi_sq.csv +2 -2
- teradataml/data/churn_data.csv +14 -14
- teradataml/data/churn_emission.csv +35 -35
- teradataml/data/churn_initial.csv +3 -3
- teradataml/data/churn_state_transition.csv +5 -5
- teradataml/data/citedges_2.csv +745 -745
- teradataml/data/citvertices_2.csv +1210 -1210
- teradataml/data/clicks2.csv +16 -16
- teradataml/data/clickstream.csv +12 -12
- teradataml/data/clickstream1.csv +11 -11
- teradataml/data/closeness_example.json +15 -15
- teradataml/data/complaints.csv +21 -21
- teradataml/data/complaints_mini.csv +3 -3
- teradataml/data/complaints_testtoken.csv +224 -224
- teradataml/data/complaints_tokens_test.csv +353 -353
- teradataml/data/complaints_traintoken.csv +472 -472
- teradataml/data/computers_category.csv +1001 -1001
- teradataml/data/computers_test1.csv +1252 -1252
- teradataml/data/computers_train1.csv +5009 -5009
- teradataml/data/computers_train1_clustered.csv +5009 -5009
- teradataml/data/confusionmatrix_example.json +9 -9
- teradataml/data/conversion_event_table.csv +3 -3
- teradataml/data/corr_input.csv +17 -17
- teradataml/data/correlation_example.json +11 -11
- teradataml/data/coxhazardratio_example.json +39 -39
- teradataml/data/coxph_example.json +15 -15
- teradataml/data/coxsurvival_example.json +28 -28
- teradataml/data/cpt.csv +41 -41
- teradataml/data/credit_ex_merged.csv +45 -45
- teradataml/data/customer_loyalty.csv +301 -301
- teradataml/data/customer_loyalty_newseq.csv +31 -31
- teradataml/data/dataframe_example.json +146 -146
- teradataml/data/decisionforest_example.json +37 -37
- teradataml/data/decisionforestpredict_example.json +38 -38
- teradataml/data/decisiontree_example.json +21 -21
- teradataml/data/decisiontreepredict_example.json +45 -45
- teradataml/data/dfft2_size4_real.csv +17 -17
- teradataml/data/dfft2_test_matrix16.csv +17 -17
- teradataml/data/dfft2conv_real_4_4.csv +65 -65
- teradataml/data/diabetes.csv +443 -443
- teradataml/data/diabetes_test.csv +89 -89
- teradataml/data/dict_table.csv +5 -5
- teradataml/data/docperterm_table.csv +4 -4
- teradataml/data/docs/__init__.py +1 -1
- teradataml/data/docs/byom/docs/DataRobotPredict.py +180 -180
- teradataml/data/docs/byom/docs/DataikuPredict.py +177 -177
- teradataml/data/docs/byom/docs/H2OPredict.py +324 -324
- teradataml/data/docs/byom/docs/ONNXPredict.py +283 -283
- teradataml/data/docs/byom/docs/PMMLPredict.py +277 -277
- teradataml/data/docs/sqle/docs_17_10/Antiselect.py +82 -82
- teradataml/data/docs/sqle/docs_17_10/Attribution.py +199 -199
- teradataml/data/docs/sqle/docs_17_10/BincodeFit.py +171 -171
- teradataml/data/docs/sqle/docs_17_10/BincodeTransform.py +131 -130
- teradataml/data/docs/sqle/docs_17_10/CategoricalSummary.py +86 -86
- teradataml/data/docs/sqle/docs_17_10/ChiSq.py +90 -90
- teradataml/data/docs/sqle/docs_17_10/ColumnSummary.py +85 -85
- teradataml/data/docs/sqle/docs_17_10/ConvertTo.py +95 -95
- teradataml/data/docs/sqle/docs_17_10/DecisionForestPredict.py +139 -139
- teradataml/data/docs/sqle/docs_17_10/DecisionTreePredict.py +151 -151
- teradataml/data/docs/sqle/docs_17_10/FTest.py +160 -160
- teradataml/data/docs/sqle/docs_17_10/FillRowId.py +82 -82
- teradataml/data/docs/sqle/docs_17_10/Fit.py +87 -87
- teradataml/data/docs/sqle/docs_17_10/GLMPredict.py +144 -144
- teradataml/data/docs/sqle/docs_17_10/GetRowsWithMissingValues.py +84 -84
- teradataml/data/docs/sqle/docs_17_10/GetRowsWithoutMissingValues.py +81 -81
- teradataml/data/docs/sqle/docs_17_10/Histogram.py +164 -164
- teradataml/data/docs/sqle/docs_17_10/MovingAverage.py +134 -134
- teradataml/data/docs/sqle/docs_17_10/NGramSplitter.py +208 -208
- teradataml/data/docs/sqle/docs_17_10/NPath.py +265 -265
- teradataml/data/docs/sqle/docs_17_10/NaiveBayesPredict.py +116 -116
- teradataml/data/docs/sqle/docs_17_10/NaiveBayesTextClassifierPredict.py +176 -176
- teradataml/data/docs/sqle/docs_17_10/NumApply.py +147 -147
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +132 -132
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +103 -103
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterFit.py +165 -165
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +101 -101
- teradataml/data/docs/sqle/docs_17_10/Pack.py +128 -128
- teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesFit.py +111 -111
- teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesTransform.py +102 -102
- teradataml/data/docs/sqle/docs_17_10/QQNorm.py +104 -104
- teradataml/data/docs/sqle/docs_17_10/RoundColumns.py +109 -109
- teradataml/data/docs/sqle/docs_17_10/RowNormalizeFit.py +117 -117
- teradataml/data/docs/sqle/docs_17_10/RowNormalizeTransform.py +99 -98
- teradataml/data/docs/sqle/docs_17_10/SVMSparsePredict.py +152 -152
- teradataml/data/docs/sqle/docs_17_10/ScaleFit.py +197 -197
- teradataml/data/docs/sqle/docs_17_10/ScaleTransform.py +99 -98
- teradataml/data/docs/sqle/docs_17_10/Sessionize.py +113 -113
- teradataml/data/docs/sqle/docs_17_10/SimpleImputeFit.py +116 -116
- teradataml/data/docs/sqle/docs_17_10/SimpleImputeTransform.py +98 -98
- teradataml/data/docs/sqle/docs_17_10/StrApply.py +187 -187
- teradataml/data/docs/sqle/docs_17_10/StringSimilarity.py +145 -145
- teradataml/data/docs/sqle/docs_17_10/Transform.py +105 -104
- teradataml/data/docs/sqle/docs_17_10/UnivariateStatistics.py +141 -141
- teradataml/data/docs/sqle/docs_17_10/Unpack.py +214 -214
- teradataml/data/docs/sqle/docs_17_10/WhichMax.py +83 -83
- teradataml/data/docs/sqle/docs_17_10/WhichMin.py +83 -83
- teradataml/data/docs/sqle/docs_17_10/ZTest.py +155 -155
- teradataml/data/docs/sqle/docs_17_20/ANOVA.py +126 -126
- teradataml/data/docs/sqle/docs_17_20/Antiselect.py +82 -82
- teradataml/data/docs/sqle/docs_17_20/Attribution.py +200 -200
- teradataml/data/docs/sqle/docs_17_20/BincodeFit.py +171 -171
- teradataml/data/docs/sqle/docs_17_20/BincodeTransform.py +139 -138
- teradataml/data/docs/sqle/docs_17_20/CategoricalSummary.py +86 -86
- teradataml/data/docs/sqle/docs_17_20/ChiSq.py +90 -90
- teradataml/data/docs/sqle/docs_17_20/ClassificationEvaluator.py +166 -166
- teradataml/data/docs/sqle/docs_17_20/ColumnSummary.py +85 -85
- teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +243 -243
- teradataml/data/docs/sqle/docs_17_20/ConvertTo.py +113 -113
- teradataml/data/docs/sqle/docs_17_20/DecisionForest.py +279 -279
- teradataml/data/docs/sqle/docs_17_20/DecisionForestPredict.py +144 -144
- teradataml/data/docs/sqle/docs_17_20/DecisionTreePredict.py +135 -135
- teradataml/data/docs/sqle/docs_17_20/FTest.py +160 -160
- teradataml/data/docs/sqle/docs_17_20/FillRowId.py +82 -82
- teradataml/data/docs/sqle/docs_17_20/Fit.py +87 -87
- teradataml/data/docs/sqle/docs_17_20/GLM.py +380 -380
- teradataml/data/docs/sqle/docs_17_20/GLMPerSegment.py +414 -414
- teradataml/data/docs/sqle/docs_17_20/GLMPredict.py +144 -144
- teradataml/data/docs/sqle/docs_17_20/GLMPredictPerSegment.py +233 -234
- teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +123 -123
- teradataml/data/docs/sqle/docs_17_20/GetRowsWithMissingValues.py +108 -108
- teradataml/data/docs/sqle/docs_17_20/GetRowsWithoutMissingValues.py +105 -105
- teradataml/data/docs/sqle/docs_17_20/Histogram.py +223 -223
- teradataml/data/docs/sqle/docs_17_20/KMeans.py +204 -204
- teradataml/data/docs/sqle/docs_17_20/KMeansPredict.py +144 -143
- teradataml/data/docs/sqle/docs_17_20/KNN.py +214 -214
- teradataml/data/docs/sqle/docs_17_20/MovingAverage.py +134 -134
- teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +208 -208
- teradataml/data/docs/sqle/docs_17_20/NPath.py +265 -265
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesPredict.py +116 -116
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierPredict.py +177 -176
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierTrainer.py +126 -126
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +117 -117
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineTransform.py +112 -112
- teradataml/data/docs/sqle/docs_17_20/NumApply.py +147 -147
- teradataml/data/docs/sqle/docs_17_20/OneClassSVM.py +307 -307
- teradataml/data/docs/sqle/docs_17_20/OneClassSVMPredict.py +185 -184
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +225 -225
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +115 -115
- teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingFit.py +219 -219
- teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingTransform.py +127 -127
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +189 -189
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterTransform.py +117 -112
- teradataml/data/docs/sqle/docs_17_20/Pack.py +128 -128
- teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesFit.py +111 -111
- teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesTransform.py +112 -111
- teradataml/data/docs/sqle/docs_17_20/QQNorm.py +104 -104
- teradataml/data/docs/sqle/docs_17_20/ROC.py +163 -163
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionFit.py +154 -154
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionMinComponents.py +106 -106
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionTransform.py +120 -120
- teradataml/data/docs/sqle/docs_17_20/RegressionEvaluator.py +211 -211
- teradataml/data/docs/sqle/docs_17_20/RoundColumns.py +108 -108
- teradataml/data/docs/sqle/docs_17_20/RowNormalizeFit.py +117 -117
- teradataml/data/docs/sqle/docs_17_20/RowNormalizeTransform.py +111 -110
- teradataml/data/docs/sqle/docs_17_20/SVM.py +413 -413
- teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +202 -202
- teradataml/data/docs/sqle/docs_17_20/SVMSparsePredict.py +152 -152
- teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +197 -197
- teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +110 -109
- teradataml/data/docs/sqle/docs_17_20/SentimentExtractor.py +206 -206
- teradataml/data/docs/sqle/docs_17_20/Sessionize.py +113 -113
- teradataml/data/docs/sqle/docs_17_20/Silhouette.py +152 -152
- teradataml/data/docs/sqle/docs_17_20/SimpleImputeFit.py +116 -116
- teradataml/data/docs/sqle/docs_17_20/SimpleImputeTransform.py +109 -108
- teradataml/data/docs/sqle/docs_17_20/StrApply.py +187 -187
- teradataml/data/docs/sqle/docs_17_20/StringSimilarity.py +145 -145
- teradataml/data/docs/sqle/docs_17_20/TDDecisionForestPredict.py +207 -207
- teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +171 -171
- teradataml/data/docs/sqle/docs_17_20/TargetEncodingFit.py +266 -266
- teradataml/data/docs/sqle/docs_17_20/TargetEncodingTransform.py +141 -140
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +172 -172
- teradataml/data/docs/sqle/docs_17_20/TrainTestSplit.py +159 -159
- teradataml/data/docs/sqle/docs_17_20/Transform.py +123 -123
- teradataml/data/docs/sqle/docs_17_20/UnivariateStatistics.py +141 -141
- teradataml/data/docs/sqle/docs_17_20/Unpack.py +214 -214
- teradataml/data/docs/sqle/docs_17_20/VectorDistance.py +168 -168
- teradataml/data/docs/sqle/docs_17_20/WhichMax.py +83 -83
- teradataml/data/docs/sqle/docs_17_20/WhichMin.py +83 -83
- teradataml/data/docs/sqle/docs_17_20/WordEmbeddings.py +236 -236
- teradataml/data/docs/sqle/docs_17_20/XGBoost.py +353 -353
- teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +275 -275
- teradataml/data/docs/sqle/docs_17_20/ZTest.py +155 -155
- teradataml/data/docs/tableoperator/docs_17_00/ReadNOS.py +429 -429
- teradataml/data/docs/tableoperator/docs_17_05/ReadNOS.py +429 -429
- teradataml/data/docs/tableoperator/docs_17_05/WriteNOS.py +347 -347
- teradataml/data/docs/tableoperator/docs_17_10/ReadNOS.py +428 -428
- teradataml/data/docs/tableoperator/docs_17_10/WriteNOS.py +347 -347
- teradataml/data/docs/tableoperator/docs_17_20/ReadNOS.py +439 -439
- teradataml/data/docs/tableoperator/docs_17_20/WriteNOS.py +386 -386
- teradataml/data/docs/uaf/docs_17_20/ACF.py +195 -195
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +369 -369
- teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +142 -142
- teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +159 -159
- teradataml/data/docs/uaf/docs_17_20/BinaryMatrixOp.py +247 -247
- teradataml/data/docs/uaf/docs_17_20/BinarySeriesOp.py +252 -252
- teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +177 -177
- teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +174 -174
- teradataml/data/docs/uaf/docs_17_20/Convolve.py +226 -226
- teradataml/data/docs/uaf/docs_17_20/Convolve2.py +214 -214
- teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +183 -183
- teradataml/data/docs/uaf/docs_17_20/DFFT.py +203 -203
- teradataml/data/docs/uaf/docs_17_20/DFFT2.py +216 -216
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +215 -215
- teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +191 -191
- teradataml/data/docs/uaf/docs_17_20/DTW.py +179 -179
- teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +144 -144
- teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +183 -183
- teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +184 -184
- teradataml/data/docs/uaf/docs_17_20/FitMetrics.py +172 -172
- teradataml/data/docs/uaf/docs_17_20/GenseriesFormula.py +205 -205
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +142 -142
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +258 -258
- teradataml/data/docs/uaf/docs_17_20/IDFFT.py +164 -164
- teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +198 -198
- teradataml/data/docs/uaf/docs_17_20/InputValidator.py +120 -120
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +155 -155
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +214 -214
- teradataml/data/docs/uaf/docs_17_20/MAMean.py +173 -173
- teradataml/data/docs/uaf/docs_17_20/MInfo.py +133 -133
- teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +135 -135
- teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +190 -190
- teradataml/data/docs/uaf/docs_17_20/PACF.py +158 -158
- teradataml/data/docs/uaf/docs_17_20/Portman.py +216 -216
- teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +154 -154
- teradataml/data/docs/uaf/docs_17_20/Resample.py +228 -228
- teradataml/data/docs/uaf/docs_17_20/SInfo.py +122 -122
- teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +165 -165
- teradataml/data/docs/uaf/docs_17_20/SelectionCriteria.py +173 -173
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +170 -170
- teradataml/data/docs/uaf/docs_17_20/SignifResidmean.py +163 -163
- teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +179 -179
- teradataml/data/docs/uaf/docs_17_20/Smoothma.py +207 -207
- teradataml/data/docs/uaf/docs_17_20/TrackingOp.py +150 -150
- teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +171 -171
- teradataml/data/docs/uaf/docs_17_20/Unnormalize.py +201 -201
- teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +169 -169
- teradataml/data/dtw_example.json +17 -17
- teradataml/data/dtw_t1.csv +11 -11
- teradataml/data/dtw_t2.csv +4 -4
- teradataml/data/dwt2d_example.json +15 -15
- teradataml/data/dwt_example.json +14 -14
- teradataml/data/dwt_filter_dim.csv +5 -5
- teradataml/data/emission.csv +9 -9
- teradataml/data/emp_table_by_dept.csv +19 -19
- teradataml/data/employee_info.csv +4 -4
- teradataml/data/employee_table.csv +6 -6
- teradataml/data/excluding_event_table.csv +2 -2
- teradataml/data/finance_data.csv +6 -6
- teradataml/data/finance_data2.csv +61 -61
- teradataml/data/finance_data3.csv +93 -93
- teradataml/data/fish.csv +160 -0
- teradataml/data/fm_blood2ageandweight.csv +26 -26
- teradataml/data/fmeasure_example.json +11 -11
- teradataml/data/followers_leaders.csv +10 -10
- teradataml/data/fpgrowth_example.json +12 -12
- teradataml/data/frequentpaths_example.json +29 -29
- teradataml/data/friends.csv +9 -9
- teradataml/data/fs_input.csv +33 -33
- teradataml/data/fs_input1.csv +33 -33
- teradataml/data/genData.csv +513 -513
- teradataml/data/geodataframe_example.json +39 -39
- teradataml/data/glass_types.csv +215 -0
- teradataml/data/glm_admissions_model.csv +12 -12
- teradataml/data/glm_example.json +29 -29
- teradataml/data/glml1l2_example.json +28 -28
- teradataml/data/glml1l2predict_example.json +54 -54
- teradataml/data/glmpredict_example.json +54 -54
- teradataml/data/gq_t1.csv +21 -21
- teradataml/data/hconvolve_complex_right.csv +5 -5
- teradataml/data/hconvolve_complex_rightmulti.csv +5 -5
- teradataml/data/histogram_example.json +11 -11
- teradataml/data/hmmdecoder_example.json +78 -78
- teradataml/data/hmmevaluator_example.json +24 -24
- teradataml/data/hmmsupervised_example.json +10 -10
- teradataml/data/hmmunsupervised_example.json +7 -7
- teradataml/data/house_values.csv +12 -12
- teradataml/data/house_values2.csv +13 -13
- teradataml/data/housing_cat.csv +7 -7
- teradataml/data/housing_data.csv +9 -9
- teradataml/data/housing_test.csv +47 -47
- teradataml/data/housing_test_binary.csv +47 -47
- teradataml/data/housing_train.csv +493 -493
- teradataml/data/housing_train_attribute.csv +4 -4
- teradataml/data/housing_train_binary.csv +437 -437
- teradataml/data/housing_train_parameter.csv +2 -2
- teradataml/data/housing_train_response.csv +493 -493
- teradataml/data/ibm_stock.csv +370 -370
- teradataml/data/ibm_stock1.csv +370 -370
- teradataml/data/identitymatch_example.json +21 -21
- teradataml/data/idf_table.csv +4 -4
- teradataml/data/impressions.csv +101 -101
- teradataml/data/inflation.csv +21 -21
- teradataml/data/initial.csv +3 -3
- teradataml/data/insect_sprays.csv +12 -12
- teradataml/data/insurance.csv +1339 -1339
- teradataml/data/interpolator_example.json +12 -12
- teradataml/data/iris_altinput.csv +481 -481
- teradataml/data/iris_attribute_output.csv +8 -8
- teradataml/data/iris_attribute_test.csv +121 -121
- teradataml/data/iris_attribute_train.csv +481 -481
- teradataml/data/iris_category_expect_predict.csv +31 -31
- teradataml/data/iris_data.csv +151 -0
- teradataml/data/iris_input.csv +151 -151
- teradataml/data/iris_response_train.csv +121 -121
- teradataml/data/iris_test.csv +31 -31
- teradataml/data/iris_train.csv +121 -121
- teradataml/data/join_table1.csv +4 -4
- teradataml/data/join_table2.csv +4 -4
- teradataml/data/jsons/anly_function_name.json +6 -6
- teradataml/data/jsons/byom/dataikupredict.json +147 -147
- teradataml/data/jsons/byom/datarobotpredict.json +146 -146
- teradataml/data/jsons/byom/h2opredict.json +194 -194
- teradataml/data/jsons/byom/onnxpredict.json +186 -186
- teradataml/data/jsons/byom/pmmlpredict.json +146 -146
- teradataml/data/jsons/paired_functions.json +435 -435
- teradataml/data/jsons/sqle/16.20/Antiselect.json +56 -56
- teradataml/data/jsons/sqle/16.20/Attribution.json +249 -249
- teradataml/data/jsons/sqle/16.20/DecisionForestPredict.json +156 -156
- teradataml/data/jsons/sqle/16.20/DecisionTreePredict.json +170 -170
- teradataml/data/jsons/sqle/16.20/GLMPredict.json +122 -122
- teradataml/data/jsons/sqle/16.20/MovingAverage.json +367 -367
- teradataml/data/jsons/sqle/16.20/NGramSplitter.json +239 -239
- teradataml/data/jsons/sqle/16.20/NaiveBayesPredict.json +136 -136
- teradataml/data/jsons/sqle/16.20/NaiveBayesTextClassifierPredict.json +235 -235
- teradataml/data/jsons/sqle/16.20/Pack.json +98 -98
- teradataml/data/jsons/sqle/16.20/SVMSparsePredict.json +162 -162
- teradataml/data/jsons/sqle/16.20/Sessionize.json +105 -105
- teradataml/data/jsons/sqle/16.20/StringSimilarity.json +86 -86
- teradataml/data/jsons/sqle/16.20/Unpack.json +166 -166
- teradataml/data/jsons/sqle/16.20/nPath.json +269 -269
- teradataml/data/jsons/sqle/17.00/Antiselect.json +56 -56
- teradataml/data/jsons/sqle/17.00/Attribution.json +249 -249
- teradataml/data/jsons/sqle/17.00/DecisionForestPredict.json +156 -156
- teradataml/data/jsons/sqle/17.00/DecisionTreePredict.json +170 -170
- teradataml/data/jsons/sqle/17.00/GLMPredict.json +122 -122
- teradataml/data/jsons/sqle/17.00/MovingAverage.json +367 -367
- teradataml/data/jsons/sqle/17.00/NGramSplitter.json +239 -239
- teradataml/data/jsons/sqle/17.00/NaiveBayesPredict.json +136 -136
- teradataml/data/jsons/sqle/17.00/NaiveBayesTextClassifierPredict.json +235 -235
- teradataml/data/jsons/sqle/17.00/Pack.json +98 -98
- teradataml/data/jsons/sqle/17.00/SVMSparsePredict.json +162 -162
- teradataml/data/jsons/sqle/17.00/Sessionize.json +105 -105
- teradataml/data/jsons/sqle/17.00/StringSimilarity.json +86 -86
- teradataml/data/jsons/sqle/17.00/Unpack.json +166 -166
- teradataml/data/jsons/sqle/17.00/nPath.json +269 -269
- teradataml/data/jsons/sqle/17.05/Antiselect.json +56 -56
- teradataml/data/jsons/sqle/17.05/Attribution.json +249 -249
- teradataml/data/jsons/sqle/17.05/DecisionForestPredict.json +156 -156
- teradataml/data/jsons/sqle/17.05/DecisionTreePredict.json +170 -170
- teradataml/data/jsons/sqle/17.05/GLMPredict.json +122 -122
- teradataml/data/jsons/sqle/17.05/MovingAverage.json +367 -367
- teradataml/data/jsons/sqle/17.05/NGramSplitter.json +239 -239
- teradataml/data/jsons/sqle/17.05/NaiveBayesPredict.json +136 -136
- teradataml/data/jsons/sqle/17.05/NaiveBayesTextClassifierPredict.json +235 -235
- teradataml/data/jsons/sqle/17.05/Pack.json +98 -98
- teradataml/data/jsons/sqle/17.05/SVMSparsePredict.json +162 -162
- teradataml/data/jsons/sqle/17.05/Sessionize.json +105 -105
- teradataml/data/jsons/sqle/17.05/StringSimilarity.json +86 -86
- teradataml/data/jsons/sqle/17.05/Unpack.json +166 -166
- teradataml/data/jsons/sqle/17.05/nPath.json +269 -269
- teradataml/data/jsons/sqle/17.10/Antiselect.json +56 -56
- teradataml/data/jsons/sqle/17.10/Attribution.json +249 -249
- teradataml/data/jsons/sqle/17.10/DecisionForestPredict.json +185 -185
- teradataml/data/jsons/sqle/17.10/DecisionTreePredict.json +171 -171
- teradataml/data/jsons/sqle/17.10/GLMPredict.json +151 -151
- teradataml/data/jsons/sqle/17.10/MovingAverage.json +368 -368
- teradataml/data/jsons/sqle/17.10/NGramSplitter.json +239 -239
- teradataml/data/jsons/sqle/17.10/NaiveBayesPredict.json +149 -149
- teradataml/data/jsons/sqle/17.10/NaiveBayesTextClassifierPredict.json +288 -288
- teradataml/data/jsons/sqle/17.10/Pack.json +133 -133
- teradataml/data/jsons/sqle/17.10/SVMSparsePredict.json +193 -193
- teradataml/data/jsons/sqle/17.10/Sessionize.json +105 -105
- teradataml/data/jsons/sqle/17.10/StringSimilarity.json +86 -86
- teradataml/data/jsons/sqle/17.10/TD_BinCodeFit.json +239 -239
- teradataml/data/jsons/sqle/17.10/TD_BinCodeTransform.json +70 -70
- teradataml/data/jsons/sqle/17.10/TD_CategoricalSummary.json +53 -53
- teradataml/data/jsons/sqle/17.10/TD_Chisq.json +67 -67
- teradataml/data/jsons/sqle/17.10/TD_ColumnSummary.json +53 -53
- teradataml/data/jsons/sqle/17.10/TD_ConvertTo.json +68 -68
- teradataml/data/jsons/sqle/17.10/TD_FTest.json +187 -187
- teradataml/data/jsons/sqle/17.10/TD_FillRowID.json +51 -51
- teradataml/data/jsons/sqle/17.10/TD_FunctionFit.json +46 -46
- teradataml/data/jsons/sqle/17.10/TD_FunctionTransform.json +72 -71
- teradataml/data/jsons/sqle/17.10/TD_GetRowsWithMissingValues.json +52 -52
- teradataml/data/jsons/sqle/17.10/TD_GetRowsWithoutMissingValues.json +52 -52
- teradataml/data/jsons/sqle/17.10/TD_Histogram.json +132 -132
- teradataml/data/jsons/sqle/17.10/TD_NumApply.json +147 -147
- teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingFit.json +182 -182
- teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingTransform.json +65 -64
- teradataml/data/jsons/sqle/17.10/TD_OutlierFilterFit.json +196 -196
- teradataml/data/jsons/sqle/17.10/TD_OutlierFilterTransform.json +48 -47
- teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesFit.json +114 -114
- teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesTransform.json +72 -71
- teradataml/data/jsons/sqle/17.10/TD_QQNorm.json +111 -111
- teradataml/data/jsons/sqle/17.10/TD_RoundColumns.json +93 -93
- teradataml/data/jsons/sqle/17.10/TD_RowNormalizeFit.json +127 -127
- teradataml/data/jsons/sqle/17.10/TD_RowNormalizeTransform.json +70 -69
- teradataml/data/jsons/sqle/17.10/TD_ScaleFit.json +156 -156
- teradataml/data/jsons/sqle/17.10/TD_ScaleTransform.json +70 -69
- teradataml/data/jsons/sqle/17.10/TD_SimpleImputeFit.json +147 -147
- teradataml/data/jsons/sqle/17.10/TD_SimpleImputeTransform.json +48 -47
- teradataml/data/jsons/sqle/17.10/TD_StrApply.json +240 -240
- teradataml/data/jsons/sqle/17.10/TD_UnivariateStatistics.json +118 -118
- teradataml/data/jsons/sqle/17.10/TD_WhichMax.json +52 -52
- teradataml/data/jsons/sqle/17.10/TD_WhichMin.json +52 -52
- teradataml/data/jsons/sqle/17.10/TD_ZTest.json +171 -171
- teradataml/data/jsons/sqle/17.10/Unpack.json +188 -188
- teradataml/data/jsons/sqle/17.10/nPath.json +269 -269
- teradataml/data/jsons/sqle/17.20/Antiselect.json +56 -56
- teradataml/data/jsons/sqle/17.20/Attribution.json +249 -249
- teradataml/data/jsons/sqle/17.20/DecisionForestPredict.json +185 -185
- teradataml/data/jsons/sqle/17.20/DecisionTreePredict.json +172 -172
- teradataml/data/jsons/sqle/17.20/GLMPredict.json +151 -151
- teradataml/data/jsons/sqle/17.20/MovingAverage.json +367 -367
- teradataml/data/jsons/sqle/17.20/NGramSplitter.json +239 -239
- teradataml/data/jsons/sqle/17.20/NaiveBayesPredict.json +149 -149
- teradataml/data/jsons/sqle/17.20/NaiveBayesTextClassifierPredict.json +287 -287
- teradataml/data/jsons/sqle/17.20/Pack.json +133 -133
- teradataml/data/jsons/sqle/17.20/SVMSparsePredict.json +192 -192
- teradataml/data/jsons/sqle/17.20/Sessionize.json +105 -105
- teradataml/data/jsons/sqle/17.20/StringSimilarity.json +86 -86
- teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +76 -76
- teradataml/data/jsons/sqle/17.20/TD_BinCodeFit.json +239 -239
- teradataml/data/jsons/sqle/17.20/TD_BinCodeTransform.json +71 -71
- teradataml/data/jsons/sqle/17.20/TD_CategoricalSummary.json +53 -53
- teradataml/data/jsons/sqle/17.20/TD_Chisq.json +67 -67
- teradataml/data/jsons/sqle/17.20/TD_ClassificationEvaluator.json +145 -145
- teradataml/data/jsons/sqle/17.20/TD_ColumnSummary.json +53 -53
- teradataml/data/jsons/sqle/17.20/TD_ColumnTransformer.json +218 -218
- teradataml/data/jsons/sqle/17.20/TD_ConvertTo.json +92 -92
- teradataml/data/jsons/sqle/17.20/TD_DecisionForest.json +259 -259
- teradataml/data/jsons/sqle/17.20/TD_DecisionForestPredict.json +139 -139
- teradataml/data/jsons/sqle/17.20/TD_FTest.json +186 -186
- teradataml/data/jsons/sqle/17.20/TD_FillRowID.json +52 -52
- teradataml/data/jsons/sqle/17.20/TD_FunctionFit.json +46 -46
- teradataml/data/jsons/sqle/17.20/TD_FunctionTransform.json +72 -72
- teradataml/data/jsons/sqle/17.20/TD_GLM.json +431 -431
- teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +125 -125
- teradataml/data/jsons/sqle/17.20/TD_GLMPerSegment.json +411 -411
- teradataml/data/jsons/sqle/17.20/TD_GLMPredictPerSegment.json +146 -146
- teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +91 -91
- teradataml/data/jsons/sqle/17.20/TD_GetRowsWithMissingValues.json +76 -76
- teradataml/data/jsons/sqle/17.20/TD_GetRowsWithoutMissingValues.json +76 -76
- teradataml/data/jsons/sqle/17.20/TD_Histogram.json +152 -152
- teradataml/data/jsons/sqle/17.20/TD_KMeans.json +211 -211
- teradataml/data/jsons/sqle/17.20/TD_KMeansPredict.json +86 -86
- teradataml/data/jsons/sqle/17.20/TD_KNN.json +262 -262
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesTextClassifierTrainer.json +137 -137
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +101 -101
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineTransform.json +71 -71
- teradataml/data/jsons/sqle/17.20/TD_NumApply.json +147 -147
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +315 -315
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVMPredict.json +123 -123
- teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingFit.json +271 -271
- teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingTransform.json +65 -65
- teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingFit.json +229 -229
- teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingTransform.json +75 -75
- teradataml/data/jsons/sqle/17.20/TD_OutlierFilterFit.json +217 -217
- teradataml/data/jsons/sqle/17.20/TD_OutlierFilterTransform.json +48 -48
- teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesFit.json +114 -114
- teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesTransform.json +72 -72
- teradataml/data/jsons/sqle/17.20/TD_QQNorm.json +111 -111
- teradataml/data/jsons/sqle/17.20/TD_ROC.json +177 -177
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionFit.json +178 -178
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionMinComponents.json +73 -73
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionTransform.json +74 -74
- teradataml/data/jsons/sqle/17.20/TD_RegressionEvaluator.json +137 -137
- teradataml/data/jsons/sqle/17.20/TD_RoundColumns.json +93 -93
- teradataml/data/jsons/sqle/17.20/TD_RowNormalizeFit.json +127 -127
- teradataml/data/jsons/sqle/17.20/TD_RowNormalizeTransform.json +70 -70
- teradataml/data/jsons/sqle/17.20/TD_SVM.json +389 -389
- teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +124 -124
- teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +156 -156
- teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +70 -70
- teradataml/data/jsons/sqle/17.20/TD_SentimentExtractor.json +193 -193
- teradataml/data/jsons/sqle/17.20/TD_Silhouette.json +142 -142
- teradataml/data/jsons/sqle/17.20/TD_SimpleImputeFit.json +147 -147
- teradataml/data/jsons/sqle/17.20/TD_SimpleImputeTransform.json +48 -48
- teradataml/data/jsons/sqle/17.20/TD_StrApply.json +240 -240
- teradataml/data/jsons/sqle/17.20/TD_TargetEncodingFit.json +248 -248
- teradataml/data/jsons/sqle/17.20/TD_TargetEncodingTransform.json +75 -75
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +192 -192
- teradataml/data/jsons/sqle/17.20/TD_TrainTestSplit.json +142 -142
- teradataml/data/jsons/sqle/17.20/TD_UnivariateStatistics.json +117 -117
- teradataml/data/jsons/sqle/17.20/TD_VectorDistance.json +182 -182
- teradataml/data/jsons/sqle/17.20/TD_WhichMax.json +52 -52
- teradataml/data/jsons/sqle/17.20/TD_WhichMin.json +52 -52
- teradataml/data/jsons/sqle/17.20/TD_WordEmbeddings.json +241 -241
- teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +312 -312
- teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +182 -182
- teradataml/data/jsons/sqle/17.20/TD_ZTest.json +170 -170
- teradataml/data/jsons/sqle/17.20/Unpack.json +188 -188
- teradataml/data/jsons/sqle/17.20/nPath.json +269 -269
- teradataml/data/jsons/tableoperator/17.00/read_nos.json +197 -197
- teradataml/data/jsons/tableoperator/17.05/read_nos.json +197 -197
- teradataml/data/jsons/tableoperator/17.05/write_nos.json +194 -194
- teradataml/data/jsons/tableoperator/17.10/read_nos.json +183 -183
- teradataml/data/jsons/tableoperator/17.10/write_nos.json +194 -194
- teradataml/data/jsons/tableoperator/17.20/read_nos.json +182 -182
- teradataml/data/jsons/tableoperator/17.20/write_nos.json +223 -223
- teradataml/data/jsons/uaf/17.20/TD_ACF.json +149 -149
- teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +409 -409
- teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +79 -79
- teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +151 -151
- teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +109 -109
- teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +107 -107
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +87 -87
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +106 -106
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +80 -80
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +67 -67
- teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +91 -91
- teradataml/data/jsons/uaf/17.20/TD_DFFT.json +136 -136
- teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +148 -148
- teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +108 -108
- teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +109 -109
- teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +86 -86
- teradataml/data/jsons/uaf/17.20/TD_DIFF.json +91 -91
- teradataml/data/jsons/uaf/17.20/TD_DTW.json +116 -116
- teradataml/data/jsons/uaf/17.20/TD_DURBIN_WATSON.json +100 -100
- teradataml/data/jsons/uaf/17.20/TD_EXTRACT_RESULTS.json +38 -38
- teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +100 -100
- teradataml/data/jsons/uaf/17.20/TD_GENSERIES4FORMULA.json +84 -84
- teradataml/data/jsons/uaf/17.20/TD_GENSERIES4SINUSOIDS.json +70 -70
- teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +152 -152
- teradataml/data/jsons/uaf/17.20/TD_HOLT_WINTERS_FORECAST.json +313 -313
- teradataml/data/jsons/uaf/17.20/TD_IDFFT.json +57 -57
- teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +94 -94
- teradataml/data/jsons/uaf/17.20/TD_INPUTVALIDATOR.json +63 -63
- teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +181 -181
- teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +102 -102
- teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +182 -182
- teradataml/data/jsons/uaf/17.20/TD_MATRIXMULTIPLY.json +67 -67
- teradataml/data/jsons/uaf/17.20/TD_MINFO.json +66 -66
- teradataml/data/jsons/uaf/17.20/TD_MULTIVAR_REGR.json +178 -178
- teradataml/data/jsons/uaf/17.20/TD_PACF.json +114 -114
- teradataml/data/jsons/uaf/17.20/TD_PORTMAN.json +118 -118
- teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +175 -175
- teradataml/data/jsons/uaf/17.20/TD_POWERTRANSFORM.json +97 -97
- teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +173 -173
- teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +136 -136
- teradataml/data/jsons/uaf/17.20/TD_SELECTION_CRITERIA.json +89 -89
- teradataml/data/jsons/uaf/17.20/TD_SIGNIF_PERIODICITIES.json +79 -79
- teradataml/data/jsons/uaf/17.20/TD_SIGNIF_RESIDMEAN.json +67 -67
- teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +184 -184
- teradataml/data/jsons/uaf/17.20/TD_SINFO.json +57 -57
- teradataml/data/jsons/uaf/17.20/TD_SMOOTHMA.json +162 -162
- teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +100 -100
- teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +111 -111
- teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +95 -95
- teradataml/data/jsons/uaf/17.20/TD_WHITES_GENERAL.json +77 -77
- teradataml/data/kmeans_example.json +17 -17
- teradataml/data/kmeans_us_arrests_data.csv +0 -0
- teradataml/data/knn_example.json +18 -18
- teradataml/data/knnrecommender_example.json +6 -6
- teradataml/data/knnrecommenderpredict_example.json +12 -12
- teradataml/data/lar_example.json +17 -17
- teradataml/data/larpredict_example.json +30 -30
- teradataml/data/lc_new_predictors.csv +5 -5
- teradataml/data/lc_new_reference.csv +9 -9
- teradataml/data/lda_example.json +8 -8
- teradataml/data/ldainference_example.json +14 -14
- teradataml/data/ldatopicsummary_example.json +8 -8
- teradataml/data/levendist_input.csv +13 -13
- teradataml/data/levenshteindistance_example.json +10 -10
- teradataml/data/linreg_example.json +9 -9
- teradataml/data/load_example_data.py +326 -323
- teradataml/data/loan_prediction.csv +295 -295
- teradataml/data/lungcancer.csv +138 -138
- teradataml/data/mappingdata.csv +12 -12
- teradataml/data/milk_timeseries.csv +157 -157
- teradataml/data/min_max_titanic.csv +4 -4
- teradataml/data/minhash_example.json +6 -6
- teradataml/data/ml_ratings.csv +7547 -7547
- teradataml/data/ml_ratings_10.csv +2445 -2445
- teradataml/data/model1_table.csv +5 -5
- teradataml/data/model2_table.csv +5 -5
- teradataml/data/models/iris_db_glm_model.pmml +56 -56
- teradataml/data/models/iris_db_xgb_model.pmml +4471 -4471
- teradataml/data/modularity_example.json +12 -12
- teradataml/data/movavg_example.json +7 -7
- teradataml/data/mtx1.csv +7 -7
- teradataml/data/mtx2.csv +13 -13
- teradataml/data/multi_model_classification.csv +401 -0
- teradataml/data/multi_model_regression.csv +401 -0
- teradataml/data/mvdfft8.csv +9 -9
- teradataml/data/naivebayes_example.json +9 -9
- teradataml/data/naivebayespredict_example.json +19 -19
- teradataml/data/naivebayestextclassifier2_example.json +6 -6
- teradataml/data/naivebayestextclassifier_example.json +8 -8
- teradataml/data/naivebayestextclassifierpredict_example.json +20 -20
- teradataml/data/name_Find_configure.csv +10 -10
- teradataml/data/namedentityfinder_example.json +14 -14
- teradataml/data/namedentityfinderevaluator_example.json +10 -10
- teradataml/data/namedentityfindertrainer_example.json +6 -6
- teradataml/data/nb_iris_input_test.csv +31 -31
- teradataml/data/nb_iris_input_train.csv +121 -121
- teradataml/data/nbp_iris_model.csv +13 -13
- teradataml/data/ner_extractor_text.csv +2 -2
- teradataml/data/ner_sports_test2.csv +29 -29
- teradataml/data/ner_sports_train.csv +501 -501
- teradataml/data/nerevaluator_example.json +5 -5
- teradataml/data/nerextractor_example.json +18 -18
- teradataml/data/nermem_sports_test.csv +17 -17
- teradataml/data/nermem_sports_train.csv +50 -50
- teradataml/data/nertrainer_example.json +6 -6
- teradataml/data/ngrams_example.json +6 -6
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Aggregate Functions using SQLAlchemy.ipynb +1455 -1455
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Arithmetic Functions Using SQLAlchemy.ipynb +1993 -1993
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Bit-Byte Manipulation Functions using SQLAlchemy.ipynb +1492 -1492
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Built-in functions using SQLAlchemy.ipynb +536 -536
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Regular Expressions Using SQLAlchemy.ipynb +570 -570
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage String Functions Using SQLAlchemy.ipynb +2559 -2559
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Window Aggregate Functions using SQLAlchemy.ipynb +2911 -2911
- teradataml/data/notebooks/sqlalchemy/Using Generic SQLAlchemy ClauseElements teradataml DataFrame assign method.ipynb +698 -698
- teradataml/data/notebooks/sqlalchemy/teradataml filtering using SQLAlchemy ClauseElements.ipynb +784 -784
- teradataml/data/npath_example.json +23 -23
- teradataml/data/ntree_example.json +14 -14
- teradataml/data/numeric_strings.csv +4 -4
- teradataml/data/numerics.csv +4 -4
- teradataml/data/ocean_buoy.csv +17 -17
- teradataml/data/ocean_buoy2.csv +17 -17
- teradataml/data/ocean_buoys.csv +27 -27
- teradataml/data/ocean_buoys2.csv +10 -10
- teradataml/data/ocean_buoys_nonpti.csv +28 -28
- teradataml/data/ocean_buoys_seq.csv +29 -29
- teradataml/data/openml_example.json +63 -0
- teradataml/data/optional_event_table.csv +4 -4
- teradataml/data/orders1.csv +11 -11
- teradataml/data/orders1_12.csv +12 -12
- teradataml/data/orders_ex.csv +4 -4
- teradataml/data/pack_example.json +8 -8
- teradataml/data/package_tracking.csv +19 -19
- teradataml/data/package_tracking_pti.csv +18 -18
- teradataml/data/pagerank_example.json +13 -13
- teradataml/data/paragraphs_input.csv +6 -6
- teradataml/data/pathanalyzer_example.json +7 -7
- teradataml/data/pathgenerator_example.json +7 -7
- teradataml/data/phrases.csv +7 -7
- teradataml/data/pivot_example.json +8 -8
- teradataml/data/pivot_input.csv +22 -22
- teradataml/data/playerRating.csv +31 -31
- teradataml/data/postagger_example.json +6 -6
- teradataml/data/posttagger_output.csv +44 -44
- teradataml/data/production_data.csv +16 -16
- teradataml/data/production_data2.csv +7 -7
- teradataml/data/randomsample_example.json +31 -31
- teradataml/data/randomwalksample_example.json +8 -8
- teradataml/data/rank_table.csv +6 -6
- teradataml/data/ref_mobile_data.csv +4 -4
- teradataml/data/ref_mobile_data_dense.csv +2 -2
- teradataml/data/ref_url.csv +17 -17
- teradataml/data/restaurant_reviews.csv +7 -7
- teradataml/data/river_data.csv +145 -145
- teradataml/data/roc_example.json +7 -7
- teradataml/data/roc_input.csv +101 -101
- teradataml/data/rule_inputs.csv +6 -6
- teradataml/data/rule_table.csv +2 -2
- teradataml/data/sales.csv +7 -7
- teradataml/data/sales_transaction.csv +501 -501
- teradataml/data/salesdata.csv +342 -342
- teradataml/data/sample_cities.csv +2 -2
- teradataml/data/sample_shapes.csv +10 -10
- teradataml/data/sample_streets.csv +2 -2
- teradataml/data/sampling_example.json +15 -15
- teradataml/data/sax_example.json +8 -8
- teradataml/data/scale_example.json +23 -23
- teradataml/data/scale_housing.csv +11 -11
- teradataml/data/scale_housing_test.csv +6 -6
- teradataml/data/scale_stat.csv +11 -11
- teradataml/data/scalebypartition_example.json +13 -13
- teradataml/data/scalemap_example.json +13 -13
- teradataml/data/scalesummary_example.json +12 -12
- teradataml/data/score_category.csv +101 -101
- teradataml/data/score_summary.csv +4 -4
- teradataml/data/script_example.json +9 -9
- teradataml/data/scripts/deploy_script.py +65 -0
- teradataml/data/scripts/mapper.R +20 -0
- teradataml/data/scripts/mapper.py +15 -15
- teradataml/data/scripts/mapper_replace.py +15 -15
- teradataml/data/scripts/sklearn/__init__.py +0 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +175 -0
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +135 -0
- teradataml/data/scripts/sklearn/sklearn_function.template +113 -0
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +158 -0
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +152 -0
- teradataml/data/scripts/sklearn/sklearn_score.py +128 -0
- teradataml/data/scripts/sklearn/sklearn_transform.py +179 -0
- teradataml/data/seeds.csv +10 -10
- teradataml/data/sentenceextractor_example.json +6 -6
- teradataml/data/sentiment_extract_input.csv +11 -11
- teradataml/data/sentiment_train.csv +16 -16
- teradataml/data/sentiment_word.csv +20 -20
- teradataml/data/sentiment_word_input.csv +19 -19
- teradataml/data/sentimentextractor_example.json +24 -24
- teradataml/data/sentimenttrainer_example.json +8 -8
- teradataml/data/sequence_table.csv +10 -10
- teradataml/data/seriessplitter_example.json +7 -7
- teradataml/data/sessionize_example.json +17 -17
- teradataml/data/sessionize_table.csv +116 -116
- teradataml/data/setop_test1.csv +24 -24
- teradataml/data/setop_test2.csv +22 -22
- teradataml/data/soc_nw_edges.csv +10 -10
- teradataml/data/soc_nw_vertices.csv +7 -7
- teradataml/data/souvenir_timeseries.csv +167 -167
- teradataml/data/sparse_iris_attribute.csv +5 -5
- teradataml/data/sparse_iris_test.csv +121 -121
- teradataml/data/sparse_iris_train.csv +601 -601
- teradataml/data/star1.csv +6 -6
- teradataml/data/state_transition.csv +5 -5
- teradataml/data/stock_data.csv +53 -53
- teradataml/data/stock_movement.csv +11 -11
- teradataml/data/stock_vol.csv +76 -76
- teradataml/data/stop_words.csv +8 -8
- teradataml/data/store_sales.csv +37 -37
- teradataml/data/stringsimilarity_example.json +7 -7
- teradataml/data/strsimilarity_input.csv +13 -13
- teradataml/data/students.csv +101 -101
- teradataml/data/svm_iris_input_test.csv +121 -121
- teradataml/data/svm_iris_input_train.csv +481 -481
- teradataml/data/svm_iris_model.csv +7 -7
- teradataml/data/svmdense_example.json +9 -9
- teradataml/data/svmdensepredict_example.json +18 -18
- teradataml/data/svmsparse_example.json +7 -7
- teradataml/data/svmsparsepredict_example.json +13 -13
- teradataml/data/svmsparsesummary_example.json +7 -7
- teradataml/data/target_mobile_data.csv +13 -13
- teradataml/data/target_mobile_data_dense.csv +5 -5
- teradataml/data/templatedata.csv +1201 -1201
- teradataml/data/templates/open_source_ml.json +9 -0
- teradataml/data/teradataml_example.json +73 -1
- teradataml/data/test_classification.csv +101 -0
- teradataml/data/test_loan_prediction.csv +53 -53
- teradataml/data/test_pacf_12.csv +37 -37
- teradataml/data/test_prediction.csv +101 -0
- teradataml/data/test_regression.csv +101 -0
- teradataml/data/test_river2.csv +109 -109
- teradataml/data/text_inputs.csv +6 -6
- teradataml/data/textchunker_example.json +7 -7
- teradataml/data/textclassifier_example.json +6 -6
- teradataml/data/textclassifier_input.csv +7 -7
- teradataml/data/textclassifiertrainer_example.json +6 -6
- teradataml/data/textmorph_example.json +5 -5
- teradataml/data/textparser_example.json +15 -15
- teradataml/data/texttagger_example.json +11 -11
- teradataml/data/texttokenizer_example.json +6 -6
- teradataml/data/texttrainer_input.csv +11 -11
- teradataml/data/tf_example.json +6 -6
- teradataml/data/tfidf_example.json +13 -13
- teradataml/data/tfidf_input1.csv +201 -201
- teradataml/data/tfidf_train.csv +6 -6
- teradataml/data/time_table1.csv +535 -535
- teradataml/data/time_table2.csv +14 -14
- teradataml/data/timeseriesdata.csv +1601 -1601
- teradataml/data/timeseriesdatasetsd4.csv +105 -105
- teradataml/data/titanic.csv +892 -892
- teradataml/data/token_table.csv +696 -696
- teradataml/data/train_multiclass.csv +101 -0
- teradataml/data/train_regression.csv +101 -0
- teradataml/data/train_regression_multiple_labels.csv +101 -0
- teradataml/data/train_tracking.csv +27 -27
- teradataml/data/transformation_table.csv +5 -5
- teradataml/data/transformation_table_new.csv +1 -1
- teradataml/data/tv_spots.csv +16 -16
- teradataml/data/twod_climate_data.csv +117 -117
- teradataml/data/uaf_example.json +475 -475
- teradataml/data/univariatestatistics_example.json +8 -8
- teradataml/data/unpack_example.json +9 -9
- teradataml/data/unpivot_example.json +9 -9
- teradataml/data/unpivot_input.csv +8 -8
- teradataml/data/us_air_pass.csv +36 -36
- teradataml/data/us_population.csv +624 -624
- teradataml/data/us_states_shapes.csv +52 -52
- teradataml/data/varmax_example.json +17 -17
- teradataml/data/vectordistance_example.json +25 -25
- teradataml/data/ville_climatedata.csv +121 -121
- teradataml/data/ville_tempdata.csv +12 -12
- teradataml/data/ville_tempdata1.csv +12 -12
- teradataml/data/ville_temperature.csv +11 -11
- teradataml/data/waveletTable.csv +1605 -1605
- teradataml/data/waveletTable2.csv +1605 -1605
- teradataml/data/weightedmovavg_example.json +8 -8
- teradataml/data/wft_testing.csv +5 -5
- teradataml/data/wine_data.csv +1600 -0
- teradataml/data/word_embed_input_table1.csv +5 -5
- teradataml/data/word_embed_input_table2.csv +4 -4
- teradataml/data/word_embed_model.csv +22 -22
- teradataml/data/words_input.csv +13 -13
- teradataml/data/xconvolve_complex_left.csv +6 -6
- teradataml/data/xconvolve_complex_leftmulti.csv +6 -6
- teradataml/data/xgboost_example.json +35 -35
- teradataml/data/xgboostpredict_example.json +31 -31
- teradataml/dataframe/copy_to.py +1764 -1698
- teradataml/dataframe/data_transfer.py +2753 -2745
- teradataml/dataframe/dataframe.py +17545 -16946
- teradataml/dataframe/dataframe_utils.py +1837 -1740
- teradataml/dataframe/fastload.py +611 -603
- teradataml/dataframe/indexer.py +424 -424
- teradataml/dataframe/setop.py +1179 -1166
- teradataml/dataframe/sql.py +10090 -6432
- teradataml/dataframe/sql_function_parameters.py +439 -388
- teradataml/dataframe/sql_functions.py +652 -652
- teradataml/dataframe/sql_interfaces.py +220 -220
- teradataml/dataframe/vantage_function_types.py +674 -630
- teradataml/dataframe/window.py +693 -692
- teradataml/dbutils/__init__.py +3 -3
- teradataml/dbutils/dbutils.py +1167 -1150
- teradataml/dbutils/filemgr.py +267 -267
- teradataml/gen_ai/__init__.py +2 -2
- teradataml/gen_ai/convAI.py +472 -472
- teradataml/geospatial/__init__.py +3 -3
- teradataml/geospatial/geodataframe.py +1105 -1094
- teradataml/geospatial/geodataframecolumn.py +392 -387
- teradataml/geospatial/geometry_types.py +925 -925
- teradataml/hyperparameter_tuner/__init__.py +1 -1
- teradataml/hyperparameter_tuner/optimizer.py +3783 -2993
- teradataml/hyperparameter_tuner/utils.py +281 -187
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/lib/libaed_0_1.dylib +0 -0
- teradataml/lib/libaed_0_1.so +0 -0
- teradataml/libaed_0_1.dylib +0 -0
- teradataml/libaed_0_1.so +0 -0
- teradataml/opensource/__init__.py +1 -0
- teradataml/opensource/sklearn/__init__.py +1 -0
- teradataml/opensource/sklearn/_class.py +255 -0
- teradataml/opensource/sklearn/_sklearn_wrapper.py +1668 -0
- teradataml/opensource/sklearn/_wrapper_utils.py +268 -0
- teradataml/opensource/sklearn/constants.py +54 -0
- teradataml/options/__init__.py +121 -124
- teradataml/options/configure.py +337 -336
- teradataml/options/display.py +176 -176
- teradataml/plot/__init__.py +2 -2
- teradataml/plot/axis.py +1388 -1388
- teradataml/plot/constants.py +15 -15
- teradataml/plot/figure.py +398 -398
- teradataml/plot/plot.py +760 -760
- teradataml/plot/query_generator.py +83 -83
- teradataml/plot/subplot.py +216 -216
- teradataml/scriptmgmt/UserEnv.py +3788 -3761
- teradataml/scriptmgmt/__init__.py +3 -3
- teradataml/scriptmgmt/lls_utils.py +1616 -1604
- teradataml/series/series.py +532 -532
- teradataml/series/series_utils.py +71 -71
- teradataml/table_operators/Apply.py +949 -917
- teradataml/table_operators/Script.py +1719 -1982
- teradataml/table_operators/TableOperator.py +1207 -1616
- teradataml/table_operators/__init__.py +2 -3
- teradataml/table_operators/apply_query_generator.py +262 -262
- teradataml/table_operators/query_generator.py +507 -507
- teradataml/table_operators/table_operator_query_generator.py +460 -460
- teradataml/table_operators/table_operator_util.py +631 -639
- teradataml/table_operators/templates/dataframe_apply.template +184 -184
- teradataml/table_operators/templates/dataframe_map.template +176 -176
- teradataml/table_operators/templates/script_executor.template +170 -170
- teradataml/utils/dtypes.py +684 -684
- teradataml/utils/internal_buffer.py +84 -84
- teradataml/utils/print_versions.py +205 -205
- teradataml/utils/utils.py +410 -410
- teradataml/utils/validators.py +2239 -2115
- {teradataml-17.20.0.7.dist-info → teradataml-20.0.0.0.dist-info}/METADATA +270 -41
- teradataml-20.0.0.0.dist-info/RECORD +1038 -0
- {teradataml-17.20.0.7.dist-info → teradataml-20.0.0.0.dist-info}/WHEEL +1 -1
- {teradataml-17.20.0.7.dist-info → teradataml-20.0.0.0.dist-info}/zip-safe +1 -1
- teradataml/analytics/mle/AdaBoost.py +0 -651
- teradataml/analytics/mle/AdaBoostPredict.py +0 -564
- teradataml/analytics/mle/Antiselect.py +0 -342
- teradataml/analytics/mle/Arima.py +0 -641
- teradataml/analytics/mle/ArimaPredict.py +0 -477
- teradataml/analytics/mle/Attribution.py +0 -1070
- teradataml/analytics/mle/Betweenness.py +0 -658
- teradataml/analytics/mle/Burst.py +0 -711
- teradataml/analytics/mle/CCM.py +0 -600
- teradataml/analytics/mle/CCMPrepare.py +0 -324
- teradataml/analytics/mle/CFilter.py +0 -460
- teradataml/analytics/mle/ChangePointDetection.py +0 -572
- teradataml/analytics/mle/ChangePointDetectionRT.py +0 -477
- teradataml/analytics/mle/Closeness.py +0 -737
- teradataml/analytics/mle/ConfusionMatrix.py +0 -420
- teradataml/analytics/mle/Correlation.py +0 -477
- teradataml/analytics/mle/Correlation2.py +0 -573
- teradataml/analytics/mle/CoxHazardRatio.py +0 -679
- teradataml/analytics/mle/CoxPH.py +0 -556
- teradataml/analytics/mle/CoxSurvival.py +0 -478
- teradataml/analytics/mle/CumulativeMovAvg.py +0 -363
- teradataml/analytics/mle/DTW.py +0 -623
- teradataml/analytics/mle/DWT.py +0 -564
- teradataml/analytics/mle/DWT2D.py +0 -599
- teradataml/analytics/mle/DecisionForest.py +0 -716
- teradataml/analytics/mle/DecisionForestEvaluator.py +0 -363
- teradataml/analytics/mle/DecisionForestPredict.py +0 -561
- teradataml/analytics/mle/DecisionTree.py +0 -830
- teradataml/analytics/mle/DecisionTreePredict.py +0 -528
- teradataml/analytics/mle/ExponentialMovAvg.py +0 -418
- teradataml/analytics/mle/FMeasure.py +0 -402
- teradataml/analytics/mle/FPGrowth.py +0 -734
- teradataml/analytics/mle/FrequentPaths.py +0 -695
- teradataml/analytics/mle/GLM.py +0 -558
- teradataml/analytics/mle/GLML1L2.py +0 -547
- teradataml/analytics/mle/GLML1L2Predict.py +0 -519
- teradataml/analytics/mle/GLMPredict.py +0 -529
- teradataml/analytics/mle/HMMDecoder.py +0 -945
- teradataml/analytics/mle/HMMEvaluator.py +0 -901
- teradataml/analytics/mle/HMMSupervised.py +0 -521
- teradataml/analytics/mle/HMMUnsupervised.py +0 -572
- teradataml/analytics/mle/Histogram.py +0 -561
- teradataml/analytics/mle/IDWT.py +0 -476
- teradataml/analytics/mle/IDWT2D.py +0 -493
- teradataml/analytics/mle/IdentityMatch.py +0 -763
- teradataml/analytics/mle/Interpolator.py +0 -918
- teradataml/analytics/mle/KMeans.py +0 -485
- teradataml/analytics/mle/KNN.py +0 -627
- teradataml/analytics/mle/KNNRecommender.py +0 -488
- teradataml/analytics/mle/KNNRecommenderPredict.py +0 -581
- teradataml/analytics/mle/LAR.py +0 -439
- teradataml/analytics/mle/LARPredict.py +0 -478
- teradataml/analytics/mle/LDA.py +0 -548
- teradataml/analytics/mle/LDAInference.py +0 -492
- teradataml/analytics/mle/LDATopicSummary.py +0 -464
- teradataml/analytics/mle/LevenshteinDistance.py +0 -450
- teradataml/analytics/mle/LinReg.py +0 -433
- teradataml/analytics/mle/LinRegPredict.py +0 -438
- teradataml/analytics/mle/MinHash.py +0 -544
- teradataml/analytics/mle/Modularity.py +0 -587
- teradataml/analytics/mle/NEREvaluator.py +0 -410
- teradataml/analytics/mle/NERExtractor.py +0 -595
- teradataml/analytics/mle/NERTrainer.py +0 -458
- teradataml/analytics/mle/NGrams.py +0 -570
- teradataml/analytics/mle/NPath.py +0 -634
- teradataml/analytics/mle/NTree.py +0 -549
- teradataml/analytics/mle/NaiveBayes.py +0 -462
- teradataml/analytics/mle/NaiveBayesPredict.py +0 -513
- teradataml/analytics/mle/NaiveBayesTextClassifier.py +0 -607
- teradataml/analytics/mle/NaiveBayesTextClassifier2.py +0 -531
- teradataml/analytics/mle/NaiveBayesTextClassifierPredict.py +0 -799
- teradataml/analytics/mle/NamedEntityFinder.py +0 -529
- teradataml/analytics/mle/NamedEntityFinderEvaluator.py +0 -414
- teradataml/analytics/mle/NamedEntityFinderTrainer.py +0 -396
- teradataml/analytics/mle/POSTagger.py +0 -417
- teradataml/analytics/mle/Pack.py +0 -411
- teradataml/analytics/mle/PageRank.py +0 -535
- teradataml/analytics/mle/PathAnalyzer.py +0 -426
- teradataml/analytics/mle/PathGenerator.py +0 -367
- teradataml/analytics/mle/PathStart.py +0 -464
- teradataml/analytics/mle/PathSummarizer.py +0 -470
- teradataml/analytics/mle/Pivot.py +0 -471
- teradataml/analytics/mle/ROC.py +0 -425
- teradataml/analytics/mle/RandomSample.py +0 -637
- teradataml/analytics/mle/RandomWalkSample.py +0 -490
- teradataml/analytics/mle/SAX.py +0 -779
- teradataml/analytics/mle/SVMDense.py +0 -677
- teradataml/analytics/mle/SVMDensePredict.py +0 -536
- teradataml/analytics/mle/SVMDenseSummary.py +0 -437
- teradataml/analytics/mle/SVMSparse.py +0 -557
- teradataml/analytics/mle/SVMSparsePredict.py +0 -553
- teradataml/analytics/mle/SVMSparseSummary.py +0 -435
- teradataml/analytics/mle/Sampling.py +0 -549
- teradataml/analytics/mle/Scale.py +0 -565
- teradataml/analytics/mle/ScaleByPartition.py +0 -496
- teradataml/analytics/mle/ScaleMap.py +0 -378
- teradataml/analytics/mle/ScaleSummary.py +0 -320
- teradataml/analytics/mle/SentenceExtractor.py +0 -363
- teradataml/analytics/mle/SentimentEvaluator.py +0 -432
- teradataml/analytics/mle/SentimentExtractor.py +0 -578
- teradataml/analytics/mle/SentimentTrainer.py +0 -405
- teradataml/analytics/mle/SeriesSplitter.py +0 -641
- teradataml/analytics/mle/Sessionize.py +0 -475
- teradataml/analytics/mle/SimpleMovAvg.py +0 -397
- teradataml/analytics/mle/StringSimilarity.py +0 -425
- teradataml/analytics/mle/TF.py +0 -389
- teradataml/analytics/mle/TFIDF.py +0 -504
- teradataml/analytics/mle/TextChunker.py +0 -414
- teradataml/analytics/mle/TextClassifier.py +0 -399
- teradataml/analytics/mle/TextClassifierEvaluator.py +0 -413
- teradataml/analytics/mle/TextClassifierTrainer.py +0 -565
- teradataml/analytics/mle/TextMorph.py +0 -494
- teradataml/analytics/mle/TextParser.py +0 -623
- teradataml/analytics/mle/TextTagger.py +0 -530
- teradataml/analytics/mle/TextTokenizer.py +0 -502
- teradataml/analytics/mle/UnivariateStatistics.py +0 -488
- teradataml/analytics/mle/Unpack.py +0 -526
- teradataml/analytics/mle/Unpivot.py +0 -438
- teradataml/analytics/mle/VarMax.py +0 -776
- teradataml/analytics/mle/VectorDistance.py +0 -762
- teradataml/analytics/mle/WeightedMovAvg.py +0 -400
- teradataml/analytics/mle/XGBoost.py +0 -842
- teradataml/analytics/mle/XGBoostPredict.py +0 -627
- teradataml/analytics/mle/__init__.py +0 -123
- teradataml/analytics/mle/json/adaboost_mle.json +0 -135
- teradataml/analytics/mle/json/adaboostpredict_mle.json +0 -85
- teradataml/analytics/mle/json/antiselect_mle.json +0 -34
- teradataml/analytics/mle/json/antiselect_mle_mle.json +0 -34
- teradataml/analytics/mle/json/arima_mle.json +0 -172
- teradataml/analytics/mle/json/arimapredict_mle.json +0 -52
- teradataml/analytics/mle/json/attribution_mle_mle.json +0 -143
- teradataml/analytics/mle/json/betweenness_mle.json +0 -97
- teradataml/analytics/mle/json/burst_mle.json +0 -140
- teradataml/analytics/mle/json/ccm_mle.json +0 -124
- teradataml/analytics/mle/json/ccmprepare_mle.json +0 -14
- teradataml/analytics/mle/json/cfilter_mle.json +0 -93
- teradataml/analytics/mle/json/changepointdetection_mle.json +0 -92
- teradataml/analytics/mle/json/changepointdetectionrt_mle.json +0 -78
- teradataml/analytics/mle/json/closeness_mle.json +0 -104
- teradataml/analytics/mle/json/confusionmatrix_mle.json +0 -79
- teradataml/analytics/mle/json/correlation_mle.json +0 -86
- teradataml/analytics/mle/json/correlationreduce_mle.json +0 -49
- teradataml/analytics/mle/json/coxhazardratio_mle.json +0 -89
- teradataml/analytics/mle/json/coxph_mle.json +0 -98
- teradataml/analytics/mle/json/coxsurvival_mle.json +0 -79
- teradataml/analytics/mle/json/cumulativemovavg_mle.json +0 -34
- teradataml/analytics/mle/json/decisionforest_mle.json +0 -167
- teradataml/analytics/mle/json/decisionforestevaluator_mle.json +0 -33
- teradataml/analytics/mle/json/decisionforestpredict_mle_mle.json +0 -74
- teradataml/analytics/mle/json/decisiontree_mle.json +0 -194
- teradataml/analytics/mle/json/decisiontreepredict_mle_mle.json +0 -86
- teradataml/analytics/mle/json/dtw_mle.json +0 -97
- teradataml/analytics/mle/json/dwt2d_mle.json +0 -116
- teradataml/analytics/mle/json/dwt_mle.json +0 -101
- teradataml/analytics/mle/json/exponentialmovavg_mle.json +0 -55
- teradataml/analytics/mle/json/fmeasure_mle.json +0 -58
- teradataml/analytics/mle/json/fpgrowth_mle.json +0 -159
- teradataml/analytics/mle/json/frequentpaths_mle.json +0 -129
- teradataml/analytics/mle/json/glm_mle.json +0 -111
- teradataml/analytics/mle/json/glml1l2_mle.json +0 -106
- teradataml/analytics/mle/json/glml1l2predict_mle.json +0 -57
- teradataml/analytics/mle/json/glmpredict_mle_mle.json +0 -74
- teradataml/analytics/mle/json/histogram_mle.json +0 -100
- teradataml/analytics/mle/json/hmmdecoder_mle.json +0 -192
- teradataml/analytics/mle/json/hmmevaluator_mle.json +0 -206
- teradataml/analytics/mle/json/hmmsupervised_mle.json +0 -91
- teradataml/analytics/mle/json/hmmunsupervised_mle.json +0 -114
- teradataml/analytics/mle/json/identitymatch_mle.json +0 -88
- teradataml/analytics/mle/json/idwt2d_mle.json +0 -73
- teradataml/analytics/mle/json/idwt_mle.json +0 -66
- teradataml/analytics/mle/json/interpolator_mle.json +0 -151
- teradataml/analytics/mle/json/kmeans_mle.json +0 -97
- teradataml/analytics/mle/json/knn_mle.json +0 -141
- teradataml/analytics/mle/json/knnrecommender_mle.json +0 -111
- teradataml/analytics/mle/json/knnrecommenderpredict_mle.json +0 -75
- teradataml/analytics/mle/json/lar_mle.json +0 -78
- teradataml/analytics/mle/json/larpredict_mle.json +0 -69
- teradataml/analytics/mle/json/lda_mle.json +0 -130
- teradataml/analytics/mle/json/ldainference_mle.json +0 -78
- teradataml/analytics/mle/json/ldatopicsummary_mle.json +0 -64
- teradataml/analytics/mle/json/levenshteindistance_mle.json +0 -92
- teradataml/analytics/mle/json/linreg_mle.json +0 -42
- teradataml/analytics/mle/json/linregpredict_mle.json +0 -56
- teradataml/analytics/mle/json/minhash_mle.json +0 -113
- teradataml/analytics/mle/json/modularity_mle.json +0 -91
- teradataml/analytics/mle/json/naivebayespredict_mle_mle.json +0 -85
- teradataml/analytics/mle/json/naivebayesreduce_mle.json +0 -52
- teradataml/analytics/mle/json/naivebayestextclassifierpredict_mle_mle.json +0 -147
- teradataml/analytics/mle/json/naivebayestextclassifiertrainer2_mle.json +0 -108
- teradataml/analytics/mle/json/naivebayestextclassifiertrainer_mle.json +0 -102
- teradataml/analytics/mle/json/namedentityfinder_mle.json +0 -84
- teradataml/analytics/mle/json/namedentityfinderevaluatorreduce_mle.json +0 -43
- teradataml/analytics/mle/json/namedentityfindertrainer_mle.json +0 -64
- teradataml/analytics/mle/json/nerevaluator_mle.json +0 -54
- teradataml/analytics/mle/json/nerextractor_mle.json +0 -87
- teradataml/analytics/mle/json/nertrainer_mle.json +0 -89
- teradataml/analytics/mle/json/ngrams_mle.json +0 -137
- teradataml/analytics/mle/json/ngramsplitter_mle_mle.json +0 -137
- teradataml/analytics/mle/json/npath@coprocessor_mle.json +0 -73
- teradataml/analytics/mle/json/ntree@coprocessor_mle.json +0 -123
- teradataml/analytics/mle/json/pack_mle.json +0 -58
- teradataml/analytics/mle/json/pack_mle_mle.json +0 -58
- teradataml/analytics/mle/json/pagerank_mle.json +0 -81
- teradataml/analytics/mle/json/pathanalyzer_mle.json +0 -63
- teradataml/analytics/mle/json/pathgenerator_mle.json +0 -40
- teradataml/analytics/mle/json/pathstart_mle.json +0 -62
- teradataml/analytics/mle/json/pathsummarizer_mle.json +0 -72
- teradataml/analytics/mle/json/pivoting_mle.json +0 -71
- teradataml/analytics/mle/json/postagger_mle.json +0 -51
- teradataml/analytics/mle/json/randomsample_mle.json +0 -131
- teradataml/analytics/mle/json/randomwalksample_mle.json +0 -85
- teradataml/analytics/mle/json/roc_mle.json +0 -73
- teradataml/analytics/mle/json/sampling_mle.json +0 -75
- teradataml/analytics/mle/json/sax_mle.json +0 -154
- teradataml/analytics/mle/json/scale_mle.json +0 -93
- teradataml/analytics/mle/json/scalebypartition_mle.json +0 -89
- teradataml/analytics/mle/json/scalemap_mle.json +0 -44
- teradataml/analytics/mle/json/scalesummary_mle.json +0 -14
- teradataml/analytics/mle/json/sentenceextractor_mle.json +0 -41
- teradataml/analytics/mle/json/sentimentevaluator_mle.json +0 -43
- teradataml/analytics/mle/json/sentimentextractor_mle.json +0 -100
- teradataml/analytics/mle/json/sentimenttrainer_mle.json +0 -68
- teradataml/analytics/mle/json/seriessplitter_mle.json +0 -133
- teradataml/analytics/mle/json/sessionize_mle_mle.json +0 -62
- teradataml/analytics/mle/json/simplemovavg_mle.json +0 -48
- teradataml/analytics/mle/json/stringsimilarity_mle.json +0 -50
- teradataml/analytics/mle/json/stringsimilarity_mle_mle.json +0 -50
- teradataml/analytics/mle/json/svmdense_mle.json +0 -165
- teradataml/analytics/mle/json/svmdensepredict_mle.json +0 -95
- teradataml/analytics/mle/json/svmdensesummary_mle.json +0 -58
- teradataml/analytics/mle/json/svmsparse_mle.json +0 -148
- teradataml/analytics/mle/json/svmsparsepredict_mle_mle.json +0 -103
- teradataml/analytics/mle/json/svmsparsesummary_mle.json +0 -57
- teradataml/analytics/mle/json/textchunker_mle.json +0 -40
- teradataml/analytics/mle/json/textclassifier_mle.json +0 -51
- teradataml/analytics/mle/json/textclassifierevaluator_mle.json +0 -43
- teradataml/analytics/mle/json/textclassifiertrainer_mle.json +0 -103
- teradataml/analytics/mle/json/textmorph_mle.json +0 -63
- teradataml/analytics/mle/json/textparser_mle.json +0 -166
- teradataml/analytics/mle/json/texttagger_mle.json +0 -81
- teradataml/analytics/mle/json/texttokenizer_mle.json +0 -91
- teradataml/analytics/mle/json/tf_mle.json +0 -33
- teradataml/analytics/mle/json/tfidf_mle.json +0 -34
- teradataml/analytics/mle/json/univariatestatistics_mle.json +0 -81
- teradataml/analytics/mle/json/unpack_mle.json +0 -91
- teradataml/analytics/mle/json/unpack_mle_mle.json +0 -91
- teradataml/analytics/mle/json/unpivoting_mle.json +0 -63
- teradataml/analytics/mle/json/varmax_mle.json +0 -176
- teradataml/analytics/mle/json/vectordistance_mle.json +0 -179
- teradataml/analytics/mle/json/weightedmovavg_mle.json +0 -48
- teradataml/analytics/mle/json/xgboost_mle.json +0 -178
- teradataml/analytics/mle/json/xgboostpredict_mle.json +0 -104
- teradataml/analytics/sqle/Antiselect.py +0 -321
- teradataml/analytics/sqle/Attribution.py +0 -603
- teradataml/analytics/sqle/DecisionForestPredict.py +0 -408
- teradataml/analytics/sqle/GLMPredict.py +0 -430
- teradataml/analytics/sqle/MovingAverage.py +0 -543
- teradataml/analytics/sqle/NGramSplitter.py +0 -548
- teradataml/analytics/sqle/NPath.py +0 -632
- teradataml/analytics/sqle/NaiveBayesTextClassifierPredict.py +0 -515
- teradataml/analytics/sqle/Pack.py +0 -388
- teradataml/analytics/sqle/SVMSparsePredict.py +0 -464
- teradataml/analytics/sqle/Sessionize.py +0 -390
- teradataml/analytics/sqle/StringSimilarity.py +0 -400
- teradataml/analytics/sqle/Unpack.py +0 -503
- teradataml/analytics/sqle/json/antiselect_sqle.json +0 -21
- teradataml/analytics/sqle/json/attribution_sqle.json +0 -92
- teradataml/analytics/sqle/json/decisionforestpredict_sqle.json +0 -48
- teradataml/analytics/sqle/json/glmpredict_sqle.json +0 -48
- teradataml/analytics/sqle/json/h2opredict_sqle.json +0 -63
- teradataml/analytics/sqle/json/movingaverage_sqle.json +0 -58
- teradataml/analytics/sqle/json/naivebayestextclassifierpredict_sqle.json +0 -76
- teradataml/analytics/sqle/json/ngramsplitter_sqle.json +0 -126
- teradataml/analytics/sqle/json/npath_sqle.json +0 -67
- teradataml/analytics/sqle/json/pack_sqle.json +0 -47
- teradataml/analytics/sqle/json/pmmlpredict_sqle.json +0 -55
- teradataml/analytics/sqle/json/sessionize_sqle.json +0 -43
- teradataml/analytics/sqle/json/stringsimilarity_sqle.json +0 -39
- teradataml/analytics/sqle/json/svmsparsepredict_sqle.json +0 -74
- teradataml/analytics/sqle/json/unpack_sqle.json +0 -80
- teradataml/catalog/model_cataloging.py +0 -980
- teradataml/config/mlengine_alias_definitions_v1.0 +0 -118
- teradataml/config/mlengine_alias_definitions_v1.1 +0 -127
- teradataml/config/mlengine_alias_definitions_v1.3 +0 -129
- teradataml/table_operators/sandbox_container_util.py +0 -643
- teradataml-17.20.0.7.dist-info/RECORD +0 -1280
- {teradataml-17.20.0.7.dist-info → teradataml-20.0.0.0.dist-info}/top_level.txt +0 -0
teradataml/common/utils.py
CHANGED
|
@@ -1,2500 +1,2418 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Unpublished work.
|
|
4
|
-
Copyright (c) 2018 by Teradata Corporation. All rights reserved.
|
|
5
|
-
TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
|
|
6
|
-
|
|
7
|
-
Primary Owner: mounika.kotha@teradata.com
|
|
8
|
-
Secondary Owner:
|
|
9
|
-
|
|
10
|
-
This is a common class to include common functionality required
|
|
11
|
-
by other classes which can be reused according to the need.
|
|
12
|
-
|
|
13
|
-
Add all the common functions in this class like creating temporary table names, getting
|
|
14
|
-
the datatypes etc.
|
|
15
|
-
"""
|
|
16
|
-
import uuid
|
|
17
|
-
from math import floor
|
|
18
|
-
import os, itertools
|
|
19
|
-
import time
|
|
20
|
-
import re, requests
|
|
21
|
-
import sqlalchemy
|
|
22
|
-
from pathlib import Path
|
|
23
|
-
from numpy import number
|
|
24
|
-
from sqlalchemy import Column, MetaData, Table
|
|
25
|
-
from teradataml import
|
|
26
|
-
|
|
27
|
-
from teradataml
|
|
28
|
-
from teradataml.
|
|
29
|
-
from teradataml.common.
|
|
30
|
-
from teradataml.common.
|
|
31
|
-
from teradataml.common import
|
|
32
|
-
from teradataml.common.
|
|
33
|
-
from teradataml.common
|
|
34
|
-
from teradataml.common.
|
|
35
|
-
from teradataml.common.constants import
|
|
36
|
-
|
|
37
|
-
from teradataml.common.
|
|
38
|
-
|
|
39
|
-
from teradataml.
|
|
40
|
-
from teradataml.
|
|
41
|
-
|
|
42
|
-
from
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
from teradatasqlalchemy.types import (
|
|
46
|
-
|
|
47
|
-
from teradatasqlalchemy.types import (
|
|
48
|
-
from
|
|
49
|
-
import
|
|
50
|
-
from
|
|
51
|
-
|
|
52
|
-
from
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def
|
|
207
|
-
"""
|
|
208
|
-
Returns the
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
""
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
"""
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
UtilFuncs.
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
"""
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
""
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
if
|
|
1237
|
-
return
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
return
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
"""
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
PARAMETERS:
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
@staticmethod
|
|
1701
|
-
def
|
|
1702
|
-
"""
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
PARAMETERS:
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
RETURNS:
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
RAISES:
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
EXAMPLES:
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
"""
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
Types:
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
PARAMETERS:
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
"""
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
EXAMPLES:
|
|
2166
|
-
|
|
2167
|
-
"""
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
Specifies the
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
""
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
'm': 'm',
|
|
2420
|
-
'n': 'n',
|
|
2421
|
-
'o': 'o',
|
|
2422
|
-
'p': 'p',
|
|
2423
|
-
'q': 'q',
|
|
2424
|
-
'r': 'r',
|
|
2425
|
-
's': 's',
|
|
2426
|
-
't': 't',
|
|
2427
|
-
'u': 'u',
|
|
2428
|
-
'v': 'v',
|
|
2429
|
-
'w': 'w',
|
|
2430
|
-
'x': 'x',
|
|
2431
|
-
'y': 'y',
|
|
2432
|
-
'z': 'z',
|
|
2433
|
-
'0': '0',
|
|
2434
|
-
'1': '1',
|
|
2435
|
-
'2': '2',
|
|
2436
|
-
'3': '3',
|
|
2437
|
-
'4': '4',
|
|
2438
|
-
'5': '5',
|
|
2439
|
-
'6': '6',
|
|
2440
|
-
'7': '7',
|
|
2441
|
-
'8': '8',
|
|
2442
|
-
'9': '9'}
|
|
2443
|
-
char_dict.update({" ": "", "_": "_", "\"": ""})
|
|
2444
|
-
if addon:
|
|
2445
|
-
char_dict.update(addon)
|
|
2446
|
-
return reduce(lambda x,y: x+y, (char_dict.get(c, replace_char) for c in str_value))
|
|
2447
|
-
|
|
2448
|
-
@staticmethod
|
|
2449
|
-
def _get_dict_from_libs(lib_name):
|
|
2450
|
-
"""
|
|
2451
|
-
DESCRIPTION:
|
|
2452
|
-
Function to format the list of library version string to a dictionary,
|
|
2453
|
-
on the basis of regex.
|
|
2454
|
-
|
|
2455
|
-
PARAMETERS:
|
|
2456
|
-
lib_name:
|
|
2457
|
-
Required Argument.
|
|
2458
|
-
Specifies the libs the user wants to format to a dictionary with
|
|
2459
|
-
key as lib_name and value as lib_version.
|
|
2460
|
-
Types: str, list of str
|
|
2461
|
-
|
|
2462
|
-
RETURNS:
|
|
2463
|
-
dict
|
|
2464
|
-
"""
|
|
2465
|
-
result = {}
|
|
2466
|
-
if isinstance(lib_name, str):
|
|
2467
|
-
lib_name = UtilFuncs._as_list(lib_name)
|
|
2468
|
-
for lib in lib_name:
|
|
2469
|
-
matches = re.findall(r'([^<>=]+)([<>=].*)', lib)
|
|
2470
|
-
if matches:
|
|
2471
|
-
for key, value in matches:
|
|
2472
|
-
result[key] = value
|
|
2473
|
-
else:
|
|
2474
|
-
result[lib] = ''
|
|
2475
|
-
return result
|
|
2476
|
-
|
|
2477
|
-
@staticmethod
|
|
2478
|
-
def _is_valid_td_type(type_):
|
|
2479
|
-
"""
|
|
2480
|
-
DESCRIPTION:
|
|
2481
|
-
Function to check whether it is valid teradatasqlalchemy type or not.
|
|
2482
|
-
|
|
2483
|
-
PARAMETERS:
|
|
2484
|
-
type_:
|
|
2485
|
-
Required Argument.
|
|
2486
|
-
Specifies any value which needs to be validated for teradatasqlalchemy type.
|
|
2487
|
-
Types: Any python object
|
|
2488
|
-
|
|
2489
|
-
RETURNS:
|
|
2490
|
-
bool
|
|
2491
|
-
"""
|
|
2492
|
-
if isinstance(type_, _TDType):
|
|
2493
|
-
return True
|
|
2494
|
-
if isinstance(type_, type) and issubclass(type_, _TDType):
|
|
2495
|
-
return True
|
|
2496
|
-
return False
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
from teradataml.common.aed_utils import AedUtils
|
|
2500
|
-
from teradataml.dbutils.filemgr import remove_file
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Unpublished work.
|
|
4
|
+
Copyright (c) 2018 by Teradata Corporation. All rights reserved.
|
|
5
|
+
TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
|
|
6
|
+
|
|
7
|
+
Primary Owner: mounika.kotha@teradata.com
|
|
8
|
+
Secondary Owner:
|
|
9
|
+
|
|
10
|
+
This is a common class to include common functionality required
|
|
11
|
+
by other classes which can be reused according to the need.
|
|
12
|
+
|
|
13
|
+
Add all the common functions in this class like creating temporary table names, getting
|
|
14
|
+
the datatypes etc.
|
|
15
|
+
"""
|
|
16
|
+
import uuid
|
|
17
|
+
from math import floor
|
|
18
|
+
import os, itertools
|
|
19
|
+
import time
|
|
20
|
+
import re, requests
|
|
21
|
+
import sqlalchemy
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from numpy import number
|
|
24
|
+
from sqlalchemy import Column, MetaData, Table
|
|
25
|
+
from teradataml.context.context import get_connection
|
|
26
|
+
|
|
27
|
+
from teradataml import _version
|
|
28
|
+
from teradataml.context import context as tdmlctx
|
|
29
|
+
from teradataml.common.exceptions import TeradataMlException
|
|
30
|
+
from teradataml.common.messages import Messages
|
|
31
|
+
from teradataml.common.messagecodes import MessageCodes
|
|
32
|
+
from teradataml.common.sqlbundle import SQLBundle
|
|
33
|
+
from teradataml.common import td_coltype_code_to_tdtype
|
|
34
|
+
from teradataml.common.constants import PythonTypes
|
|
35
|
+
from teradataml.common.constants import TeradataTypes
|
|
36
|
+
from teradataml.common.garbagecollector import GarbageCollector
|
|
37
|
+
from teradataml.common.constants import TeradataConstants, PTITableConstants, \
|
|
38
|
+
TableOperatorConstants, HTTPRequest
|
|
39
|
+
from teradataml.common.warnings import VantageRuntimeWarning
|
|
40
|
+
from teradataml.options.configure import configure
|
|
41
|
+
from teradataml.options.display import display
|
|
42
|
+
from teradataml.common.constants import TeradataReservedKeywords, TeradataConstants
|
|
43
|
+
|
|
44
|
+
from teradatasqlalchemy.types import _TDType
|
|
45
|
+
from teradatasqlalchemy.types import (INTEGER, SMALLINT, BIGINT, BYTEINT,
|
|
46
|
+
DECIMAL, FLOAT, NUMBER)
|
|
47
|
+
from teradatasqlalchemy.types import (DATE, TIME, TIMESTAMP)
|
|
48
|
+
from teradatasqlalchemy.types import (BYTE, VARBYTE, BLOB)
|
|
49
|
+
from teradatasqlalchemy.types import (CHAR, VARCHAR, CLOB)
|
|
50
|
+
from functools import reduce
|
|
51
|
+
import warnings
|
|
52
|
+
from teradatasqlalchemy.telemetry.queryband import set_queryband, collect_queryband, get_qb_query
|
|
53
|
+
from teradataml.utils.utils import execute_sql
|
|
54
|
+
from teradataml.utils.validators import _Validators
|
|
55
|
+
from sqlalchemy.exc import OperationalError as sqlachemyOperationalError
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class UtilFuncs():
|
|
59
|
+
def _get_numeric_datatypes(self):
|
|
60
|
+
"""
|
|
61
|
+
Returns the numeric data types used in Teradata Vantage
|
|
62
|
+
**From : https://www.info.teradata.com/HTMLPubs/DB_TTU_16_00/
|
|
63
|
+
index.html#page/General_Reference/B035-1091-160K/psa1472241434371.html
|
|
64
|
+
|
|
65
|
+
PARAMETERS:
|
|
66
|
+
None
|
|
67
|
+
|
|
68
|
+
RAISES:
|
|
69
|
+
None
|
|
70
|
+
|
|
71
|
+
RETURNS:
|
|
72
|
+
List of numeric data types used in Teradata Vantage
|
|
73
|
+
"""
|
|
74
|
+
return [BYTEINT, SMALLINT, INTEGER, BIGINT, DECIMAL, FLOAT, NUMBER]
|
|
75
|
+
|
|
76
|
+
def _get_timedate_datatypes(self):
|
|
77
|
+
"""
|
|
78
|
+
Returns a list of TimeDate data types.
|
|
79
|
+
|
|
80
|
+
PARAMETERS:
|
|
81
|
+
None
|
|
82
|
+
|
|
83
|
+
RAISES:
|
|
84
|
+
None
|
|
85
|
+
|
|
86
|
+
RETURNS:
|
|
87
|
+
List of TimeDate data types used in Teradata Vantage
|
|
88
|
+
"""
|
|
89
|
+
return [TIMESTAMP, DATE, TIME]
|
|
90
|
+
|
|
91
|
+
def _get_character_datatypes(self):
|
|
92
|
+
"""
|
|
93
|
+
Returns a list of Character data types.
|
|
94
|
+
|
|
95
|
+
PARAMETERS:
|
|
96
|
+
None
|
|
97
|
+
|
|
98
|
+
RAISES:
|
|
99
|
+
None
|
|
100
|
+
|
|
101
|
+
RETURNS:
|
|
102
|
+
List of Character data types used in Teradata Vantage
|
|
103
|
+
"""
|
|
104
|
+
return [CHAR, VARCHAR, CLOB]
|
|
105
|
+
|
|
106
|
+
def _get_byte_datatypes(self):
|
|
107
|
+
"""
|
|
108
|
+
Returns a list of byte like data types.
|
|
109
|
+
|
|
110
|
+
PARAMETERS:
|
|
111
|
+
None
|
|
112
|
+
|
|
113
|
+
RAISES:
|
|
114
|
+
None
|
|
115
|
+
|
|
116
|
+
RETURNS:
|
|
117
|
+
List of Byte data types used in Teradata Vantage
|
|
118
|
+
"""
|
|
119
|
+
return [BYTE, VARBYTE, BLOB]
|
|
120
|
+
|
|
121
|
+
def _get_categorical_datatypes(self):
|
|
122
|
+
"""
|
|
123
|
+
Returns a list of containing Character and TimeDate data types.
|
|
124
|
+
|
|
125
|
+
PARAMETERS:
|
|
126
|
+
None
|
|
127
|
+
|
|
128
|
+
RAISES:
|
|
129
|
+
None
|
|
130
|
+
|
|
131
|
+
RETURNS:
|
|
132
|
+
List of Character and TimeDate data types used in Teradata Vantage
|
|
133
|
+
"""
|
|
134
|
+
return list.__add__(self._get_character_datatypes(), self._get_timedate_datatypes())
|
|
135
|
+
|
|
136
|
+
def _get_all_datatypes(self):
|
|
137
|
+
"""
|
|
138
|
+
Returns a list of Character, Numeric and TimeDate data types.
|
|
139
|
+
|
|
140
|
+
PARAMETERS:
|
|
141
|
+
None
|
|
142
|
+
|
|
143
|
+
RAISES:
|
|
144
|
+
None
|
|
145
|
+
|
|
146
|
+
RETURNS:
|
|
147
|
+
List of Character, Numeric and TimeDate data types used in Teradata Vantage
|
|
148
|
+
"""
|
|
149
|
+
return list.__add__(self._get_categorical_datatypes(), self._get_numeric_datatypes())
|
|
150
|
+
|
|
151
|
+
def _get_db_name_from_dataframe(self, df):
|
|
152
|
+
"""
|
|
153
|
+
DESCRIPTION:
|
|
154
|
+
Function to get database name from teradataml DataFrame.
|
|
155
|
+
|
|
156
|
+
PARAMETERS:
|
|
157
|
+
df:
|
|
158
|
+
Required Argument.
|
|
159
|
+
Specifies the input teradataml DataFrame.
|
|
160
|
+
Types: teradataml DataFrame
|
|
161
|
+
|
|
162
|
+
RETURNS:
|
|
163
|
+
Database name.
|
|
164
|
+
|
|
165
|
+
RAISES:
|
|
166
|
+
None.
|
|
167
|
+
|
|
168
|
+
EXAMPLES:
|
|
169
|
+
UtilFuncs()._get_db_name_from_dataframe(df)
|
|
170
|
+
"""
|
|
171
|
+
if df._table_name is None:
|
|
172
|
+
from teradataml.dataframe.dataframe_utils import DataFrameUtils
|
|
173
|
+
df._table_name = DataFrameUtils()._execute_node_return_db_object_name(df._nodeid,
|
|
174
|
+
df._metaexpr)
|
|
175
|
+
|
|
176
|
+
db_name = self._extract_db_name(df._table_name)
|
|
177
|
+
if db_name is None or db_name == "":
|
|
178
|
+
# Extract db_name from SQLAlchemy Engine URL.
|
|
179
|
+
if 'DATABASE' in tdmlctx.get_context().url.query:
|
|
180
|
+
db_name = tdmlctx.get_context().url.query['DATABASE']
|
|
181
|
+
else:
|
|
182
|
+
db_name = tdmlctx._get_current_databasename()
|
|
183
|
+
else:
|
|
184
|
+
db_name = db_name.replace("\"", "")
|
|
185
|
+
|
|
186
|
+
return db_name
|
|
187
|
+
|
|
188
|
+
@staticmethod
|
|
189
|
+
def _get_valid_aggregate_operations():
|
|
190
|
+
"""
|
|
191
|
+
Returns the list of valid aggregate operations on Teradata Vantage
|
|
192
|
+
|
|
193
|
+
PARAMETERS:
|
|
194
|
+
None
|
|
195
|
+
|
|
196
|
+
RAISES:
|
|
197
|
+
None
|
|
198
|
+
|
|
199
|
+
RETURNS:
|
|
200
|
+
List of valid aggregate operations possible on Teradata Vantage
|
|
201
|
+
"""
|
|
202
|
+
return ['count', 'kurtosis', 'max', 'mean', 'median', 'min', 'percentile', 'skew', 'std',
|
|
203
|
+
'sum', 'unique', 'var']
|
|
204
|
+
|
|
205
|
+
@staticmethod
|
|
206
|
+
def _get_valid_time_series_aggregate_operations():
|
|
207
|
+
"""
|
|
208
|
+
Returns the list of valid aggregate operations on Teradata Vantage
|
|
209
|
+
|
|
210
|
+
PARAMETERS:
|
|
211
|
+
None
|
|
212
|
+
|
|
213
|
+
RAISES:
|
|
214
|
+
None
|
|
215
|
+
|
|
216
|
+
RETURNS:
|
|
217
|
+
List of valid aggregate operations possible on Teradata Vantage
|
|
218
|
+
"""
|
|
219
|
+
return ['bottom', 'bottom with ties', 'delta_t', 'first', 'last', 'mad', 'mode', 'top',
|
|
220
|
+
'top with ties']
|
|
221
|
+
|
|
222
|
+
@staticmethod
|
|
223
|
+
def _generate_temp_table_name(databasename=None, user=None, prefix=None,
|
|
224
|
+
use_default_database=False, gc_on_quit=True, quote=True,
|
|
225
|
+
table_type=TeradataConstants.TERADATA_VIEW):
|
|
226
|
+
"""
|
|
227
|
+
DESCRIPTION:
|
|
228
|
+
Function to return the random string for temporary table names.
|
|
229
|
+
|
|
230
|
+
PARAMETERS:
|
|
231
|
+
databasename:
|
|
232
|
+
Optional Argument.
|
|
233
|
+
Specifies the database name to use while generating the script.
|
|
234
|
+
Types: str
|
|
235
|
+
|
|
236
|
+
user:
|
|
237
|
+
Optional Argument.
|
|
238
|
+
Specifies the current username or database name on which user logged on to Teradata Vantage.
|
|
239
|
+
Types: str
|
|
240
|
+
|
|
241
|
+
prefix:
|
|
242
|
+
Optional Argument.
|
|
243
|
+
Specifies the prefix of the module from which table/view name is requested.
|
|
244
|
+
Types: str
|
|
245
|
+
|
|
246
|
+
use_default_database:
|
|
247
|
+
Optional Argument.
|
|
248
|
+
Specifies whether to create a table or view in the default database when
|
|
249
|
+
"databasename" is not provided.
|
|
250
|
+
Default value: False
|
|
251
|
+
Types: str
|
|
252
|
+
|
|
253
|
+
gc_on_quit:
|
|
254
|
+
Optional Argument.
|
|
255
|
+
Specifies whether to garbage collect the table/view with the generated name
|
|
256
|
+
at the end of the session.
|
|
257
|
+
When 'True', the objects created with the generated name will be garbage
|
|
258
|
+
collected at the end of the session.
|
|
259
|
+
Default value: True
|
|
260
|
+
Types: bool
|
|
261
|
+
|
|
262
|
+
quote:
|
|
263
|
+
Optional Argument.
|
|
264
|
+
Specifies whether to quote the database name and table/view name.
|
|
265
|
+
When 'True', quotes are added around the database name and the table/view name.
|
|
266
|
+
Default value: True
|
|
267
|
+
Types: bool
|
|
268
|
+
|
|
269
|
+
table_type:
|
|
270
|
+
Optional Argument.
|
|
271
|
+
Specifies the type of objects - table or view.
|
|
272
|
+
Default value: TeradataConstants.TERADATA_VIEW
|
|
273
|
+
Types: TeradataConstant
|
|
274
|
+
|
|
275
|
+
RETURNS:
|
|
276
|
+
Temporary table name.
|
|
277
|
+
|
|
278
|
+
RAISES:
|
|
279
|
+
|
|
280
|
+
EXAMPLES:
|
|
281
|
+
new_table_name = UtilFuncs._generate_temp_table_name(user='tdqg', prefix="from_pandas")
|
|
282
|
+
new_table_name = UtilFuncs._generate_temp_table_name(user='tdqg', prefix="from_pandas",
|
|
283
|
+
table_type = TeradataConstants.TERADATA_VIEW)
|
|
284
|
+
new_table_name = UtilFuncs._generate_temp_table_name(user='tdqg', prefix="from_pandas",
|
|
285
|
+
table_type = TeradataConstants.TERADATA_TABLE)
|
|
286
|
+
|
|
287
|
+
Output:
|
|
288
|
+
tdml_temp_table__1517501990393350 (or)
|
|
289
|
+
tdqg.tdml_temp_table__1517501990393350 (or)
|
|
290
|
+
tdml_temp_table__from_pandas_1517501990393350 (or)
|
|
291
|
+
tdqg.tdml_temp_table__from_pandas_1517501990393350
|
|
292
|
+
"""
|
|
293
|
+
# Number of seconds since Jan 1, 1970 00:00:00
|
|
294
|
+
timestamp = time.time()
|
|
295
|
+
tabname = "ml_"
|
|
296
|
+
random_string = "{}{}".format(floor(timestamp / 1000000),
|
|
297
|
+
floor(timestamp % 1000000 * 1000000 +
|
|
298
|
+
int(str(uuid.uuid4().fields[-1])[:10])))
|
|
299
|
+
if prefix is not None:
|
|
300
|
+
tabname = "{}_{}".format(tabname, prefix)
|
|
301
|
+
|
|
302
|
+
tabname = "{}_{}".format(tabname, random_string)
|
|
303
|
+
|
|
304
|
+
if use_default_database and databasename is None:
|
|
305
|
+
tabname = "\"{}\".\"{}\"".format(tdmlctx._get_context_temp_databasename(
|
|
306
|
+
table_type=table_type), tabname)
|
|
307
|
+
|
|
308
|
+
if user is not None:
|
|
309
|
+
tabname = "\"{}\".\"{}\"".format(user, tabname)
|
|
310
|
+
|
|
311
|
+
if databasename is not None:
|
|
312
|
+
tabname = "\"{}\".\"{}\"".format(databasename, tabname)
|
|
313
|
+
|
|
314
|
+
# Enable garbage collection for the temporary view & table created while transformations.
|
|
315
|
+
if gc_on_quit:
|
|
316
|
+
GarbageCollector._add_to_garbagecollector(tabname, table_type)
|
|
317
|
+
|
|
318
|
+
return tabname
|
|
319
|
+
|
|
320
|
+
@staticmethod
|
|
321
|
+
def _generate_temp_script_name(database_name=None, prefix=None, use_default_database=True,
|
|
322
|
+
gc_on_quit=True, quote=True,
|
|
323
|
+
script_type=TeradataConstants.TERADATA_SCRIPT,
|
|
324
|
+
extension=None):
|
|
325
|
+
"""
|
|
326
|
+
DESCRIPTION:
|
|
327
|
+
Function to return the random string for temporary script names.
|
|
328
|
+
|
|
329
|
+
PARAMETERS:
|
|
330
|
+
database_name:
|
|
331
|
+
Optional Argument:
|
|
332
|
+
Specifies the database name on which user logged on to Teradata Vantage.
|
|
333
|
+
Types: str
|
|
334
|
+
|
|
335
|
+
prefix:
|
|
336
|
+
Optional Argument.
|
|
337
|
+
Specifies the prefix of the module or function from which script name is requested.
|
|
338
|
+
Types: str
|
|
339
|
+
|
|
340
|
+
use_default_database:
|
|
341
|
+
Optional Argument.
|
|
342
|
+
Specifies whether the script will be installed in the default/connected database.
|
|
343
|
+
When 'True', the current/default database name will be used for generating the name.
|
|
344
|
+
Default value: True
|
|
345
|
+
Types: bool
|
|
346
|
+
|
|
347
|
+
gc_on_quit:
|
|
348
|
+
Optional Argument.
|
|
349
|
+
Specifies whether to garbage collect the object with the generated name
|
|
350
|
+
at the end of the session.
|
|
351
|
+
When 'True', the objects created with the generated name will be garbage
|
|
352
|
+
collected at the end of the session.
|
|
353
|
+
Default value: True
|
|
354
|
+
Types: bool
|
|
355
|
+
|
|
356
|
+
quote:
|
|
357
|
+
Optional Argument.
|
|
358
|
+
Specifies whether to quote the database name and script name.
|
|
359
|
+
When 'True', quotes are added around the database name and the script name.
|
|
360
|
+
Default value: True
|
|
361
|
+
Types: bool
|
|
362
|
+
|
|
363
|
+
script_type:
|
|
364
|
+
Optional Argument.
|
|
365
|
+
Specifies the type of script.
|
|
366
|
+
Default value: TeradataConstants.TERADATA_SCRIPT
|
|
367
|
+
Types: TeradataConstant
|
|
368
|
+
|
|
369
|
+
extension:
|
|
370
|
+
Optional Argument.
|
|
371
|
+
Specifies the extension of the script.
|
|
372
|
+
Default value: None
|
|
373
|
+
Types: str
|
|
374
|
+
|
|
375
|
+
RETURNS:
|
|
376
|
+
Temporary script name.
|
|
377
|
+
|
|
378
|
+
RAISES:
|
|
379
|
+
None.
|
|
380
|
+
|
|
381
|
+
EXAMPLES:
|
|
382
|
+
new_script_name = UtilFuncs._generate_temp_script_name(use_default_database=True,
|
|
383
|
+
script_type = TeradataConstants.TERADATA_SCRIPT)
|
|
384
|
+
"""
|
|
385
|
+
# NOTE:
|
|
386
|
+
# 1. There can be other types of scripts going forward which may require their own type (like for Apply).
|
|
387
|
+
# Hence, we have a 'script_type' argument which currently has only one possible value.
|
|
388
|
+
# 2. Currently map_row and map_partition use only default database, but going forward this can be changed
|
|
389
|
+
# to use other databases for installation of script, using 'database_name'.
|
|
390
|
+
|
|
391
|
+
timestamp = time.time()
|
|
392
|
+
script_name = "ml_"
|
|
393
|
+
|
|
394
|
+
random_string = "{}{}".format(floor(timestamp / 1000000),
|
|
395
|
+
floor(timestamp % 1000000 * 1000000 +
|
|
396
|
+
int(str(uuid.uuid4().fields[-1])[:10])))
|
|
397
|
+
|
|
398
|
+
if prefix is not None:
|
|
399
|
+
script_name = "{}_{}".format(script_name, prefix)
|
|
400
|
+
|
|
401
|
+
script_name = "{}_{}".format(script_name, random_string)
|
|
402
|
+
|
|
403
|
+
if extension is not None:
|
|
404
|
+
script_name = "{}.{}".format(script_name, extension)
|
|
405
|
+
|
|
406
|
+
dbname_to_use = tdmlctx._get_current_databasename()
|
|
407
|
+
if not use_default_database and database_name is not None:
|
|
408
|
+
dbname_to_use = database_name
|
|
409
|
+
|
|
410
|
+
script_name = "\"{}\".\"{}\"".format(dbname_to_use, script_name)
|
|
411
|
+
|
|
412
|
+
# Enable garbage collection for the temporary script created.
|
|
413
|
+
if gc_on_quit:
|
|
414
|
+
GarbageCollector._add_to_garbagecollector(script_name, script_type)
|
|
415
|
+
|
|
416
|
+
return script_name
|
|
417
|
+
|
|
418
|
+
@staticmethod
|
|
419
|
+
def _serialize_and_encode(obj):
|
|
420
|
+
"""
|
|
421
|
+
DESCRIPTION:
|
|
422
|
+
Internal utility to serialize any Python object (including functions)
|
|
423
|
+
using dill and encode using base64.
|
|
424
|
+
|
|
425
|
+
PARAMETERS:
|
|
426
|
+
obj:
|
|
427
|
+
Specifies the Python object to serialize and encode.
|
|
428
|
+
Types: object
|
|
429
|
+
|
|
430
|
+
RAISES:
|
|
431
|
+
None.
|
|
432
|
+
|
|
433
|
+
RETURNS:
|
|
434
|
+
An encoded byte string representing the serialized object 'obj'.
|
|
435
|
+
|
|
436
|
+
EXAMPLES:
|
|
437
|
+
>>> # Serializing and encoding a literal value
|
|
438
|
+
>>> literal = UtilFuncs._serialize_and_encode('literal value')
|
|
439
|
+
>>> # Serializing and encoding a function
|
|
440
|
+
>>> def udf(a, b): return a + b
|
|
441
|
+
>>> func = UtilFuncs._serialize_and_encode(udf)
|
|
442
|
+
"""
|
|
443
|
+
from dill import dumps as dill_dumps
|
|
444
|
+
from base64 import b64encode as base64_b64encode
|
|
445
|
+
|
|
446
|
+
return base64_b64encode(dill_dumps(obj, recurse=True))
|
|
447
|
+
|
|
448
|
+
@staticmethod
|
|
449
|
+
def _quote_table_names(table_name):
|
|
450
|
+
"""
|
|
451
|
+
Quotes table names or view names.
|
|
452
|
+
If the table name is in the format schema.table_name, it will quote the
|
|
453
|
+
schema name and table name.
|
|
454
|
+
|
|
455
|
+
Example:
|
|
456
|
+
mytab -> "my.tab"
|
|
457
|
+
schema.mytable -> "schema"."my.tab"
|
|
458
|
+
myview -> "myview"
|
|
459
|
+
|
|
460
|
+
PARAMETERS:
|
|
461
|
+
table_name - The name of table or view. The name can include the schema (e.g. schema.table_name)
|
|
462
|
+
|
|
463
|
+
RETURNS:
|
|
464
|
+
returns the quoted table name.
|
|
465
|
+
|
|
466
|
+
RAISES:
|
|
467
|
+
|
|
468
|
+
EXAMPLES:
|
|
469
|
+
table_name = UtilFuncs._quote_table_names(table_name)
|
|
470
|
+
|
|
471
|
+
"""
|
|
472
|
+
table_name_list = re.findall('".+?"', table_name)
|
|
473
|
+
if table_name_list:
|
|
474
|
+
for i in range(0, len(table_name_list)):
|
|
475
|
+
if not (table_name_list[i].startswith("\"") and table_name_list[i].endswith("\"")):
|
|
476
|
+
table_name_list[i] = UtilFuncs._teradata_quote_arg(table_name_list[i], "\"", False)
|
|
477
|
+
|
|
478
|
+
return ".".join(table_name_list)
|
|
479
|
+
else:
|
|
480
|
+
return "\"{}\"".format(table_name)
|
|
481
|
+
|
|
482
|
+
@staticmethod
|
|
483
|
+
def _execute_ddl_statement(ddl_statement):
|
|
484
|
+
"""
|
|
485
|
+
Executes a DDL statment and commits transaction
|
|
486
|
+
This is an internal function.
|
|
487
|
+
|
|
488
|
+
PARAMETERS:
|
|
489
|
+
ddl_statement - Teradata DDL statement.
|
|
490
|
+
|
|
491
|
+
RETURNS:
|
|
492
|
+
|
|
493
|
+
RAISES:
|
|
494
|
+
Database error if an error occurred while executing the DDL statement.
|
|
495
|
+
|
|
496
|
+
EXAMPLES:
|
|
497
|
+
UtilFuncs._execute_ddl_statement('create table mytab (col1 int, col2 varchar(20))')
|
|
498
|
+
|
|
499
|
+
"""
|
|
500
|
+
# Empty queryband buffer before SQL call.
|
|
501
|
+
UtilFuncs._set_queryband()
|
|
502
|
+
# Let's execute our DDL statement with escape function '{fn teradata_fake_result_sets}'
|
|
503
|
+
# offered by teradatasql driver. This function will allow us catch any warnings thrown
|
|
504
|
+
# from the Vantage. Hence, executing the DDL statement with this escape function.
|
|
505
|
+
ddl_statement = "{fn teradata_fake_result_sets} " + ddl_statement
|
|
506
|
+
|
|
507
|
+
if tdmlctx.td_connection is not None:
|
|
508
|
+
cursor = None
|
|
509
|
+
try:
|
|
510
|
+
conn = tdmlctx.td_connection.connection
|
|
511
|
+
cursor = conn.cursor()
|
|
512
|
+
cursor.execute(ddl_statement)
|
|
513
|
+
|
|
514
|
+
# Warnings are displayed when the "suppress_vantage_runtime_warnings" attribute is set to 'False'.
|
|
515
|
+
if not display.suppress_vantage_runtime_warnings:
|
|
516
|
+
# Fetch the result set just to check whether we have received any warnings or not.
|
|
517
|
+
warnRes = cursor.fetchone()
|
|
518
|
+
# Check for "display.suppress_vantage_runtime_warnings" set to 'True'.
|
|
519
|
+
# Check for warning code and warning message
|
|
520
|
+
# warnRes[5] contains the Warning Code
|
|
521
|
+
# warnRes[6] contains the actual Warning Message
|
|
522
|
+
if warnRes[5] != 0 and warnRes[6] != "":
|
|
523
|
+
# Raise warning raised from Vantage as is.
|
|
524
|
+
warnings.simplefilter("always")
|
|
525
|
+
msg_ = Messages.get_message(MessageCodes.VANTAGE_WARNING)
|
|
526
|
+
warnings.warn(msg_.format(warnRes[5], warnRes[6]), VantageRuntimeWarning)
|
|
527
|
+
|
|
528
|
+
conn.commit()
|
|
529
|
+
except:
|
|
530
|
+
# logger.debug("Got exception while executing ({0})".format(teradataSQL))
|
|
531
|
+
raise
|
|
532
|
+
finally:
|
|
533
|
+
if cursor:
|
|
534
|
+
cursor.close()
|
|
535
|
+
else:
|
|
536
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.CONNECTION_FAILURE),
|
|
537
|
+
MessageCodes.CONNECTION_FAILURE)
|
|
538
|
+
|
|
539
|
+
@staticmethod
|
|
540
|
+
def _execute_query(query, fetchWarnings=False, expect_none_result=False):
|
|
541
|
+
"""
|
|
542
|
+
Retrieves result set data from query.
|
|
543
|
+
|
|
544
|
+
PARAMETERS:
|
|
545
|
+
query:
|
|
546
|
+
Required Argument.
|
|
547
|
+
Specifies the SQL query to execute.
|
|
548
|
+
Types: str
|
|
549
|
+
|
|
550
|
+
fetchWarnings:
|
|
551
|
+
Optional Argument.
|
|
552
|
+
Specifies a flag that decides whether to raise warnings thrown from Vanatge or not.
|
|
553
|
+
Default Values: False
|
|
554
|
+
Types: bool
|
|
555
|
+
|
|
556
|
+
expect_none_result:
|
|
557
|
+
Optional Argument.
|
|
558
|
+
When set to True, warnings will not be fetched and only result set is fetched.
|
|
559
|
+
Returns None if no result set is received from the backend.
|
|
560
|
+
When fetchWarnings is set to True this option is ignored.
|
|
561
|
+
Default Values: False
|
|
562
|
+
Types: bool
|
|
563
|
+
|
|
564
|
+
RETURNS:
|
|
565
|
+
Returns only result set from query if 'fetchWarnings' is False. If set to True, then
|
|
566
|
+
return result set and columns for the result set.
|
|
567
|
+
|
|
568
|
+
RAISES:
|
|
569
|
+
Database error if an error occurred while executing query.
|
|
570
|
+
|
|
571
|
+
EXAMPLES:
|
|
572
|
+
result = UtilFuncs._execute_query('select col1, col2 from mytab')
|
|
573
|
+
result = UtilFuncs._execute_query('help column mytab.*')
|
|
574
|
+
|
|
575
|
+
result = UtilFuncs._execute_query('help column mytab.*')
|
|
576
|
+
|
|
577
|
+
# Execute the stored procedure using fetchWarnings.
|
|
578
|
+
UtilFuncs._execute_query("call SYSUIF.INSTALL_FILE('myfile',
|
|
579
|
+
'filename.py',
|
|
580
|
+
'cb!/Documents/filename.py')",
|
|
581
|
+
True, False)
|
|
582
|
+
|
|
583
|
+
# Execute the stored procedure without fetchWarnings but still needs resultsets.
|
|
584
|
+
UtilFuncs._execute_query("call SYSUIF.list_base_environments()", False, True)
|
|
585
|
+
|
|
586
|
+
"""
|
|
587
|
+
# Empty queryband buffer before SQL call.
|
|
588
|
+
UtilFuncs._set_queryband()
|
|
589
|
+
|
|
590
|
+
if fetchWarnings:
|
|
591
|
+
# Let's execute our DDL statement with escape function '{fn teradata_fake_result_sets}'
|
|
592
|
+
# offered by teradatasql driver. This function will allow us catch any warnings thrown
|
|
593
|
+
# from the Vantage. Hence, executing the DDL statement with this escape function.
|
|
594
|
+
query = "{fn teradata_fake_result_sets} " + query
|
|
595
|
+
|
|
596
|
+
if tdmlctx.td_connection is not None:
|
|
597
|
+
cursor = None
|
|
598
|
+
try:
|
|
599
|
+
conn = tdmlctx.td_connection.connection
|
|
600
|
+
cursor = conn.cursor()
|
|
601
|
+
cursor.execute(query)
|
|
602
|
+
|
|
603
|
+
if fetchWarnings:
|
|
604
|
+
# Fetch the result set just to check whether we have received any warnings or not.
|
|
605
|
+
warnRes = cursor.fetchone()
|
|
606
|
+
# Check for warning code and warning message
|
|
607
|
+
# warnRes[5] contains the Warning Code
|
|
608
|
+
# warnRes[6] contains the actual Warning Message
|
|
609
|
+
if (warnRes[5] != 0 and warnRes[6] != "") and not display.suppress_vantage_runtime_warnings:
|
|
610
|
+
# Raise warning raised from Vantage as is.
|
|
611
|
+
warnings.simplefilter("always")
|
|
612
|
+
msg_ = Messages.get_message(MessageCodes.VANTAGE_WARNING)
|
|
613
|
+
warnings.warn(msg_.format(warnRes[5], warnRes[6]), VantageRuntimeWarning)
|
|
614
|
+
|
|
615
|
+
cursor.nextset()
|
|
616
|
+
|
|
617
|
+
return cursor.fetchall(), [col_desc[0] for col_desc in cursor.description]
|
|
618
|
+
|
|
619
|
+
# This check may be removed if DBS side stored procedure are fixed to return empty
|
|
620
|
+
# result sets with columns in cursor.description
|
|
621
|
+
elif expect_none_result:
|
|
622
|
+
cursor.nextset()
|
|
623
|
+
# Some stored procedure returns None if result set has no rows.
|
|
624
|
+
# cannot use fetchall call in such cases. If SPs are fixed to support result sets with zero
|
|
625
|
+
# rows then below call may be removed in the future.
|
|
626
|
+
if cursor.rowcount <= 0:
|
|
627
|
+
return None, None
|
|
628
|
+
return cursor.fetchall(), [col_desc[0] for col_desc in cursor.description]
|
|
629
|
+
|
|
630
|
+
else:
|
|
631
|
+
return cursor.fetchall()
|
|
632
|
+
except:
|
|
633
|
+
raise
|
|
634
|
+
finally:
|
|
635
|
+
if cursor:
|
|
636
|
+
cursor.close()
|
|
637
|
+
else:
|
|
638
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.CONNECTION_FAILURE),
|
|
639
|
+
MessageCodes.CONNECTION_FAILURE)
|
|
640
|
+
|
|
641
|
+
@staticmethod
|
|
642
|
+
@collect_queryband(queryband='CreateView')
|
|
643
|
+
def _create_view(view_name, query):
|
|
644
|
+
"""
|
|
645
|
+
Create a view from the given query.
|
|
646
|
+
|
|
647
|
+
PARAMETERS:
|
|
648
|
+
view_name - View name
|
|
649
|
+
query - SQL query
|
|
650
|
+
|
|
651
|
+
RAISES
|
|
652
|
+
|
|
653
|
+
RETURNS:
|
|
654
|
+
True if success.
|
|
655
|
+
|
|
656
|
+
EXAMPLES:
|
|
657
|
+
UtilFuncs._create_view(view_name, "select * from table_name")
|
|
658
|
+
"""
|
|
659
|
+
crt_view = SQLBundle._build_create_view(view_name, query)
|
|
660
|
+
try:
|
|
661
|
+
UtilFuncs._execute_ddl_statement(crt_view)
|
|
662
|
+
return True
|
|
663
|
+
except:
|
|
664
|
+
raise
|
|
665
|
+
|
|
666
|
+
@staticmethod
|
|
667
|
+
@collect_queryband(queryband='CreateTbl')
|
|
668
|
+
def _create_table(table_name, query, volatile=False):
|
|
669
|
+
"""
|
|
670
|
+
Create a table from the given query.
|
|
671
|
+
|
|
672
|
+
PARAMETERS:
|
|
673
|
+
table_name - Fully qualified quoted table name.
|
|
674
|
+
query - SQL query
|
|
675
|
+
volatile - Specifies whether to create volatile table or not.
|
|
676
|
+
When set to True, volatile table is created, otherwise
|
|
677
|
+
permanent table is created.
|
|
678
|
+
|
|
679
|
+
RAISES
|
|
680
|
+
|
|
681
|
+
RETURNS:
|
|
682
|
+
True if success, false if fails
|
|
683
|
+
|
|
684
|
+
EXAMPLES:
|
|
685
|
+
UtilFuncs._create_table('"dbname"."table_name"', "select * from table_name")
|
|
686
|
+
"""
|
|
687
|
+
crt_table = SQLBundle._build_create_table_with_data(table_name, query)
|
|
688
|
+
if volatile:
|
|
689
|
+
crt_table = SQLBundle._build_create_volatile_table_with_data(table_name, query)
|
|
690
|
+
|
|
691
|
+
UtilFuncs._execute_ddl_statement(crt_table)
|
|
692
|
+
return True
|
|
693
|
+
|
|
694
|
+
@staticmethod
|
|
695
|
+
def _get_non_null_counts(col_names, table_name):
|
|
696
|
+
"""
|
|
697
|
+
Returns a list of non-null count for each column in col_names from table table_name.
|
|
698
|
+
|
|
699
|
+
PARAMETERS:
|
|
700
|
+
col_names - list of column names for table table_name.
|
|
701
|
+
table_name - table name.
|
|
702
|
+
|
|
703
|
+
RETURNS:
|
|
704
|
+
returns a list of non-null counts for each column.
|
|
705
|
+
|
|
706
|
+
RAISES:
|
|
707
|
+
|
|
708
|
+
EXAMPLES:
|
|
709
|
+
UtilFuncs._get_non_null_counts(col_names, 'mytab')
|
|
710
|
+
|
|
711
|
+
"""
|
|
712
|
+
count_col_names = ["count(\"{0}\")".format(name) for name in col_names]
|
|
713
|
+
select_count = "select {0} from {1}".format(", ".join(count_col_names), table_name)
|
|
714
|
+
result = UtilFuncs._execute_query(select_count)
|
|
715
|
+
return [str(i) for i in result[0]]
|
|
716
|
+
|
|
717
|
+
@staticmethod
|
|
718
|
+
@collect_queryband(queryband='CreateVolaTbl')
|
|
719
|
+
def _get_volatile_table(query, with_data=False):
|
|
720
|
+
"""
|
|
721
|
+
Creates a volatile table as query.
|
|
722
|
+
If with_data is True, creates the volatile table with data.
|
|
723
|
+
Else, creates the volatile table without data.
|
|
724
|
+
|
|
725
|
+
PARAMETERS:
|
|
726
|
+
query - The query used to create the volatile table.
|
|
727
|
+
with_data(optional) - True, creates table with data.
|
|
728
|
+
False, creates table without data. Default is False
|
|
729
|
+
|
|
730
|
+
RETURNS:
|
|
731
|
+
returns the temporary name of the volatile table.
|
|
732
|
+
|
|
733
|
+
RAISES:
|
|
734
|
+
Database error if an error occurred while creating the volatile table.
|
|
735
|
+
|
|
736
|
+
EXAMPLES:
|
|
737
|
+
UtilFuncs._get_volatile_table('select col1, col2, from mytab')
|
|
738
|
+
UtilFuncs._get_volatile_table('select col1, col2, from mytab', with_data=True)
|
|
739
|
+
|
|
740
|
+
"""
|
|
741
|
+
vtab_name = UtilFuncs._generate_temp_table_name()
|
|
742
|
+
if with_data:
|
|
743
|
+
create_vtab_ddl = SQLBundle._build_create_volatile_table_with_data(vtab_name, query)
|
|
744
|
+
else:
|
|
745
|
+
create_vtab_ddl = SQLBundle._build_create_volatile_table_without_data(vtab_name, query)
|
|
746
|
+
UtilFuncs._execute_ddl_statement(create_vtab_ddl)
|
|
747
|
+
return vtab_name
|
|
748
|
+
|
|
749
|
+
@staticmethod
|
|
750
|
+
def _drop_table(table_name, check_table_exist=True):
|
|
751
|
+
"""
|
|
752
|
+
Drops a table.
|
|
753
|
+
|
|
754
|
+
PARAMETERS:
|
|
755
|
+
table_name - The table to drop.
|
|
756
|
+
check_table_exist - Checks if the table exist before dropping the table.
|
|
757
|
+
|
|
758
|
+
RETURNS:
|
|
759
|
+
True - if the table is dropped.
|
|
760
|
+
|
|
761
|
+
RAISES:
|
|
762
|
+
Database error if an error occurred while dropping the table.
|
|
763
|
+
|
|
764
|
+
EXAMPLES:
|
|
765
|
+
UtilFuncs._drop_table('mytab')
|
|
766
|
+
UtilFuncs._drop_table('mytab', check_table_exist = False)
|
|
767
|
+
UtilFuncs._drop_table('mydb.mytab', check_table_exist = False)
|
|
768
|
+
UtilFuncs._drop_table("mydb"."mytab", check_table_exist = True)
|
|
769
|
+
|
|
770
|
+
"""
|
|
771
|
+
drop_tab = SQLBundle._build_drop_table(table_name)
|
|
772
|
+
if check_table_exist is True:
|
|
773
|
+
helptable = UtilFuncs._get_help_tablename(table_name)
|
|
774
|
+
if helptable:
|
|
775
|
+
UtilFuncs._execute_ddl_statement(drop_tab)
|
|
776
|
+
return True
|
|
777
|
+
else:
|
|
778
|
+
UtilFuncs._execute_ddl_statement(drop_tab)
|
|
779
|
+
return True
|
|
780
|
+
|
|
781
|
+
return False
|
|
782
|
+
|
|
783
|
+
@staticmethod
|
|
784
|
+
def _drop_view(view_name, check_view_exist=True):
|
|
785
|
+
"""
|
|
786
|
+
Drops a view.
|
|
787
|
+
|
|
788
|
+
PARAMETERS:
|
|
789
|
+
view_name - The view to drop.
|
|
790
|
+
check_view_exist - Checks if the view exist before dropping the view.
|
|
791
|
+
|
|
792
|
+
RETURNS:
|
|
793
|
+
True - if the view is dropped.
|
|
794
|
+
|
|
795
|
+
RAISES:
|
|
796
|
+
Database error if an error occurred while dropping the view.
|
|
797
|
+
|
|
798
|
+
EXAMPLES:
|
|
799
|
+
UtilFuncs._drop_view('myview')
|
|
800
|
+
UtilFuncs._drop_view('myview', check_view_exist = False)
|
|
801
|
+
UtilFuncs._drop_view('mydb.myview', check_view_exist = False)
|
|
802
|
+
UtilFuncs._drop_view("mydb"."myview", check_view_exist = True)
|
|
803
|
+
"""
|
|
804
|
+
drop_view = SQLBundle._build_drop_view(view_name)
|
|
805
|
+
if check_view_exist is True:
|
|
806
|
+
viewdetails = UtilFuncs._get_help_viewname(view_name)
|
|
807
|
+
if viewdetails:
|
|
808
|
+
UtilFuncs._execute_ddl_statement(drop_view)
|
|
809
|
+
return True
|
|
810
|
+
else:
|
|
811
|
+
UtilFuncs._execute_ddl_statement(drop_view)
|
|
812
|
+
return True
|
|
813
|
+
|
|
814
|
+
return False
|
|
815
|
+
|
|
816
|
+
@staticmethod
|
|
817
|
+
def _delete_script(script_name, file_type=TeradataConstants.TERADATA_SCRIPT,
|
|
818
|
+
check_script_exist=True):
|
|
819
|
+
"""
|
|
820
|
+
DESCRIPTION:
|
|
821
|
+
Function to remove a user-installed file/script.
|
|
822
|
+
|
|
823
|
+
PARAMETERS:
|
|
824
|
+
script_name:
|
|
825
|
+
Required Argument.
|
|
826
|
+
Specifies the name of the script to remove.
|
|
827
|
+
Types: str
|
|
828
|
+
|
|
829
|
+
file_type:
|
|
830
|
+
Optional Argument.
|
|
831
|
+
Specifies the type of the file to remove, whether it is from
|
|
832
|
+
Enterpise (TeradataConstants.TERADATA_SCRIPT) or from Lake
|
|
833
|
+
(TeradataConstants.TERADATA_APPLY).
|
|
834
|
+
Default value: TeradataConstants.TERADATA_SCRIPT
|
|
835
|
+
Permitted Values: TeradataConstants.TERADATA_SCRIPT, TeradataConstants.TERADATA_APPLY
|
|
836
|
+
Types: TeradataConstants
|
|
837
|
+
|
|
838
|
+
check_script_exist:
|
|
839
|
+
Required Argument. Applicable only when "file_type" is
|
|
840
|
+
TeradataConstants.TERADATA_SCRIPT. Ignored otherwise.
|
|
841
|
+
Specifies whether to check if the script exists or not before removing it.
|
|
842
|
+
When 'True', the presence of the script will be check for.
|
|
843
|
+
Default value: True
|
|
844
|
+
Types: bool
|
|
845
|
+
|
|
846
|
+
RETURNS:
|
|
847
|
+
True - if the script is removed.
|
|
848
|
+
|
|
849
|
+
RAISES:
|
|
850
|
+
Database error if an error occurred while dropping the view.
|
|
851
|
+
|
|
852
|
+
EXAMPLES:
|
|
853
|
+
UtilFuncs._delete_script('myview')
|
|
854
|
+
UtilFuncs._delete_script('myview', check_script_exist = False)
|
|
855
|
+
UtilFuncs._delete_script('mydb.myview', check_script_exist = False)
|
|
856
|
+
UtilFuncs._delete_script("mydb"."myview", check_script_exist = True)
|
|
857
|
+
"""
|
|
858
|
+
dbname = UtilFuncs._teradata_unquote_arg(UtilFuncs._extract_db_name(script_name),
|
|
859
|
+
quote='"')
|
|
860
|
+
script_alias = UtilFuncs._teradata_unquote_arg(UtilFuncs._extract_table_name(script_name),
|
|
861
|
+
quote='"')
|
|
862
|
+
current_db = tdmlctx._get_current_databasename()
|
|
863
|
+
|
|
864
|
+
if file_type == TeradataConstants.TERADATA_SCRIPT:
|
|
865
|
+
script_exists = False
|
|
866
|
+
if check_script_exist:
|
|
867
|
+
query = "select count(*) from dbc.tablesV " \
|
|
868
|
+
"where databasename = '{}' and tablename = '{}' " \
|
|
869
|
+
"and tablekind = 'Z'".format(dbname, script_alias)
|
|
870
|
+
|
|
871
|
+
script_exists = True if UtilFuncs._execute_query(query)[0][0] == 1 else False
|
|
872
|
+
|
|
873
|
+
if script_exists or not check_script_exist:
|
|
874
|
+
try:
|
|
875
|
+
# If the database is not the current/default database, we need to
|
|
876
|
+
# set that as the session database to be able to remove the file.
|
|
877
|
+
if dbname and dbname.lower() != current_db.lower():
|
|
878
|
+
execute_sql('database {}'.format(dbname))
|
|
879
|
+
|
|
880
|
+
# Strip off the file extension and extract the base name.
|
|
881
|
+
from pathlib import Path
|
|
882
|
+
script_base_name = Path(script_alias).stem
|
|
883
|
+
|
|
884
|
+
# Remove the file.
|
|
885
|
+
remove_file(script_base_name, force_remove=True, suppress_output=True)
|
|
886
|
+
return True
|
|
887
|
+
except:
|
|
888
|
+
raise
|
|
889
|
+
finally:
|
|
890
|
+
# Reset the database if it was set to something else.
|
|
891
|
+
if dbname and dbname.lower() != current_db.lower():
|
|
892
|
+
execute_sql('database {}'.format(current_db))
|
|
893
|
+
else:
|
|
894
|
+
# environment name and file name are separated by '::'
|
|
895
|
+
# like <user_env_name(str)>::<apply_script_name>
|
|
896
|
+
env_name, script_alias = script_alias.split('::')
|
|
897
|
+
|
|
898
|
+
from teradataml.scriptmgmt.lls_utils import get_env
|
|
899
|
+
env = get_env(env_name)
|
|
900
|
+
env.remove_file(script_alias, suppress_output=True)
|
|
901
|
+
return True
|
|
902
|
+
|
|
903
|
+
@staticmethod
|
|
904
|
+
def _get_help_vtablenames():
|
|
905
|
+
"""
|
|
906
|
+
Function to get list of volatile tables.
|
|
907
|
+
|
|
908
|
+
RETURNS:
|
|
909
|
+
List of volatile tablenames.
|
|
910
|
+
|
|
911
|
+
EXAMPLES:
|
|
912
|
+
UtilFuncs._get_help_vtablenames()
|
|
913
|
+
"""
|
|
914
|
+
vtables = UtilFuncs._execute_query(SQLBundle._build_help_volatile_table())
|
|
915
|
+
if vtables:
|
|
916
|
+
return list(map(str.strip, filter(None, vtables[0])))
|
|
917
|
+
return []
|
|
918
|
+
|
|
919
|
+
@staticmethod
|
|
920
|
+
def _get_help_viewname(view_name):
|
|
921
|
+
"""
|
|
922
|
+
Function to get help of the view.
|
|
923
|
+
|
|
924
|
+
PARAMETERS:
|
|
925
|
+
view_name - The name of the view.
|
|
926
|
+
|
|
927
|
+
RETURNS:
|
|
928
|
+
The help information of the view specified by view_name.
|
|
929
|
+
|
|
930
|
+
EXAMPLES:
|
|
931
|
+
UtilFuncs._get_help_viewname(myview)
|
|
932
|
+
"""
|
|
933
|
+
return UtilFuncs._execute_query(SQLBundle._build_help_view(view_name))
|
|
934
|
+
|
|
935
|
+
@staticmethod
|
|
936
|
+
def _get_help_tablename(table_name):
|
|
937
|
+
"""
|
|
938
|
+
Function to get help of the table.
|
|
939
|
+
|
|
940
|
+
PARAMETERS:
|
|
941
|
+
table_name - The name of the table.
|
|
942
|
+
|
|
943
|
+
RETURNS:
|
|
944
|
+
The help information of the table specified by table_name.
|
|
945
|
+
|
|
946
|
+
EXAMPLES:
|
|
947
|
+
UtilFuncs._get_help_tablename(mytable)
|
|
948
|
+
"""
|
|
949
|
+
return UtilFuncs._execute_query(SQLBundle._build_help_table(table_name))
|
|
950
|
+
|
|
951
|
+
@staticmethod
|
|
952
|
+
def _get_select_table(table_name):
|
|
953
|
+
"""
|
|
954
|
+
Function to get a table if exists.
|
|
955
|
+
|
|
956
|
+
PARAMETERS:
|
|
957
|
+
table_name - Table name to check if exists in the database.
|
|
958
|
+
|
|
959
|
+
RETURNS:
|
|
960
|
+
Table name in a list.
|
|
961
|
+
|
|
962
|
+
EXAMPLES:
|
|
963
|
+
UtilFuncs._get_select_table('mytab')
|
|
964
|
+
|
|
965
|
+
"""
|
|
966
|
+
table = UtilFuncs._execute_query(SQLBundle._build_select_table_name(table_name))
|
|
967
|
+
if table:
|
|
968
|
+
return table[0]
|
|
969
|
+
return []
|
|
970
|
+
|
|
971
|
+
@staticmethod
|
|
972
|
+
def _describe_column(metadata, to_type=None):
|
|
973
|
+
"""
|
|
974
|
+
This is an internal function to retrieve
|
|
975
|
+
column names and column types for the table or view.
|
|
976
|
+
|
|
977
|
+
PARAMETERS:
|
|
978
|
+
metadata:
|
|
979
|
+
The result set from the HELP COLUMN command.
|
|
980
|
+
|
|
981
|
+
RETURNS:
|
|
982
|
+
A list of tuples (column_names, column_types).
|
|
983
|
+
|
|
984
|
+
RAISES:
|
|
985
|
+
Database errors if a problem occurs while trying to retrieve the column information.
|
|
986
|
+
|
|
987
|
+
EXAMPLES:
|
|
988
|
+
column_names_and_types = UtilFuncs._describe_column()
|
|
989
|
+
|
|
990
|
+
"""
|
|
991
|
+
column_names_and_types = []
|
|
992
|
+
for row in metadata:
|
|
993
|
+
# logger.debug("Retrieving Teradata type for {0}".format(row[31]))
|
|
994
|
+
# row[31] corresponds to 'Column Dictionary Name' column in the result of 'HELP COLUMN' SQL commands result.
|
|
995
|
+
column_name = row[31]
|
|
996
|
+
# We also need to check if the column is a TD_TIMEBUCKET column, in which case we can ignore it.
|
|
997
|
+
# We do so by checking the column name, and row[48] which corresponds to the 'Time Series Column Type'
|
|
998
|
+
# column in the 'HELP COLUMN' command to make sure it is indeed the TD_TIMEBUCKET column in the PTI table,
|
|
999
|
+
# and not just a column with the same name in a PTI/non-PTI table.
|
|
1000
|
+
# TD_TIMEBUCKET column is ignored since it is not functionally available to any user.
|
|
1001
|
+
if column_name == PTITableConstants.TD_TIMEBUCKET.value and \
|
|
1002
|
+
len(row) > 48 and row[48] is not None and \
|
|
1003
|
+
row[48].strip() == PTITableConstants.TSCOLTYPE_TIMEBUCKET.value:
|
|
1004
|
+
continue
|
|
1005
|
+
if to_type == "TD":
|
|
1006
|
+
# row[18] corresponds to the 'UDT Name' in the 'HELP COLUMN' SQL commands result.
|
|
1007
|
+
# row[1] corresponds to the 'Type' in the 'HELP COLUMN' commands result.
|
|
1008
|
+
column_names_and_types.append((column_name,
|
|
1009
|
+
UtilFuncs._help_col_to_td_type(row[1].strip(),
|
|
1010
|
+
row[18],
|
|
1011
|
+
row[44])))
|
|
1012
|
+
else:
|
|
1013
|
+
column_names_and_types.append((column_name,
|
|
1014
|
+
UtilFuncs._help_col_to_python_type(row[1].strip(),
|
|
1015
|
+
row[44])))
|
|
1016
|
+
|
|
1017
|
+
return column_names_and_types
|
|
1018
|
+
|
|
1019
|
+
@staticmethod
|
|
1020
|
+
def _get_pandas_converters(col_types):
|
|
1021
|
+
"""
|
|
1022
|
+
DESCRIPTION:
|
|
1023
|
+
Internal util function to get a dictionary of Python type names of columns
|
|
1024
|
+
in a teradataml DataFrame mapped to lambda functions to process the
|
|
1025
|
+
data to convert it to the type, which can be readily used with pandas'
|
|
1026
|
+
read_csv() function's 'converters' argument.
|
|
1027
|
+
|
|
1028
|
+
Note: This utility provides converter functions only for values of type
|
|
1029
|
+
int, float, and decimal.Decimal.
|
|
1030
|
+
For types that don't expect empty strings in input
|
|
1031
|
+
i.e. for 'datetime.datetime', 'datetime.date' and 'datetime.time',
|
|
1032
|
+
the converter function returns None for empty string input.
|
|
1033
|
+
|
|
1034
|
+
PARAMETERS:
|
|
1035
|
+
col_types:
|
|
1036
|
+
Required Argument.
|
|
1037
|
+
The list of Python types names corresponding to the columns in the input data.
|
|
1038
|
+
Types: list
|
|
1039
|
+
|
|
1040
|
+
RAISES:
|
|
1041
|
+
None
|
|
1042
|
+
|
|
1043
|
+
RETURNS:
|
|
1044
|
+
dict
|
|
1045
|
+
|
|
1046
|
+
EXAMPLES:
|
|
1047
|
+
>>> pandas_converters = UtilFuncs._get_pandas_converters(["int", "str"])
|
|
1048
|
+
"""
|
|
1049
|
+
pandas_converters = dict()
|
|
1050
|
+
for i, type_ in enumerate(col_types):
|
|
1051
|
+
# Add a functions that converts the string values to float or int when
|
|
1052
|
+
# the value is not empty string, else return None.
|
|
1053
|
+
if type_ in (PythonTypes.PY_FLOAT_TYPE.value,
|
|
1054
|
+
PythonTypes.PY_DECIMAL_TYPE.value):
|
|
1055
|
+
pandas_converters[i] = lambda x: float(x) \
|
|
1056
|
+
if isinstance(x, (bytes, number, int, float)) \
|
|
1057
|
+
else float("".join(x.split())) if len(x.strip()) > 0 else None
|
|
1058
|
+
|
|
1059
|
+
elif type_ == PythonTypes.PY_INT_TYPE.value:
|
|
1060
|
+
pandas_converters[i] = lambda x: int(x) \
|
|
1061
|
+
if isinstance(x, (bytes, number, int, float)) \
|
|
1062
|
+
else int(float("".join(x.split()))) if len(x.strip()) > 0 else None
|
|
1063
|
+
|
|
1064
|
+
elif type_ in (PythonTypes.PY_DATETIME_TYPE.value,
|
|
1065
|
+
PythonTypes.PY_DATE_TYPE.value,
|
|
1066
|
+
PythonTypes.PY_TIME_TYPE.value):
|
|
1067
|
+
# For types that do not expect empty strings, add function to
|
|
1068
|
+
# set them to None when value received is empty string.
|
|
1069
|
+
pandas_converters[i] = lambda x: x if len(x.strip()) > 0 else None
|
|
1070
|
+
|
|
1071
|
+
else:
|
|
1072
|
+
# For 'str' and 'bytes' types, add function that returns value as is.
|
|
1073
|
+
pandas_converters[i] = lambda x: x
|
|
1074
|
+
|
|
1075
|
+
return pandas_converters
|
|
1076
|
+
|
|
1077
|
+
@staticmethod
|
|
1078
|
+
def _teradata_type_to_python_type(td_type):
|
|
1079
|
+
"""
|
|
1080
|
+
Translate the Teradata type from metaexpr to Python types.
|
|
1081
|
+
PARAMETERS:
|
|
1082
|
+
td_type - The Teradata type from metaexpr.
|
|
1083
|
+
|
|
1084
|
+
RETURNS:
|
|
1085
|
+
The Python type for the given td_type.
|
|
1086
|
+
|
|
1087
|
+
RAISES:
|
|
1088
|
+
|
|
1089
|
+
EXAMPLES:
|
|
1090
|
+
# o is an instance of INTEGER
|
|
1091
|
+
pytype = UtilFuncs._teradata_type_to_python_type(o)
|
|
1092
|
+
|
|
1093
|
+
"""
|
|
1094
|
+
|
|
1095
|
+
# loggerlogger.debug("_help_col_to_python_type td_type = {0} ".format(td_type))
|
|
1096
|
+
if type(td_type) in TeradataTypes.TD_INTEGER_TYPES.value:
|
|
1097
|
+
return PythonTypes.PY_INT_TYPE.value
|
|
1098
|
+
elif type(td_type) in TeradataTypes.TD_FLOAT_TYPES.value:
|
|
1099
|
+
return PythonTypes.PY_FLOAT_TYPE.value
|
|
1100
|
+
elif type(td_type) in TeradataTypes.TD_DECIMAL_TYPES.value:
|
|
1101
|
+
return PythonTypes.PY_DECIMAL_TYPE.value
|
|
1102
|
+
elif type(td_type) in TeradataTypes.TD_BYTE_TYPES.value:
|
|
1103
|
+
return PythonTypes.PY_BYTES_TYPE.value
|
|
1104
|
+
elif type(td_type) in TeradataTypes.TD_DATETIME_TYPES.value:
|
|
1105
|
+
return PythonTypes.PY_DATETIME_TYPE.value
|
|
1106
|
+
elif type(td_type) in TeradataTypes.TD_TIME_TYPES.value:
|
|
1107
|
+
return PythonTypes.PY_TIME_TYPE.value
|
|
1108
|
+
elif type(td_type) in TeradataTypes.TD_DATE_TYPES.value:
|
|
1109
|
+
return PythonTypes.PY_DATE_TYPE.value
|
|
1110
|
+
|
|
1111
|
+
return PythonTypes.PY_STRING_TYPE.value
|
|
1112
|
+
|
|
1113
|
+
@staticmethod
|
|
1114
|
+
def _help_col_to_python_type(col_type, storage_format):
|
|
1115
|
+
"""
|
|
1116
|
+
Translate the 1 or 2 character TD type codes from HELP COLUMN to Python types.
|
|
1117
|
+
PARAMETERS:
|
|
1118
|
+
col_type - The 1 or 2 character type code from HELP COLUMN command.
|
|
1119
|
+
storage_format - The storage format from HELP COLUMN command.
|
|
1120
|
+
|
|
1121
|
+
RETURNS:
|
|
1122
|
+
The Python type for the given col_type.
|
|
1123
|
+
|
|
1124
|
+
RAISES:
|
|
1125
|
+
|
|
1126
|
+
EXAMPLES:
|
|
1127
|
+
pytype = UtilFuncs._help_col_to_python_type('CV', None)
|
|
1128
|
+
pytype = UtilFuncs._help_col_to_python_type('DT', 'CSV')
|
|
1129
|
+
|
|
1130
|
+
"""
|
|
1131
|
+
if col_type in TeradataTypes.TD_INTEGER_CODES.value:
|
|
1132
|
+
return PythonTypes.PY_INT_TYPE.value
|
|
1133
|
+
elif col_type in TeradataTypes.TD_FLOAT_CODES.value:
|
|
1134
|
+
return PythonTypes.PY_FLOAT_TYPE.value
|
|
1135
|
+
elif col_type in TeradataTypes.TD_DECIMAL_CODES.value:
|
|
1136
|
+
return PythonTypes.PY_DECIMAL_TYPE.value
|
|
1137
|
+
elif col_type in TeradataTypes.TD_BYTE_CODES.value:
|
|
1138
|
+
return PythonTypes.PY_BYTES_TYPE.value
|
|
1139
|
+
elif col_type in TeradataTypes.TD_DATETIME_CODES.value:
|
|
1140
|
+
return PythonTypes.PY_DATETIME_TYPE.value
|
|
1141
|
+
elif col_type in TeradataTypes.TD_TIME_CODES.value:
|
|
1142
|
+
return PythonTypes.PY_TIME_TYPE.value
|
|
1143
|
+
elif col_type in TeradataTypes.TD_DATE_CODES.value:
|
|
1144
|
+
return PythonTypes.PY_DATE_TYPE.value
|
|
1145
|
+
elif col_type == "DT":
|
|
1146
|
+
sfmt = storage_format.strip()
|
|
1147
|
+
if sfmt == "CSV":
|
|
1148
|
+
return PythonTypes.PY_STRING_TYPE.value
|
|
1149
|
+
elif sfmt == "AVRO":
|
|
1150
|
+
return PythonTypes.PY_BYTES_TYPE.value
|
|
1151
|
+
|
|
1152
|
+
return PythonTypes.PY_STRING_TYPE.value
|
|
1153
|
+
|
|
1154
|
+
@staticmethod
|
|
1155
|
+
def _help_col_to_td_type(col_type, udt_name, storage_format):
|
|
1156
|
+
"""
|
|
1157
|
+
Translate the 2 character TD type codes from HELP COLUMN to Teradata types.
|
|
1158
|
+
PARAMETERS:
|
|
1159
|
+
col_type - The 2 character type code from HELP COLUMN command.
|
|
1160
|
+
udt_name - The UDT name from the HELP COLUMN command.
|
|
1161
|
+
storage_format - The storage format from HELP COLUMN command.
|
|
1162
|
+
|
|
1163
|
+
RETURNS:
|
|
1164
|
+
The Teradata type for the given colType.
|
|
1165
|
+
|
|
1166
|
+
RAISES:
|
|
1167
|
+
|
|
1168
|
+
EXAMPLES:
|
|
1169
|
+
tdtype = UtilFuncs._help_col_to_td_type('CV', None, None)
|
|
1170
|
+
|
|
1171
|
+
"""
|
|
1172
|
+
# logger.debug("helpColumnToTeradataTypeName colType = {0} udtName = {1}
|
|
1173
|
+
# storageFormat {2}".format(colType, udtName, storageFormat))
|
|
1174
|
+
if col_type in td_coltype_code_to_tdtype.HELP_COL_TYPE_TO_TDTYPE:
|
|
1175
|
+
return td_coltype_code_to_tdtype.HELP_COL_TYPE_TO_TDTYPE[col_type]
|
|
1176
|
+
|
|
1177
|
+
if col_type == "DT":
|
|
1178
|
+
return "DATASET STORAGE FORMAT {0}".format(storage_format.strip())
|
|
1179
|
+
|
|
1180
|
+
if col_type in ["UD", "US", "UT", "A1", "AN"]:
|
|
1181
|
+
if udt_name:
|
|
1182
|
+
return udt_name
|
|
1183
|
+
|
|
1184
|
+
return col_type
|
|
1185
|
+
|
|
1186
|
+
@staticmethod
|
|
1187
|
+
def _convert_date_to_string(date_obj):
|
|
1188
|
+
"""
|
|
1189
|
+
Converts the date from datetime.date object to String type in the format "DATE 1987-06-09".
|
|
1190
|
+
PARAMETERS:
|
|
1191
|
+
date_obj:
|
|
1192
|
+
Required Argument.
|
|
1193
|
+
Specifies the date object to convert to string type.
|
|
1194
|
+
Types: datetime.date
|
|
1195
|
+
|
|
1196
|
+
RETURNS:
|
|
1197
|
+
The String reresentation for the given datetime.date object in the format "DATE 1987-06-09"
|
|
1198
|
+
|
|
1199
|
+
RAISES:
|
|
1200
|
+
None
|
|
1201
|
+
|
|
1202
|
+
Examples:
|
|
1203
|
+
date_str = UtilFuncs._convert_date_to_string(date_obj)
|
|
1204
|
+
|
|
1205
|
+
"""
|
|
1206
|
+
date_str = 'DATE {}'.format(date_obj.strftime('%Y-%m-%d'))
|
|
1207
|
+
return date_str
|
|
1208
|
+
|
|
1209
|
+
@staticmethod
|
|
1210
|
+
def _process_for_teradata_keyword(keyword):
|
|
1211
|
+
"""
|
|
1212
|
+
Processing the Teradata Reserved keywords.
|
|
1213
|
+
If keyword is in list of Teradata Reserved keywords, then it'll be quoted in double quotes "keyword".
|
|
1214
|
+
|
|
1215
|
+
PARAMETERS:
|
|
1216
|
+
keyword - A string or a list of strings to check whether it belongs to Teradata Reserved
|
|
1217
|
+
Keywords or not.
|
|
1218
|
+
|
|
1219
|
+
RETURNS:
|
|
1220
|
+
A quoted string or list of quoted strings, if keyword is one of the Teradata Reserved Keyword,
|
|
1221
|
+
else same object as is.
|
|
1222
|
+
|
|
1223
|
+
RAISES:
|
|
1224
|
+
None.
|
|
1225
|
+
|
|
1226
|
+
EXAMPLES:
|
|
1227
|
+
# Passing non-reserved returns "xyz" as is.
|
|
1228
|
+
keyword = self.__process_for_teradata_keyword("xyz")
|
|
1229
|
+
print(keyword)
|
|
1230
|
+
# Passing reserved str returns double-quoted str, i.e., "\"threshold\"".
|
|
1231
|
+
keyword = self.__process_for_teradata_keyword("threshold")
|
|
1232
|
+
print(keyword)
|
|
1233
|
+
"""
|
|
1234
|
+
# If the input keyword is a list, then call the same function again for every
|
|
1235
|
+
# element in the list.
|
|
1236
|
+
if isinstance(keyword, list):
|
|
1237
|
+
return [UtilFuncs._process_for_teradata_keyword(col) for col in keyword]
|
|
1238
|
+
|
|
1239
|
+
if isinstance(keyword, str) and keyword.upper() in \
|
|
1240
|
+
TeradataReservedKeywords.TERADATA_RESERVED_WORDS.value:
|
|
1241
|
+
return UtilFuncs._teradata_quote_arg(keyword, "\"", False)
|
|
1242
|
+
|
|
1243
|
+
return keyword
|
|
1244
|
+
|
|
1245
|
+
@staticmethod
|
|
1246
|
+
def _in_schema(schema_name, table_name):
|
|
1247
|
+
"""
|
|
1248
|
+
Function takes a schema name and a table name and creates a database
|
|
1249
|
+
object name in the format "schema"."table_name".
|
|
1250
|
+
Note:
|
|
1251
|
+
teradataml recommends to use this function to access table(s)/view(s),
|
|
1252
|
+
from the database other than the default database.
|
|
1253
|
+
|
|
1254
|
+
PARAMETERS:
|
|
1255
|
+
schema_name:
|
|
1256
|
+
Required Argument
|
|
1257
|
+
Specifies the schema where the table resides in.
|
|
1258
|
+
Types: str
|
|
1259
|
+
|
|
1260
|
+
table_name:
|
|
1261
|
+
Required Argument
|
|
1262
|
+
Specifies the table name or view name in Vantage.
|
|
1263
|
+
Types: str
|
|
1264
|
+
|
|
1265
|
+
EXAMPLES:
|
|
1266
|
+
from teradataml.dataframe.dataframe import in_schema, DataFrame
|
|
1267
|
+
|
|
1268
|
+
# Example 1: The following example creates a DataFrame from the
|
|
1269
|
+
# existing Vantage table "dbcinfo" in the non-default
|
|
1270
|
+
# database "dbc" using the in_schema() function.
|
|
1271
|
+
df = DataFrame(in_schema("dbc", "dbcinfo"))
|
|
1272
|
+
|
|
1273
|
+
# Example 2: The following example uses from_table() function, existing
|
|
1274
|
+
# Vantage table "dbcinfo" and non-default database "dbc" to
|
|
1275
|
+
# create a teradataml DataFrame.
|
|
1276
|
+
df = DataFrame.from_table(in_schema("dbc","dbcinfo"))
|
|
1277
|
+
|
|
1278
|
+
"""
|
|
1279
|
+
return "{0}.{1}".format(UtilFuncs._teradata_quote_arg(schema_name, "\"", False),
|
|
1280
|
+
UtilFuncs._teradata_quote_arg(table_name, "\"", False))
|
|
1281
|
+
|
|
1282
|
+
@staticmethod
|
|
1283
|
+
def _extract_db_name(full_qualified_name):
|
|
1284
|
+
"""
|
|
1285
|
+
Takes in fully qualified name of the table/view (db.table), and returns
|
|
1286
|
+
a database name from the same.
|
|
1287
|
+
|
|
1288
|
+
PARAMETERS:
|
|
1289
|
+
full_qualified_name - Name of the table/view
|
|
1290
|
+
|
|
1291
|
+
EXAMPLES:
|
|
1292
|
+
UtilFuncs._extract_db_name("db1"."tablename")
|
|
1293
|
+
|
|
1294
|
+
RETURNS:
|
|
1295
|
+
Database name from the provided name.
|
|
1296
|
+
|
|
1297
|
+
"""
|
|
1298
|
+
# Extract the double quoted strings.
|
|
1299
|
+
names = re.findall(r'["](.*?)["]', full_qualified_name)
|
|
1300
|
+
# Remove quotes around the string.
|
|
1301
|
+
names = [i.replace('"', '') for i in names]
|
|
1302
|
+
if names:
|
|
1303
|
+
if len(names) == 2:
|
|
1304
|
+
return names[0]
|
|
1305
|
+
else:
|
|
1306
|
+
return None
|
|
1307
|
+
|
|
1308
|
+
@staticmethod
|
|
1309
|
+
def _extract_table_name(full_qualified_name):
|
|
1310
|
+
"""
|
|
1311
|
+
Takes in fully qualified name of the table/view (db.table), and returns
|
|
1312
|
+
a table/view name from the same.
|
|
1313
|
+
|
|
1314
|
+
PARAMETERS:
|
|
1315
|
+
full_qualified_name - Name of the table/view
|
|
1316
|
+
|
|
1317
|
+
EXAMPLES:
|
|
1318
|
+
UtilFuncs._extract_db_name("db1"."tablename")
|
|
1319
|
+
|
|
1320
|
+
RETURNS:
|
|
1321
|
+
Table/View name from the provided name.
|
|
1322
|
+
|
|
1323
|
+
"""
|
|
1324
|
+
# Extract the double quoted strings.
|
|
1325
|
+
names = re.findall(r'["](.*?)["]', full_qualified_name)
|
|
1326
|
+
# Remove quotes around the string.
|
|
1327
|
+
names = [i.replace('"', '') for i in names]
|
|
1328
|
+
if names:
|
|
1329
|
+
if len(names) == 2:
|
|
1330
|
+
return names[1]
|
|
1331
|
+
else:
|
|
1332
|
+
return names[0]
|
|
1333
|
+
return full_qualified_name
|
|
1334
|
+
|
|
1335
|
+
@staticmethod
|
|
1336
|
+
def _teradata_quote_arg(args, quote="'", call_from_wrapper=True):
|
|
1337
|
+
"""
|
|
1338
|
+
Function to quote argument value.
|
|
1339
|
+
PARAMETERS:
|
|
1340
|
+
args : Argument to be quoted.
|
|
1341
|
+
quote : Type of quote to be used for quoting. Default is
|
|
1342
|
+
single quote (').
|
|
1343
|
+
RETURNS:
|
|
1344
|
+
Argument with quotes as a string.
|
|
1345
|
+
|
|
1346
|
+
EXAMPLES:
|
|
1347
|
+
When a call is being made from wrapper:
|
|
1348
|
+
UtilFuncs._teradata_quote_arg(family, "'")
|
|
1349
|
+
When a call is being made from non-wrapper function.
|
|
1350
|
+
UtilFuncs._teradata_quote_arg(family, "'", False)
|
|
1351
|
+
"""
|
|
1352
|
+
if call_from_wrapper and not configure.column_casesensitive_handler:
|
|
1353
|
+
quote = ""
|
|
1354
|
+
return args
|
|
1355
|
+
|
|
1356
|
+
# Returning same string if it already quoted. Applicable only for strings.
|
|
1357
|
+
if isinstance(args, str) and args.startswith(quote) and args.endswith(quote):
|
|
1358
|
+
return args
|
|
1359
|
+
if args is None:
|
|
1360
|
+
return None
|
|
1361
|
+
if isinstance(args, list):
|
|
1362
|
+
return ["{0}{1}{0}".format(quote, arg) for arg in args]
|
|
1363
|
+
|
|
1364
|
+
return "{0}{1}{0}".format(quote, args)
|
|
1365
|
+
|
|
1366
|
+
@staticmethod
|
|
1367
|
+
def _teradata_unquote_arg(quoted_string, quote="'"):
|
|
1368
|
+
"""
|
|
1369
|
+
Function to unquote argument value.
|
|
1370
|
+
PARAMETERS:
|
|
1371
|
+
quoted_string : String to be unquoted.
|
|
1372
|
+
quote : Type of quote to be used for unquoting. Default is
|
|
1373
|
+
single quote (').
|
|
1374
|
+
RETURNS:
|
|
1375
|
+
None if 'quoted_string' is not a string,
|
|
1376
|
+
else Argument without quotes as a string.
|
|
1377
|
+
|
|
1378
|
+
EXAMPLES:
|
|
1379
|
+
UtilFuncs._teradata_unquote_arg(family, "'")
|
|
1380
|
+
"""
|
|
1381
|
+
|
|
1382
|
+
if not isinstance(quoted_string, str):
|
|
1383
|
+
return None
|
|
1384
|
+
|
|
1385
|
+
# Returning same string if it already unquoted.
|
|
1386
|
+
if not quoted_string.startswith(quote) and not quoted_string.endswith(quote):
|
|
1387
|
+
return quoted_string
|
|
1388
|
+
|
|
1389
|
+
return quoted_string[1:-1]
|
|
1390
|
+
|
|
1391
|
+
@staticmethod
|
|
1392
|
+
def _teradata_collapse_arglist(args_list, quote="'"):
|
|
1393
|
+
"""
|
|
1394
|
+
Given a list as an argument this will single quote all the
|
|
1395
|
+
list elements and combine them into a single string separated by
|
|
1396
|
+
commas.
|
|
1397
|
+
|
|
1398
|
+
PARAMETERS:
|
|
1399
|
+
args_list: List containing string/s to be quoted.
|
|
1400
|
+
quote: Type of quote to be used for quoting. Default is single quote (').
|
|
1401
|
+
|
|
1402
|
+
RETURNS:
|
|
1403
|
+
Single string separated by commas.
|
|
1404
|
+
|
|
1405
|
+
EXAMPLES:
|
|
1406
|
+
UtilFuncs._teradata_collapse_arglist(family, "'")
|
|
1407
|
+
|
|
1408
|
+
"""
|
|
1409
|
+
expr = r"([\"'][\d.\d\w]+\s*[\"'][,]*\s*)+([\"']\s*[\d.\d\w]+[\"']$)"
|
|
1410
|
+
|
|
1411
|
+
# # return None if list is empty
|
|
1412
|
+
# if not args_list and not isinstance(args_list, bool):
|
|
1413
|
+
# return args_list
|
|
1414
|
+
|
|
1415
|
+
# if args_list is a list quote all values of the list
|
|
1416
|
+
if isinstance(args_list, list):
|
|
1417
|
+
'''
|
|
1418
|
+
EXAMPLE:
|
|
1419
|
+
arg = ['admitted', 'masters', 'gpa', 'stats', 'programming']
|
|
1420
|
+
UtilFuncs._teradata_collapse_arglist(arg, "\"")
|
|
1421
|
+
RETURNS:
|
|
1422
|
+
'"admitted","masters","gpa","stats","programming"'
|
|
1423
|
+
|
|
1424
|
+
'''
|
|
1425
|
+
return ",".join("{0}{1}{0}".format(quote, arg) for arg in args_list)
|
|
1426
|
+
elif (isinstance(args_list, str)) and (bool(re.match(expr, args_list)) is True):
|
|
1427
|
+
'''
|
|
1428
|
+
Quotes the arguments which is string of strings with the provided quote variable
|
|
1429
|
+
value.
|
|
1430
|
+
The expr should be strings separeted by commas. The string values can be digits or
|
|
1431
|
+
alphabets.
|
|
1432
|
+
For example:
|
|
1433
|
+
args_list = '"masters","gpa","stats"'
|
|
1434
|
+
quote = "'"
|
|
1435
|
+
The args_list is quoted as below based on the quote argument provided:
|
|
1436
|
+
strQuotes = '"masters"','"gpa"','"stats"'
|
|
1437
|
+
RETURNS:
|
|
1438
|
+
quoted string
|
|
1439
|
+
|
|
1440
|
+
The quoted value is added to list in the functions with other arguments as:
|
|
1441
|
+
funcOtherArgs = ["'2.0'", "'POISSON'", "'IDENTITY'", "'0.05'", "'10'", "'False'", "'True'",
|
|
1442
|
+
'\'"masters"\',\'"gpa"\',\'"stats"\',\'"programming"\',\'"admitted"\'',
|
|
1443
|
+
'\'"masters"\',\'"stats"\',\'"programming"\'']
|
|
1444
|
+
|
|
1445
|
+
'''
|
|
1446
|
+
str_val = re.sub(r"\s+", "", args_list)
|
|
1447
|
+
args_list = str_val.split(",")
|
|
1448
|
+
return ",".join("{0}{1}{0}".format(quote, arg) for arg in args_list)
|
|
1449
|
+
# if argVector is any value of int/str/bool type, quote the value
|
|
1450
|
+
else:
|
|
1451
|
+
return UtilFuncs._teradata_quote_arg(args_list, quote, False)
|
|
1452
|
+
|
|
1453
|
+
@staticmethod
|
|
1454
|
+
def _get_metaexpr_using_columns(nodeid, column_info, with_engine=False, is_persist=False):
|
|
1455
|
+
"""
|
|
1456
|
+
This internal function takes in input node ID and column information in zipped lists format
|
|
1457
|
+
to return metaexpr with or without engine.
|
|
1458
|
+
|
|
1459
|
+
PARAMETERS:
|
|
1460
|
+
nodeid - AED DAG node id for which a metaexpr is to be generated.
|
|
1461
|
+
column_info - This contains zipped lists of column names and corresponding column types.
|
|
1462
|
+
with_engine - A bool parameter, deciding whether to generate metaexpr with engine or not.
|
|
1463
|
+
Default is False.
|
|
1464
|
+
is_persist - A bool parameter, deciding whether to persist the result or not.
|
|
1465
|
+
Default is False.
|
|
1466
|
+
|
|
1467
|
+
RAISES:
|
|
1468
|
+
|
|
1469
|
+
RETURNS:
|
|
1470
|
+
metaexpr for the provided node ID and with column inforamtion.
|
|
1471
|
+
|
|
1472
|
+
EXAMPLES:
|
|
1473
|
+
node_id_list = self.__aed_utils._aed_ml_query(self.__input_nodeids, self.sqlmr_query, self.__func_output_args, "NaiveBayesMap")
|
|
1474
|
+
stdout_column_info = zip(stdout_column_names, stdout_column_types)
|
|
1475
|
+
UtilFuncs._get_metaexpr_using_columns(node_id_list[0], stdout_column_info)
|
|
1476
|
+
"""
|
|
1477
|
+
from teradataml.dataframe.sql import _MetaExpression
|
|
1478
|
+
if with_engine:
|
|
1479
|
+
eng = tdmlctx.get_context()
|
|
1480
|
+
meta = sqlalchemy.MetaData(eng)
|
|
1481
|
+
else:
|
|
1482
|
+
meta = sqlalchemy.MetaData()
|
|
1483
|
+
|
|
1484
|
+
# Get the output table name for node_id from AED
|
|
1485
|
+
aed_utils = AedUtils()
|
|
1486
|
+
|
|
1487
|
+
table_name = aed_utils._aed_get_tablename(nodeid)
|
|
1488
|
+
db_schema = UtilFuncs._extract_db_name(table_name)
|
|
1489
|
+
db_table_name = UtilFuncs._extract_table_name(table_name)
|
|
1490
|
+
|
|
1491
|
+
# Constructing new Metadata (_metaexpr) without DB; _MetaExpression
|
|
1492
|
+
ouptut_table = Table(db_table_name, meta,
|
|
1493
|
+
*(Column(col_name, col_type) for col_name, col_type in column_info),
|
|
1494
|
+
schema=db_schema)
|
|
1495
|
+
return _MetaExpression(ouptut_table, is_persist=is_persist)
|
|
1496
|
+
|
|
1497
|
+
@staticmethod
|
|
1498
|
+
def _get_metaexpr_using_parent_metaexpr(nodeid, metaexpr):
|
|
1499
|
+
"""
|
|
1500
|
+
This internal function takes in input node ID and metaexpr (parents)
|
|
1501
|
+
to return metaexpr with or without engine.
|
|
1502
|
+
|
|
1503
|
+
PARAMETERS:
|
|
1504
|
+
nodeid:
|
|
1505
|
+
Required Argument.
|
|
1506
|
+
Specifies AED DAG node id for which a metaexpr is to be generated.
|
|
1507
|
+
|
|
1508
|
+
metaexpr:
|
|
1509
|
+
Required Argument.
|
|
1510
|
+
_MetaExpression() of a DataFrame objects which is to be used to extract and
|
|
1511
|
+
create a new _MetaExpression.
|
|
1512
|
+
|
|
1513
|
+
RAISES:
|
|
1514
|
+
None.
|
|
1515
|
+
|
|
1516
|
+
RETURNS:
|
|
1517
|
+
metaexpr for the provided node ID and with metaexpr inforamtion.
|
|
1518
|
+
|
|
1519
|
+
EXAMPLES:
|
|
1520
|
+
node_id_list = self.__aed_utils._aed_ml_query(self.__input_nodeids, self.sqlmr_query, self.__func_output_args, "NaiveBayesMap")
|
|
1521
|
+
UtilFuncs._get_metaexpr_using_parent_metaexpr(node_id_list[0], parent_metaexpr)
|
|
1522
|
+
"""
|
|
1523
|
+
meta_cols = metaexpr.t.c
|
|
1524
|
+
meta_columns = [c.name for c in meta_cols]
|
|
1525
|
+
col_names = []
|
|
1526
|
+
col_types = []
|
|
1527
|
+
|
|
1528
|
+
# When column list to retrieve is not provided, return meta-data for all columns.
|
|
1529
|
+
for col_name in meta_columns:
|
|
1530
|
+
col_names.append(meta_cols[col_name].name)
|
|
1531
|
+
col_types.append(meta_cols[col_name].type)
|
|
1532
|
+
|
|
1533
|
+
return UtilFuncs._get_metaexpr_using_columns(nodeid, zip(col_names, col_types))
|
|
1534
|
+
|
|
1535
|
+
@staticmethod
|
|
1536
|
+
def _create_table_using_columns(table_name, columns_datatypes, pti_clause=None, storage=None):
|
|
1537
|
+
"""
|
|
1538
|
+
Create a table with columns.
|
|
1539
|
+
|
|
1540
|
+
PARAMETERS:
|
|
1541
|
+
table_name - Fully qualified quoted table name.
|
|
1542
|
+
columns_datatypes - Column names and dattypes for the table
|
|
1543
|
+
pti_clause - Specifies the string for the primary time index.
|
|
1544
|
+
storage - Specifies the storage for the table.
|
|
1545
|
+
|
|
1546
|
+
RAISES
|
|
1547
|
+
|
|
1548
|
+
RETURNS:
|
|
1549
|
+
True if success, false if fails
|
|
1550
|
+
|
|
1551
|
+
EXAMPLES:
|
|
1552
|
+
UtilFuncs._create_table_using_columns('"dbname"."table_name"',
|
|
1553
|
+
"col1 varchar(10), col2 integer, col3 timestamp")
|
|
1554
|
+
"""
|
|
1555
|
+
# If storage option is specified, add the storage clause in the create table statement.
|
|
1556
|
+
if storage:
|
|
1557
|
+
table_name = "{}, STORAGE={}".format(table_name, storage)
|
|
1558
|
+
|
|
1559
|
+
crt_table = SQLBundle._build_create_table_using_columns(table_name, columns_datatypes)
|
|
1560
|
+
|
|
1561
|
+
if pti_clause is not None:
|
|
1562
|
+
crt_table = "{} PRIMARY TIME INDEX {}".format(crt_table, pti_clause)
|
|
1563
|
+
|
|
1564
|
+
try:
|
|
1565
|
+
UtilFuncs._execute_ddl_statement(crt_table)
|
|
1566
|
+
return True
|
|
1567
|
+
except Exception:
|
|
1568
|
+
raise
|
|
1569
|
+
|
|
1570
|
+
@staticmethod
|
|
1571
|
+
def _get_engine_name(engine):
|
|
1572
|
+
"""
|
|
1573
|
+
Function to return the name of the engine mapped to the
|
|
1574
|
+
argument 'engine' in function mapped dictionary.
|
|
1575
|
+
|
|
1576
|
+
PARAMETERS:
|
|
1577
|
+
engine:
|
|
1578
|
+
Required Argument.
|
|
1579
|
+
Specifies the type of the engine.
|
|
1580
|
+
|
|
1581
|
+
RETURNS:
|
|
1582
|
+
Name of the engine.
|
|
1583
|
+
|
|
1584
|
+
RAISES:
|
|
1585
|
+
TeradataMLException
|
|
1586
|
+
|
|
1587
|
+
EXAMPLES:
|
|
1588
|
+
UtilFuncs._get_engine_name("ENGINE_SQL")
|
|
1589
|
+
|
|
1590
|
+
"""
|
|
1591
|
+
_Validators._validate_engine(engine)
|
|
1592
|
+
supported_engines = TeradataConstants.SUPPORTED_ENGINES.value
|
|
1593
|
+
return supported_engines[engine]['name']
|
|
1594
|
+
|
|
1595
|
+
@staticmethod
|
|
1596
|
+
def _as_list(obj):
|
|
1597
|
+
"""
|
|
1598
|
+
Function to convert an object to list, i.e., just enclose the value passed to the
|
|
1599
|
+
function in a list and return the same, if it is not of list type.
|
|
1600
|
+
PARAMETERS:
|
|
1601
|
+
obj:
|
|
1602
|
+
Required Argument.
|
|
1603
|
+
Specifies the object to be enclosed in a list.
|
|
1604
|
+
Types: Any type except list.
|
|
1605
|
+
RETURNS:
|
|
1606
|
+
list
|
|
1607
|
+
RAISES:
|
|
1608
|
+
None.
|
|
1609
|
+
EXAMPLES:
|
|
1610
|
+
obj = UtilFuncs._as_list("vantage1.0")
|
|
1611
|
+
"""
|
|
1612
|
+
return obj if isinstance(obj, list) else [obj]
|
|
1613
|
+
|
|
1614
|
+
@staticmethod
|
|
1615
|
+
def _get_all_columns(object, is_object_type_tdml_column):
|
|
1616
|
+
"""
|
|
1617
|
+
Function to get all columns from a given teradataml DataFrame
|
|
1618
|
+
or teradataml DataFrame column.
|
|
1619
|
+
|
|
1620
|
+
PARAMETERS:
|
|
1621
|
+
object:
|
|
1622
|
+
Required Argument.
|
|
1623
|
+
Specifies either teradataml DataFrame or teradataml DataFrame
|
|
1624
|
+
Column.
|
|
1625
|
+
Types: teradataml DataFrame, _SQLColumnExpression
|
|
1626
|
+
|
|
1627
|
+
is_object_type_tdml_column:
|
|
1628
|
+
Required Argument.
|
|
1629
|
+
Specifies whether "object" is a teradataml DataFrame or
|
|
1630
|
+
teradataml DataFrame Column.
|
|
1631
|
+
If True, "object" treats as teradataml DataFrame Column.
|
|
1632
|
+
If False, "object" treats as teradataml DataFrame.
|
|
1633
|
+
Types: bool
|
|
1634
|
+
|
|
1635
|
+
RETURNS:
|
|
1636
|
+
An iterator and each element in the iterator represents a Column
|
|
1637
|
+
|
|
1638
|
+
RAISES:
|
|
1639
|
+
None.
|
|
1640
|
+
|
|
1641
|
+
EXAMPLES:
|
|
1642
|
+
obj = UtilFuncs._get_all_columns(df.col, True)
|
|
1643
|
+
obj = UtilFuncs._get_all_columns(df, False)
|
|
1644
|
+
"""
|
|
1645
|
+
if is_object_type_tdml_column:
|
|
1646
|
+
return UtilFuncs._all_df_column_expressions(object)
|
|
1647
|
+
# object._metaexpr.c extracts the data to a list. And, the caller of
|
|
1648
|
+
# this function will again iterate through the list, to process the
|
|
1649
|
+
# list i.e. object._metaexpr.c is being iterated twice. To avoid this,
|
|
1650
|
+
# a generator object is being constructed and returned.
|
|
1651
|
+
return (c for c in object._metaexpr.c)
|
|
1652
|
+
|
|
1653
|
+
@staticmethod
|
|
1654
|
+
def _get_file_contents(file_path, read_in_binary_mode=False):
|
|
1655
|
+
"""
|
|
1656
|
+
Description:
|
|
1657
|
+
Function to get the file content from a file, given absolute
|
|
1658
|
+
file path.
|
|
1659
|
+
|
|
1660
|
+
PARAMETERS:
|
|
1661
|
+
file_path:
|
|
1662
|
+
Required Argument.
|
|
1663
|
+
Specifies absolute file path of the file.
|
|
1664
|
+
Types: str
|
|
1665
|
+
|
|
1666
|
+
read_in_binary_mode:
|
|
1667
|
+
Optional Argument.
|
|
1668
|
+
Specifies whether to read the file in binary format or not.
|
|
1669
|
+
If True, read the file in binary mode.
|
|
1670
|
+
If False, read the file in ASCII mode.
|
|
1671
|
+
Default value: False
|
|
1672
|
+
Types: bool
|
|
1673
|
+
|
|
1674
|
+
RETURNS:
|
|
1675
|
+
str OR bytes
|
|
1676
|
+
|
|
1677
|
+
RAISES:
|
|
1678
|
+
TeradataMlException
|
|
1679
|
+
|
|
1680
|
+
EXAMPLES:
|
|
1681
|
+
obj = UtilFuncs._get_file_contents("/abc/xyz.txt")
|
|
1682
|
+
obj = UtilFuncs._get_file_contents("/abc/xyz.txt", True)
|
|
1683
|
+
"""
|
|
1684
|
+
try:
|
|
1685
|
+
mode = 'r'
|
|
1686
|
+
if read_in_binary_mode:
|
|
1687
|
+
mode = 'rb'
|
|
1688
|
+
with open(file_path, mode) as file_data:
|
|
1689
|
+
_Validators._check_empty_file(file_path)
|
|
1690
|
+
return file_data.read()
|
|
1691
|
+
except TeradataMlException:
|
|
1692
|
+
raise
|
|
1693
|
+
except FileNotFoundError:
|
|
1694
|
+
raise
|
|
1695
|
+
except Exception as err:
|
|
1696
|
+
msg_code = MessageCodes.EXECUTION_FAILED
|
|
1697
|
+
raise TeradataMlException(
|
|
1698
|
+
Messages.get_message(msg_code, "read contents of file '{}'".format(file_path), str(err)), msg_code)
|
|
1699
|
+
|
|
1700
|
+
@staticmethod
|
|
1701
|
+
def _create_table_using_table_object(table_obj):
|
|
1702
|
+
"""
|
|
1703
|
+
DESCRIPTION:
|
|
1704
|
+
This function creates the table in Vantage using table object.
|
|
1705
|
+
|
|
1706
|
+
PARAMETERS:
|
|
1707
|
+
table_obj:
|
|
1708
|
+
Specifies the table object.
|
|
1709
|
+
Types: sqlalchemy.sql.schema.Table
|
|
1710
|
+
|
|
1711
|
+
RETURNS:
|
|
1712
|
+
None.
|
|
1713
|
+
|
|
1714
|
+
RAISES:
|
|
1715
|
+
TeradataMlException
|
|
1716
|
+
|
|
1717
|
+
EXAMPLES:
|
|
1718
|
+
from sqlalchemy import Table, MetaData, Column
|
|
1719
|
+
|
|
1720
|
+
meta = MetaData()
|
|
1721
|
+
# Create default Table construct with parameter dictionary
|
|
1722
|
+
table_obj = Table(table_name, meta,
|
|
1723
|
+
*(Column(col_name, col_type)
|
|
1724
|
+
for col_name, col_type in
|
|
1725
|
+
zip(col_names, col_types)),
|
|
1726
|
+
teradatasql_post_create=pti,
|
|
1727
|
+
prefixes=prefix,
|
|
1728
|
+
schema=schema_name
|
|
1729
|
+
)
|
|
1730
|
+
|
|
1731
|
+
_create_table_using_table_object(table_obj)
|
|
1732
|
+
"""
|
|
1733
|
+
if table_obj is not None:
|
|
1734
|
+
try:
|
|
1735
|
+
table_obj.create(bind=tdmlctx.get_context())
|
|
1736
|
+
except sqlachemyOperationalError as err:
|
|
1737
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.TABLE_OBJECT_CREATION_FAILED) +
|
|
1738
|
+
'\n' + str(err),
|
|
1739
|
+
MessageCodes.TABLE_OBJECT_CREATION_FAILED)
|
|
1740
|
+
else:
|
|
1741
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.TABLE_OBJECT_CREATION_FAILED),
|
|
1742
|
+
MessageCodes.TABLE_OBJECT_CREATION_FAILED)
|
|
1743
|
+
|
|
1744
|
+
@staticmethod
|
|
1745
|
+
def _extract_table_object_column_info(table_obj):
|
|
1746
|
+
"""
|
|
1747
|
+
Internal function to extract the column name and column types from
|
|
1748
|
+
table object.
|
|
1749
|
+
|
|
1750
|
+
PARAMETERS:
|
|
1751
|
+
table_obj:
|
|
1752
|
+
Required Argument.
|
|
1753
|
+
Specifies the table object.
|
|
1754
|
+
Types: sqlalchemy.sql
|
|
1755
|
+
|
|
1756
|
+
RETURNS:
|
|
1757
|
+
Tuple
|
|
1758
|
+
|
|
1759
|
+
RAISES:
|
|
1760
|
+
None
|
|
1761
|
+
|
|
1762
|
+
EXAMPLE:
|
|
1763
|
+
meta = MetaData()
|
|
1764
|
+
table = Table(table_name, meta, schema=schema_name, autoload_with=eng)
|
|
1765
|
+
_extract_table_object_column_info(table.c)
|
|
1766
|
+
"""
|
|
1767
|
+
col_names = []
|
|
1768
|
+
col_types = []
|
|
1769
|
+
|
|
1770
|
+
for col in table_obj:
|
|
1771
|
+
col_names.append(col.name)
|
|
1772
|
+
col_types.append(col.type)
|
|
1773
|
+
|
|
1774
|
+
return col_names, col_types
|
|
1775
|
+
|
|
1776
|
+
@staticmethod
|
|
1777
|
+
def _get_warnings(argument_name, argument_value, specified_argument_name, specified_argument_value):
|
|
1778
|
+
"""
|
|
1779
|
+
Internal function to print the warning.
|
|
1780
|
+
|
|
1781
|
+
PARAMETERS:
|
|
1782
|
+
argument_name:
|
|
1783
|
+
Required Argument.
|
|
1784
|
+
Specifies the argument name to check.
|
|
1785
|
+
Types: str
|
|
1786
|
+
|
|
1787
|
+
argument_value:
|
|
1788
|
+
Required Argument.
|
|
1789
|
+
Specifies the argument value to check.
|
|
1790
|
+
Types: bool
|
|
1791
|
+
|
|
1792
|
+
specified_argument_name:
|
|
1793
|
+
Required Argument.
|
|
1794
|
+
Specifies the argument name to use in warning message.
|
|
1795
|
+
Types: str
|
|
1796
|
+
|
|
1797
|
+
specified_argument_value:
|
|
1798
|
+
Required Argument.
|
|
1799
|
+
Specifies the argument value to use in warning message.
|
|
1800
|
+
Types: str
|
|
1801
|
+
|
|
1802
|
+
RETURNS:
|
|
1803
|
+
None
|
|
1804
|
+
|
|
1805
|
+
RAISES:
|
|
1806
|
+
None
|
|
1807
|
+
|
|
1808
|
+
EXAMPLE:
|
|
1809
|
+
_get_warnings(argument_name, argument_value, specified_argument_name, specified_argument_value)
|
|
1810
|
+
"""
|
|
1811
|
+
if argument_value:
|
|
1812
|
+
warnings.warn(Messages.get_message(MessageCodes.IGNORE_ARGS_WARN,
|
|
1813
|
+
'{0}',
|
|
1814
|
+
"{1}='{2}'",
|
|
1815
|
+
'specified').format(argument_name,
|
|
1816
|
+
specified_argument_name,
|
|
1817
|
+
specified_argument_value))
|
|
1818
|
+
|
|
1819
|
+
@staticmethod
|
|
1820
|
+
def _get_sqlalchemy_table(table_name, schema_name=None, check_table_exists=False):
|
|
1821
|
+
"""
|
|
1822
|
+
Internal function returns the SQLAlchemy table object for a table.
|
|
1823
|
+
If check_table_exists specified, function also checks for table existence.
|
|
1824
|
+
|
|
1825
|
+
PARAMETERS:
|
|
1826
|
+
table_name:
|
|
1827
|
+
Required Argument.
|
|
1828
|
+
Specifies the table name.
|
|
1829
|
+
Types: str
|
|
1830
|
+
|
|
1831
|
+
schema_name:
|
|
1832
|
+
Optional Argument.
|
|
1833
|
+
Specifies schema name.
|
|
1834
|
+
Types: str
|
|
1835
|
+
|
|
1836
|
+
check_table_exists:
|
|
1837
|
+
Optional Argument.
|
|
1838
|
+
Specifies whether to check table exists or not.
|
|
1839
|
+
Default Value: False
|
|
1840
|
+
Types: bool
|
|
1841
|
+
|
|
1842
|
+
RETURNS:
|
|
1843
|
+
sqlalchemy.sql.schema.Table
|
|
1844
|
+
|
|
1845
|
+
RAISES:
|
|
1846
|
+
None
|
|
1847
|
+
|
|
1848
|
+
EXAMPLE:
|
|
1849
|
+
_get_sqlalchemy_table(table_name='my_table')
|
|
1850
|
+
"""
|
|
1851
|
+
con = tdmlctx.get_connection()
|
|
1852
|
+
|
|
1853
|
+
if check_table_exists:
|
|
1854
|
+
table_exists = con.dialect.has_table(con, table_name, schema_name)
|
|
1855
|
+
|
|
1856
|
+
if not table_exists:
|
|
1857
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.TABLE_DOES_NOT_EXIST, table_name),
|
|
1858
|
+
MessageCodes.TABLE_DOES_NOT_EXIST)
|
|
1859
|
+
|
|
1860
|
+
meta = MetaData()
|
|
1861
|
+
return Table(table_name, meta,
|
|
1862
|
+
schema=schema_name,
|
|
1863
|
+
autoload_with=tdmlctx.get_context())
|
|
1864
|
+
|
|
1865
|
+
@staticmethod
|
|
1866
|
+
def _extract_table_object_index_info(table_obj):
|
|
1867
|
+
"""
|
|
1868
|
+
Internal function to extract primary index information of existing table.
|
|
1869
|
+
|
|
1870
|
+
PARAMETERS:
|
|
1871
|
+
table_obj:
|
|
1872
|
+
Required Argument.
|
|
1873
|
+
Specifies the sqlalchemy table object.
|
|
1874
|
+
Types: sqlalchemy.sql.schema.Table.
|
|
1875
|
+
|
|
1876
|
+
RETURNS:
|
|
1877
|
+
list.
|
|
1878
|
+
|
|
1879
|
+
RAISES:
|
|
1880
|
+
None.
|
|
1881
|
+
|
|
1882
|
+
EXAMPLE:
|
|
1883
|
+
_extract_table_object_index_info(table_object)
|
|
1884
|
+
"""
|
|
1885
|
+
sqlalchemy_table_primary_index = table_obj.indexes
|
|
1886
|
+
primary_index_list = []
|
|
1887
|
+
for index in sqlalchemy_table_primary_index:
|
|
1888
|
+
primary_index_list = index.columns.keys()
|
|
1889
|
+
return primary_index_list
|
|
1890
|
+
|
|
1891
|
+
@staticmethod
|
|
1892
|
+
def _get_positive_infinity():
|
|
1893
|
+
"""
|
|
1894
|
+
Description:
|
|
1895
|
+
Function to get the positive infinity.
|
|
1896
|
+
|
|
1897
|
+
RETURNS:
|
|
1898
|
+
float
|
|
1899
|
+
|
|
1900
|
+
RAISES:
|
|
1901
|
+
None
|
|
1902
|
+
|
|
1903
|
+
EXAMPLES:
|
|
1904
|
+
inf = UtilFuncs._get_positive_infinity()
|
|
1905
|
+
"""
|
|
1906
|
+
return float("inf")
|
|
1907
|
+
|
|
1908
|
+
@staticmethod
|
|
1909
|
+
def _get_negative_infinity():
|
|
1910
|
+
"""
|
|
1911
|
+
Description:
|
|
1912
|
+
Function to get the negative infinity.
|
|
1913
|
+
|
|
1914
|
+
RETURNS:
|
|
1915
|
+
float
|
|
1916
|
+
|
|
1917
|
+
RAISES:
|
|
1918
|
+
None
|
|
1919
|
+
|
|
1920
|
+
EXAMPLES:
|
|
1921
|
+
inf = UtilFuncs._get_negative_infinity()
|
|
1922
|
+
"""
|
|
1923
|
+
return -1 * UtilFuncs._get_positive_infinity()
|
|
1924
|
+
|
|
1925
|
+
@staticmethod
|
|
1926
|
+
def _get_class(class_name, supress_isinstance_check=False):
|
|
1927
|
+
"""
|
|
1928
|
+
Description:
|
|
1929
|
+
Function to get the class dynamically with the name as 'class_name'.
|
|
1930
|
+
|
|
1931
|
+
PARAMETERS:
|
|
1932
|
+
class_name:
|
|
1933
|
+
Required Parameter.
|
|
1934
|
+
Specifies the name of the class generated to be.
|
|
1935
|
+
Types: str
|
|
1936
|
+
|
|
1937
|
+
supress_isinstance_check:
|
|
1938
|
+
Optional Parameter.
|
|
1939
|
+
Specifies whether the dynamically created class should overwrite the
|
|
1940
|
+
isinstance method or not. When set to True, if the class generated from
|
|
1941
|
+
this function is passed to isinstance method, instead of verifying the
|
|
1942
|
+
actual type, it tries to match the name of object's class with 'class_name'.
|
|
1943
|
+
Default value: False
|
|
1944
|
+
Types: bool
|
|
1945
|
+
|
|
1946
|
+
RETURNS:
|
|
1947
|
+
type
|
|
1948
|
+
|
|
1949
|
+
RAISES:
|
|
1950
|
+
None
|
|
1951
|
+
|
|
1952
|
+
EXAMPLES:
|
|
1953
|
+
inf = UtilFuncs._get_class("test")
|
|
1954
|
+
"""
|
|
1955
|
+
parent_object = object
|
|
1956
|
+
if supress_isinstance_check:
|
|
1957
|
+
|
|
1958
|
+
# isinstance function is governed by the dunder method __instancecheck__.
|
|
1959
|
+
# However, unlike other dunder method's, __instancecheck__ should be overwritten
|
|
1960
|
+
# for a class, instead of object ,i.e., while creating the class itself, __instancecheck__
|
|
1961
|
+
# should be overwritten.
|
|
1962
|
+
# Note that, python's type accepts either object or any other class as a parent class.
|
|
1963
|
+
# Since, other than object, one should pass only a class to a python type, creating a
|
|
1964
|
+
# dummy class and specifying the metaclass as SupressInstanceCheck so that the dummy class
|
|
1965
|
+
# has updated __instancecheck__ dunder method.
|
|
1966
|
+
class SupressInstanceCheck(type):
|
|
1967
|
+
def __instancecheck__(self, instance):
|
|
1968
|
+
try:
|
|
1969
|
+
return self.__name__ == instance.__class__.__name__
|
|
1970
|
+
except Exception:
|
|
1971
|
+
return False
|
|
1972
|
+
|
|
1973
|
+
class temp(metaclass=SupressInstanceCheck):
|
|
1974
|
+
pass
|
|
1975
|
+
|
|
1976
|
+
parent_object = temp
|
|
1977
|
+
|
|
1978
|
+
return type(class_name, (parent_object, ), {})
|
|
1979
|
+
|
|
1980
|
+
@staticmethod
|
|
1981
|
+
def _get_file_size(file_path, in_mb=True):
|
|
1982
|
+
"""
|
|
1983
|
+
Description:
|
|
1984
|
+
Function to get the size of file, given absolute file path.
|
|
1985
|
+
|
|
1986
|
+
PARAMETERS:
|
|
1987
|
+
file_path:
|
|
1988
|
+
Required Argument.
|
|
1989
|
+
Specifies absolute file path of the file.
|
|
1990
|
+
Types: str
|
|
1991
|
+
|
|
1992
|
+
in_mb:
|
|
1993
|
+
Optional Argument.
|
|
1994
|
+
Specifies whether to get the file size in mega bytes or not.
|
|
1995
|
+
If True, size of the file returns in MB's. Otherwise, returns
|
|
1996
|
+
in bytes.
|
|
1997
|
+
Default value: True
|
|
1998
|
+
Types: bool
|
|
1999
|
+
|
|
2000
|
+
RETURNS:
|
|
2001
|
+
int OR float
|
|
2002
|
+
|
|
2003
|
+
RAISES:
|
|
2004
|
+
TeradataMlException
|
|
2005
|
+
|
|
2006
|
+
EXAMPLES:
|
|
2007
|
+
file_size = UtilFuncs._get_file_size("/abc/xyz.txt")
|
|
2008
|
+
"""
|
|
2009
|
+
size_in_bytes = os.path.getsize(file_path)
|
|
2010
|
+
|
|
2011
|
+
return size_in_bytes/(1024*1024.0) if in_mb else size_in_bytes
|
|
2012
|
+
|
|
2013
|
+
@staticmethod
|
|
2014
|
+
def _http_request(url, method_type=HTTPRequest.GET, **kwargs):
|
|
2015
|
+
"""
|
|
2016
|
+
Description:
|
|
2017
|
+
Function to initiate HTTP(S) request.
|
|
2018
|
+
|
|
2019
|
+
PARAMETERS:
|
|
2020
|
+
url:
|
|
2021
|
+
Required Argument.
|
|
2022
|
+
Specifies the url to initiate http request.
|
|
2023
|
+
Types: str
|
|
2024
|
+
|
|
2025
|
+
method_type:
|
|
2026
|
+
Optional Argument.
|
|
2027
|
+
Specifies the type of HTTP request.
|
|
2028
|
+
Default value: HTTPREquest.GET
|
|
2029
|
+
Types: HTTPRequest enum
|
|
2030
|
+
|
|
2031
|
+
**kwargs:
|
|
2032
|
+
Specifies the keyword arguments required for HTTP Request.
|
|
2033
|
+
Below are the expected arguments as a part of kwargs:
|
|
2034
|
+
json:
|
|
2035
|
+
Optional Argument.
|
|
2036
|
+
Specifies the payload for HTTP request in a dictionary.
|
|
2037
|
+
Types: dict
|
|
2038
|
+
|
|
2039
|
+
data:
|
|
2040
|
+
Optional Argument.
|
|
2041
|
+
Specifies the payload for HTTP request in a string format.
|
|
2042
|
+
Types: str
|
|
2043
|
+
|
|
2044
|
+
headers:
|
|
2045
|
+
Optional Argument.
|
|
2046
|
+
Specifies the headers for HTTP request.
|
|
2047
|
+
Types: dict
|
|
2048
|
+
|
|
2049
|
+
verify:
|
|
2050
|
+
Optional Argument.
|
|
2051
|
+
Specifies whether to verify the certificate or not in a HTTPS request.
|
|
2052
|
+
One can specify either False to suppress the certificate verification or
|
|
2053
|
+
path to certificate to verify the certificate.
|
|
2054
|
+
Types: str OR bool
|
|
2055
|
+
|
|
2056
|
+
files:
|
|
2057
|
+
Optional Argument.
|
|
2058
|
+
Specifies the file to be uploaded with a HTTP Request.
|
|
2059
|
+
Types: tuple
|
|
2060
|
+
|
|
2061
|
+
RETURNS:
|
|
2062
|
+
Response object.
|
|
2063
|
+
|
|
2064
|
+
RAISES:
|
|
2065
|
+
None
|
|
2066
|
+
|
|
2067
|
+
EXAMPLES:
|
|
2068
|
+
resp = UtilFuncs._http_request("http://abc/xyz.teradata")
|
|
2069
|
+
"""
|
|
2070
|
+
kwargs["verify"] = configure.certificate_file
|
|
2071
|
+
|
|
2072
|
+
if not configure.certificate_file:
|
|
2073
|
+
warnings.filterwarnings("ignore", message="Unverified HTTPS request is being made to host[ a-zA-Z0-9'-.]*")
|
|
2074
|
+
|
|
2075
|
+
return getattr(requests, method_type.value)(url=url, **kwargs)
|
|
2076
|
+
|
|
2077
|
+
@staticmethod
|
|
2078
|
+
def _get_tdml_directory():
|
|
2079
|
+
"""
|
|
2080
|
+
DESCRIPTION:
|
|
2081
|
+
Function to get the directory of teradataml module.
|
|
2082
|
+
|
|
2083
|
+
PARAMETERS:
|
|
2084
|
+
None.
|
|
2085
|
+
|
|
2086
|
+
RETURNS:
|
|
2087
|
+
str.
|
|
2088
|
+
|
|
2089
|
+
EXAMPLES:
|
|
2090
|
+
>>> tdml_path = UtilFuncs._get_tdml_directory()
|
|
2091
|
+
"""
|
|
2092
|
+
# Get the directory of teradataml module.
|
|
2093
|
+
return os.path.dirname(_version.__file__)
|
|
2094
|
+
|
|
2095
|
+
@staticmethod
|
|
2096
|
+
def _get_data_directory(dir_name=None, func_type=None, version=None):
|
|
2097
|
+
"""
|
|
2098
|
+
DESCRIPTION:
|
|
2099
|
+
Function to get the directory for jsons or docs from teradataml/data.
|
|
2100
|
+
|
|
2101
|
+
PARAMETERS:
|
|
2102
|
+
dir_name:
|
|
2103
|
+
Optional Argument.
|
|
2104
|
+
Specifies the name of directory required from teradataml/data directory.
|
|
2105
|
+
Permitted values : ["jsons", "docs"]
|
|
2106
|
+
Types: str
|
|
2107
|
+
|
|
2108
|
+
func_type
|
|
2109
|
+
Optional Argument.
|
|
2110
|
+
Specifies the type of function for which jsons or docs directory is required.
|
|
2111
|
+
Types: TeradataAnalyticFunctionInfo
|
|
2112
|
+
|
|
2113
|
+
version:
|
|
2114
|
+
Optional Argument.
|
|
2115
|
+
Specifies the version of directory for which jsons or docs directory is required.
|
|
2116
|
+
Types: str
|
|
2117
|
+
|
|
2118
|
+
RETURNS:
|
|
2119
|
+
path to desired directory.
|
|
2120
|
+
|
|
2121
|
+
EXAMPLES:
|
|
2122
|
+
>>> json_dir = UtilFuncs._get_data_directory(dir_name="jsons",
|
|
2123
|
+
... func_type=TeradataAnalyticFunctionInfo.FASTPATH,
|
|
2124
|
+
... version="17.10")
|
|
2125
|
+
|
|
2126
|
+
"""
|
|
2127
|
+
if func_type:
|
|
2128
|
+
func_type = func_type.value["func_type"]
|
|
2129
|
+
dir_path = os.path.join(UtilFuncs._get_tdml_directory(), "data")
|
|
2130
|
+
levels = [dir_name, func_type, version]
|
|
2131
|
+
for level in levels:
|
|
2132
|
+
if level:
|
|
2133
|
+
dir_path = os.path.join(dir_path, level)
|
|
2134
|
+
else:
|
|
2135
|
+
break
|
|
2136
|
+
if os.path.exists(dir_path):
|
|
2137
|
+
return dir_path
|
|
2138
|
+
|
|
2139
|
+
@staticmethod
|
|
2140
|
+
def _replace_special_chars(str_value, replace_char="_", addon=None):
|
|
2141
|
+
"""
|
|
2142
|
+
DESCRIPTION:
|
|
2143
|
+
Function to replace any special character with a underscore(_).
|
|
2144
|
+
|
|
2145
|
+
PARAMETERS:
|
|
2146
|
+
str_value:
|
|
2147
|
+
Required Argument.
|
|
2148
|
+
Specifies the value of string which has special characters.
|
|
2149
|
+
Types: str
|
|
2150
|
+
|
|
2151
|
+
replace_char:
|
|
2152
|
+
Optional Argument.
|
|
2153
|
+
Specifies the value to be replaced for any special character.
|
|
2154
|
+
Types: str
|
|
2155
|
+
|
|
2156
|
+
addon
|
|
2157
|
+
Optional Argument.
|
|
2158
|
+
Specifies a dictionary with key as value to be checked in "s" and value
|
|
2159
|
+
to be replaced in "s".
|
|
2160
|
+
Types: dict
|
|
2161
|
+
|
|
2162
|
+
RETURNS:
|
|
2163
|
+
str
|
|
2164
|
+
|
|
2165
|
+
EXAMPLES:
|
|
2166
|
+
>>> json_dir = UtilFuncs._replace_special_chars("123$%.", addon={"$": "#"})
|
|
2167
|
+
"""
|
|
2168
|
+
char_dict = {'A': 'A',
|
|
2169
|
+
'B': 'B',
|
|
2170
|
+
'C': 'C',
|
|
2171
|
+
'D': 'D',
|
|
2172
|
+
'E': 'E',
|
|
2173
|
+
'F': 'F',
|
|
2174
|
+
'G': 'G',
|
|
2175
|
+
'H': 'H',
|
|
2176
|
+
'I': 'I',
|
|
2177
|
+
'J': 'J',
|
|
2178
|
+
'K': 'K',
|
|
2179
|
+
'L': 'L',
|
|
2180
|
+
'M': 'M',
|
|
2181
|
+
'N': 'N',
|
|
2182
|
+
'O': 'O',
|
|
2183
|
+
'P': 'P',
|
|
2184
|
+
'Q': 'Q',
|
|
2185
|
+
'R': 'R',
|
|
2186
|
+
'S': 'S',
|
|
2187
|
+
'T': 'T',
|
|
2188
|
+
'U': 'U',
|
|
2189
|
+
'V': 'V',
|
|
2190
|
+
'W': 'W',
|
|
2191
|
+
'X': 'X',
|
|
2192
|
+
'Y': 'Y',
|
|
2193
|
+
'Z': 'Z',
|
|
2194
|
+
'a': 'a',
|
|
2195
|
+
'b': 'b',
|
|
2196
|
+
'c': 'c',
|
|
2197
|
+
'd': 'd',
|
|
2198
|
+
'e': 'e',
|
|
2199
|
+
'f': 'f',
|
|
2200
|
+
'g': 'g',
|
|
2201
|
+
'h': 'h',
|
|
2202
|
+
'i': 'i',
|
|
2203
|
+
'j': 'j',
|
|
2204
|
+
'k': 'k',
|
|
2205
|
+
'l': 'l',
|
|
2206
|
+
'm': 'm',
|
|
2207
|
+
'n': 'n',
|
|
2208
|
+
'o': 'o',
|
|
2209
|
+
'p': 'p',
|
|
2210
|
+
'q': 'q',
|
|
2211
|
+
'r': 'r',
|
|
2212
|
+
's': 's',
|
|
2213
|
+
't': 't',
|
|
2214
|
+
'u': 'u',
|
|
2215
|
+
'v': 'v',
|
|
2216
|
+
'w': 'w',
|
|
2217
|
+
'x': 'x',
|
|
2218
|
+
'y': 'y',
|
|
2219
|
+
'z': 'z',
|
|
2220
|
+
'0': '0',
|
|
2221
|
+
'1': '1',
|
|
2222
|
+
'2': '2',
|
|
2223
|
+
'3': '3',
|
|
2224
|
+
'4': '4',
|
|
2225
|
+
'5': '5',
|
|
2226
|
+
'6': '6',
|
|
2227
|
+
'7': '7',
|
|
2228
|
+
'8': '8',
|
|
2229
|
+
'9': '9'}
|
|
2230
|
+
char_dict.update({" ": "", "_": "_", "\"": ""})
|
|
2231
|
+
if addon:
|
|
2232
|
+
char_dict.update(addon)
|
|
2233
|
+
return reduce(lambda x,y: x+y, (char_dict.get(c, replace_char) for c in str_value))
|
|
2234
|
+
|
|
2235
|
+
@staticmethod
|
|
2236
|
+
def _get_dict_from_libs(lib_name):
|
|
2237
|
+
"""
|
|
2238
|
+
DESCRIPTION:
|
|
2239
|
+
Function to format the list of library version string to a dictionary,
|
|
2240
|
+
on the basis of regex.
|
|
2241
|
+
|
|
2242
|
+
PARAMETERS:
|
|
2243
|
+
lib_name:
|
|
2244
|
+
Required Argument.
|
|
2245
|
+
Specifies the libs the user wants to format to a dictionary with
|
|
2246
|
+
key as lib_name and value as lib_version.
|
|
2247
|
+
Types: str, list of str
|
|
2248
|
+
|
|
2249
|
+
RETURNS:
|
|
2250
|
+
dict
|
|
2251
|
+
"""
|
|
2252
|
+
result = {}
|
|
2253
|
+
if isinstance(lib_name, str):
|
|
2254
|
+
lib_name = UtilFuncs._as_list(lib_name)
|
|
2255
|
+
for lib in lib_name:
|
|
2256
|
+
matches = re.findall(r'([^<>=]+)([<>=].*)', lib)
|
|
2257
|
+
if matches:
|
|
2258
|
+
for key, value in matches:
|
|
2259
|
+
result[key] = value
|
|
2260
|
+
else:
|
|
2261
|
+
result[lib] = ''
|
|
2262
|
+
return result
|
|
2263
|
+
|
|
2264
|
+
@staticmethod
|
|
2265
|
+
def _is_valid_td_type(type_):
|
|
2266
|
+
"""
|
|
2267
|
+
DESCRIPTION:
|
|
2268
|
+
Function to check whether it is valid teradatasqlalchemy type or not.
|
|
2269
|
+
|
|
2270
|
+
PARAMETERS:
|
|
2271
|
+
type_:
|
|
2272
|
+
Required Argument.
|
|
2273
|
+
Specifies any value which needs to be validated for teradatasqlalchemy type.
|
|
2274
|
+
Types: Any python object
|
|
2275
|
+
|
|
2276
|
+
RETURNS:
|
|
2277
|
+
bool
|
|
2278
|
+
"""
|
|
2279
|
+
if isinstance(type_, _TDType):
|
|
2280
|
+
return True
|
|
2281
|
+
if isinstance(type_, type) and issubclass(type_, _TDType):
|
|
2282
|
+
return True
|
|
2283
|
+
return False
|
|
2284
|
+
|
|
2285
|
+
@staticmethod
|
|
2286
|
+
def _all_df_column_expressions(df_column):
|
|
2287
|
+
"""
|
|
2288
|
+
DESCRIPTION:
|
|
2289
|
+
A method to get all the SQLALchemy Columns involved in corresponding DataFrame.
|
|
2290
|
+
|
|
2291
|
+
PARAMETERS:
|
|
2292
|
+
df_column:
|
|
2293
|
+
Required Argument.
|
|
2294
|
+
Specifies teradataml DataFrame ColumnExpression.
|
|
2295
|
+
Types: teradataml DataFrame ColumnExpression
|
|
2296
|
+
|
|
2297
|
+
RAISES:
|
|
2298
|
+
None
|
|
2299
|
+
|
|
2300
|
+
RETURNS:
|
|
2301
|
+
list
|
|
2302
|
+
|
|
2303
|
+
EXAMPLES:
|
|
2304
|
+
>>> self._all_df_column_expressions
|
|
2305
|
+
"""
|
|
2306
|
+
cols = []
|
|
2307
|
+
for table_ in df_column._get_sqlalchemy_tables(df_column.expression):
|
|
2308
|
+
cols = cols + list(table_.columns)
|
|
2309
|
+
return cols
|
|
2310
|
+
|
|
2311
|
+
@staticmethod
|
|
2312
|
+
def _all_df_columns(df_column):
|
|
2313
|
+
"""
|
|
2314
|
+
DESCRIPTION:
|
|
2315
|
+
A method to get all the column names involved in corresponding DataFrame.
|
|
2316
|
+
|
|
2317
|
+
PARAMETERS:
|
|
2318
|
+
df_column:
|
|
2319
|
+
Required Argument.
|
|
2320
|
+
Specifies teradataml DataFrame ColumnExpression.
|
|
2321
|
+
Types: teradataml DataFrame ColumnExpression
|
|
2322
|
+
|
|
2323
|
+
RAISES:
|
|
2324
|
+
None
|
|
2325
|
+
|
|
2326
|
+
RETURNS:
|
|
2327
|
+
list
|
|
2328
|
+
|
|
2329
|
+
EXAMPLES:
|
|
2330
|
+
>>> self._all_df_columns
|
|
2331
|
+
"""
|
|
2332
|
+
return [col.name for col in UtilFuncs._all_df_column_expressions(df_column)]
|
|
2333
|
+
|
|
2334
|
+
@staticmethod
|
|
2335
|
+
def _is_lake():
|
|
2336
|
+
"""
|
|
2337
|
+
DESCRIPTION:
|
|
2338
|
+
An internal function to check whether system is Lake or enterprise.
|
|
2339
|
+
|
|
2340
|
+
PARAMETERS:
|
|
2341
|
+
None.
|
|
2342
|
+
|
|
2343
|
+
RAISES:
|
|
2344
|
+
None
|
|
2345
|
+
|
|
2346
|
+
RETURNS:
|
|
2347
|
+
bool
|
|
2348
|
+
|
|
2349
|
+
EXAMPLES:
|
|
2350
|
+
>>> self._is_lake()
|
|
2351
|
+
"""
|
|
2352
|
+
|
|
2353
|
+
from teradataml.context.context import _get_database_version
|
|
2354
|
+
return int(_get_database_version().split(".")[0]) >= 20
|
|
2355
|
+
|
|
2356
|
+
@staticmethod
|
|
2357
|
+
def _get_python_execution_path():
|
|
2358
|
+
"""
|
|
2359
|
+
DESCRIPTION:
|
|
2360
|
+
An internal function to get the python execution path.
|
|
2361
|
+
|
|
2362
|
+
PARAMETERS:
|
|
2363
|
+
None.
|
|
2364
|
+
|
|
2365
|
+
RAISES:
|
|
2366
|
+
None
|
|
2367
|
+
|
|
2368
|
+
RETURNS:
|
|
2369
|
+
bool
|
|
2370
|
+
|
|
2371
|
+
EXAMPLES:
|
|
2372
|
+
>>> self._get_python_execution_path()
|
|
2373
|
+
"""
|
|
2374
|
+
|
|
2375
|
+
if UtilFuncs._is_lake():
|
|
2376
|
+
return "python"
|
|
2377
|
+
else:
|
|
2378
|
+
if configure.indb_install_location == "/var/opt/teradata/languages/sles12sp3/Python/":
|
|
2379
|
+
return '{}bin/python3'.format(configure.indb_install_location)
|
|
2380
|
+
else:
|
|
2381
|
+
return configure.indb_install_location
|
|
2382
|
+
|
|
2383
|
+
def _is_view(tablename):
|
|
2384
|
+
"""
|
|
2385
|
+
DESCRIPTION:
|
|
2386
|
+
Internal function to check whether the object is view or not.
|
|
2387
|
+
PARAMETERS:
|
|
2388
|
+
tablename:
|
|
2389
|
+
Required Argument.
|
|
2390
|
+
Table name or view name to be checked.
|
|
2391
|
+
Types: str
|
|
2392
|
+
RAISES:
|
|
2393
|
+
None.
|
|
2394
|
+
RETURNS:
|
|
2395
|
+
True when the tablename is view, else false.
|
|
2396
|
+
EXAMPLES:
|
|
2397
|
+
>>> _is_view('"dbname"."tablename"')
|
|
2398
|
+
"""
|
|
2399
|
+
db_name = UtilFuncs._teradata_unquote_arg(UtilFuncs._extract_db_name(tablename), "\"")
|
|
2400
|
+
table_view_name = UtilFuncs._teradata_unquote_arg(UtilFuncs._extract_table_name(tablename), "\"")
|
|
2401
|
+
query = SQLBundle._build_select_table_kind(db_name, "{0}".format(table_view_name), "'V'")
|
|
2402
|
+
|
|
2403
|
+
df = UtilFuncs._execute_query(query)
|
|
2404
|
+
if len(df) > 0:
|
|
2405
|
+
return True
|
|
2406
|
+
else:
|
|
2407
|
+
return False
|
|
2408
|
+
@staticmethod
|
|
2409
|
+
def _set_queryband():
|
|
2410
|
+
try:
|
|
2411
|
+
qb_query = get_qb_query()
|
|
2412
|
+
execute_sql(qb_query)
|
|
2413
|
+
except Exception:
|
|
2414
|
+
pass
|
|
2415
|
+
|
|
2416
|
+
|
|
2417
|
+
from teradataml.common.aed_utils import AedUtils
|
|
2418
|
+
from teradataml.dbutils.filemgr import remove_file
|