teradataml 20.0.0.8__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.
- teradataml/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/LICENSE.pdf +0 -0
- teradataml/README.md +2762 -0
- teradataml/__init__.py +78 -0
- teradataml/_version.py +11 -0
- teradataml/analytics/Transformations.py +2996 -0
- teradataml/analytics/__init__.py +82 -0
- teradataml/analytics/analytic_function_executor.py +2416 -0
- teradataml/analytics/analytic_query_generator.py +1050 -0
- teradataml/analytics/byom/H2OPredict.py +514 -0
- teradataml/analytics/byom/PMMLPredict.py +437 -0
- teradataml/analytics/byom/__init__.py +16 -0
- teradataml/analytics/json_parser/__init__.py +133 -0
- teradataml/analytics/json_parser/analytic_functions_argument.py +1805 -0
- teradataml/analytics/json_parser/json_store.py +191 -0
- teradataml/analytics/json_parser/metadata.py +1666 -0
- teradataml/analytics/json_parser/utils.py +805 -0
- teradataml/analytics/meta_class.py +236 -0
- teradataml/analytics/sqle/DecisionTreePredict.py +456 -0
- teradataml/analytics/sqle/NaiveBayesPredict.py +420 -0
- teradataml/analytics/sqle/__init__.py +128 -0
- teradataml/analytics/sqle/json/decisiontreepredict_sqle.json +78 -0
- teradataml/analytics/sqle/json/naivebayespredict_sqle.json +62 -0
- teradataml/analytics/table_operator/__init__.py +11 -0
- teradataml/analytics/uaf/__init__.py +82 -0
- teradataml/analytics/utils.py +828 -0
- teradataml/analytics/valib.py +1617 -0
- teradataml/automl/__init__.py +5835 -0
- teradataml/automl/autodataprep/__init__.py +493 -0
- teradataml/automl/custom_json_utils.py +1625 -0
- teradataml/automl/data_preparation.py +1384 -0
- teradataml/automl/data_transformation.py +1254 -0
- teradataml/automl/feature_engineering.py +2273 -0
- teradataml/automl/feature_exploration.py +1873 -0
- teradataml/automl/model_evaluation.py +488 -0
- teradataml/automl/model_training.py +1407 -0
- teradataml/catalog/__init__.py +2 -0
- teradataml/catalog/byom.py +1759 -0
- teradataml/catalog/function_argument_mapper.py +859 -0
- teradataml/catalog/model_cataloging_utils.py +491 -0
- teradataml/clients/__init__.py +0 -0
- teradataml/clients/auth_client.py +137 -0
- teradataml/clients/keycloak_client.py +165 -0
- teradataml/clients/pkce_client.py +481 -0
- teradataml/common/__init__.py +1 -0
- teradataml/common/aed_utils.py +2078 -0
- teradataml/common/bulk_exposed_utils.py +113 -0
- teradataml/common/constants.py +1669 -0
- teradataml/common/deprecations.py +166 -0
- teradataml/common/exceptions.py +147 -0
- teradataml/common/formula.py +743 -0
- teradataml/common/garbagecollector.py +666 -0
- teradataml/common/logger.py +1261 -0
- teradataml/common/messagecodes.py +518 -0
- teradataml/common/messages.py +262 -0
- teradataml/common/pylogger.py +67 -0
- teradataml/common/sqlbundle.py +764 -0
- teradataml/common/td_coltype_code_to_tdtype.py +48 -0
- teradataml/common/utils.py +3166 -0
- teradataml/common/warnings.py +36 -0
- teradataml/common/wrapper_utils.py +625 -0
- teradataml/config/__init__.py +0 -0
- teradataml/config/dummy_file1.cfg +5 -0
- teradataml/config/dummy_file2.cfg +3 -0
- teradataml/config/sqlengine_alias_definitions_v1.0 +14 -0
- teradataml/config/sqlengine_alias_definitions_v1.1 +20 -0
- teradataml/config/sqlengine_alias_definitions_v1.3 +19 -0
- teradataml/context/__init__.py +0 -0
- teradataml/context/aed_context.py +223 -0
- teradataml/context/context.py +1462 -0
- teradataml/data/A_loan.csv +19 -0
- teradataml/data/BINARY_REALS_LEFT.csv +11 -0
- teradataml/data/BINARY_REALS_RIGHT.csv +11 -0
- teradataml/data/B_loan.csv +49 -0
- teradataml/data/BuoyData2.csv +17 -0
- teradataml/data/CONVOLVE2_COMPLEX_LEFT.csv +5 -0
- teradataml/data/CONVOLVE2_COMPLEX_RIGHT.csv +5 -0
- teradataml/data/Convolve2RealsLeft.csv +5 -0
- teradataml/data/Convolve2RealsRight.csv +5 -0
- teradataml/data/Convolve2ValidLeft.csv +11 -0
- teradataml/data/Convolve2ValidRight.csv +11 -0
- teradataml/data/DFFTConv_Real_8_8.csv +65 -0
- teradataml/data/Employee.csv +5 -0
- teradataml/data/Employee_Address.csv +4 -0
- teradataml/data/Employee_roles.csv +5 -0
- teradataml/data/JulesBelvezeDummyData.csv +100 -0
- teradataml/data/Mall_customer_data.csv +201 -0
- teradataml/data/Orders1_12mf.csv +25 -0
- teradataml/data/Pi_loan.csv +7 -0
- teradataml/data/SMOOTHED_DATA.csv +7 -0
- teradataml/data/TestDFFT8.csv +9 -0
- teradataml/data/TestRiver.csv +109 -0
- teradataml/data/Traindata.csv +28 -0
- teradataml/data/__init__.py +0 -0
- teradataml/data/acf.csv +17 -0
- teradataml/data/adaboost_example.json +34 -0
- teradataml/data/adaboostpredict_example.json +24 -0
- teradataml/data/additional_table.csv +11 -0
- teradataml/data/admissions_test.csv +21 -0
- teradataml/data/admissions_train.csv +41 -0
- teradataml/data/admissions_train_nulls.csv +41 -0
- teradataml/data/advertising.csv +201 -0
- teradataml/data/ageandheight.csv +13 -0
- teradataml/data/ageandpressure.csv +31 -0
- teradataml/data/amazon_reviews_25.csv +26 -0
- teradataml/data/antiselect_example.json +36 -0
- teradataml/data/antiselect_input.csv +8 -0
- teradataml/data/antiselect_input_mixed_case.csv +8 -0
- teradataml/data/applicant_external.csv +7 -0
- teradataml/data/applicant_reference.csv +7 -0
- teradataml/data/apriori_example.json +22 -0
- teradataml/data/arima_example.json +9 -0
- teradataml/data/assortedtext_input.csv +8 -0
- teradataml/data/attribution_example.json +34 -0
- teradataml/data/attribution_sample_table.csv +27 -0
- teradataml/data/attribution_sample_table1.csv +6 -0
- teradataml/data/attribution_sample_table2.csv +11 -0
- teradataml/data/bank_churn.csv +10001 -0
- teradataml/data/bank_marketing.csv +11163 -0
- teradataml/data/bank_web_clicks1.csv +43 -0
- teradataml/data/bank_web_clicks2.csv +91 -0
- teradataml/data/bank_web_url.csv +85 -0
- teradataml/data/barrier.csv +2 -0
- teradataml/data/barrier_new.csv +3 -0
- teradataml/data/betweenness_example.json +14 -0
- teradataml/data/bike_sharing.csv +732 -0
- teradataml/data/bin_breaks.csv +8 -0
- teradataml/data/bin_fit_ip.csv +4 -0
- teradataml/data/binary_complex_left.csv +11 -0
- teradataml/data/binary_complex_right.csv +11 -0
- teradataml/data/binary_matrix_complex_left.csv +21 -0
- teradataml/data/binary_matrix_complex_right.csv +21 -0
- teradataml/data/binary_matrix_real_left.csv +21 -0
- teradataml/data/binary_matrix_real_right.csv +21 -0
- teradataml/data/blood2ageandweight.csv +26 -0
- teradataml/data/bmi.csv +501 -0
- teradataml/data/boston.csv +507 -0
- teradataml/data/boston2cols.csv +721 -0
- teradataml/data/breast_cancer.csv +570 -0
- teradataml/data/buoydata_mix.csv +11 -0
- teradataml/data/burst_data.csv +5 -0
- teradataml/data/burst_example.json +21 -0
- teradataml/data/byom_example.json +34 -0
- teradataml/data/bytes_table.csv +4 -0
- teradataml/data/cal_housing_ex_raw.csv +70 -0
- teradataml/data/callers.csv +7 -0
- teradataml/data/calls.csv +10 -0
- teradataml/data/cars_hist.csv +33 -0
- teradataml/data/cat_table.csv +25 -0
- teradataml/data/ccm_example.json +32 -0
- teradataml/data/ccm_input.csv +91 -0
- teradataml/data/ccm_input2.csv +13 -0
- teradataml/data/ccmexample.csv +101 -0
- teradataml/data/ccmprepare_example.json +9 -0
- teradataml/data/ccmprepare_input.csv +91 -0
- teradataml/data/cfilter_example.json +12 -0
- teradataml/data/changepointdetection_example.json +18 -0
- teradataml/data/changepointdetectionrt_example.json +8 -0
- teradataml/data/chi_sq.csv +3 -0
- teradataml/data/churn_data.csv +14 -0
- teradataml/data/churn_emission.csv +35 -0
- teradataml/data/churn_initial.csv +3 -0
- teradataml/data/churn_state_transition.csv +5 -0
- teradataml/data/citedges_2.csv +745 -0
- teradataml/data/citvertices_2.csv +1210 -0
- teradataml/data/clicks2.csv +16 -0
- teradataml/data/clickstream.csv +13 -0
- teradataml/data/clickstream1.csv +11 -0
- teradataml/data/closeness_example.json +16 -0
- teradataml/data/complaints.csv +21 -0
- teradataml/data/complaints_mini.csv +3 -0
- teradataml/data/complaints_test_tokenized.csv +353 -0
- teradataml/data/complaints_testtoken.csv +224 -0
- teradataml/data/complaints_tokens_model.csv +348 -0
- teradataml/data/complaints_tokens_test.csv +353 -0
- teradataml/data/complaints_traintoken.csv +472 -0
- teradataml/data/computers_category.csv +1001 -0
- teradataml/data/computers_test1.csv +1252 -0
- teradataml/data/computers_train1.csv +5009 -0
- teradataml/data/computers_train1_clustered.csv +5009 -0
- teradataml/data/confusionmatrix_example.json +9 -0
- teradataml/data/conversion_event_table.csv +3 -0
- teradataml/data/corr_input.csv +17 -0
- teradataml/data/correlation_example.json +11 -0
- teradataml/data/covid_confirm_sd.csv +83 -0
- teradataml/data/coxhazardratio_example.json +39 -0
- teradataml/data/coxph_example.json +15 -0
- teradataml/data/coxsurvival_example.json +28 -0
- teradataml/data/cpt.csv +41 -0
- teradataml/data/credit_ex_merged.csv +45 -0
- teradataml/data/creditcard_data.csv +1001 -0
- teradataml/data/customer_loyalty.csv +301 -0
- teradataml/data/customer_loyalty_newseq.csv +31 -0
- teradataml/data/customer_segmentation_test.csv +2628 -0
- teradataml/data/customer_segmentation_train.csv +8069 -0
- teradataml/data/dataframe_example.json +173 -0
- teradataml/data/decisionforest_example.json +37 -0
- teradataml/data/decisionforestpredict_example.json +38 -0
- teradataml/data/decisiontree_example.json +21 -0
- teradataml/data/decisiontreepredict_example.json +45 -0
- teradataml/data/dfft2_size4_real.csv +17 -0
- teradataml/data/dfft2_test_matrix16.csv +17 -0
- teradataml/data/dfft2conv_real_4_4.csv +65 -0
- teradataml/data/diabetes.csv +443 -0
- teradataml/data/diabetes_test.csv +89 -0
- teradataml/data/dict_table.csv +5 -0
- teradataml/data/docperterm_table.csv +4 -0
- teradataml/data/docs/__init__.py +1 -0
- teradataml/data/docs/byom/__init__.py +0 -0
- teradataml/data/docs/byom/docs/DataRobotPredict.py +180 -0
- teradataml/data/docs/byom/docs/DataikuPredict.py +217 -0
- teradataml/data/docs/byom/docs/H2OPredict.py +325 -0
- teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
- teradataml/data/docs/byom/docs/ONNXPredict.py +283 -0
- teradataml/data/docs/byom/docs/ONNXSeq2Seq.py +255 -0
- teradataml/data/docs/byom/docs/PMMLPredict.py +278 -0
- teradataml/data/docs/byom/docs/__init__.py +0 -0
- teradataml/data/docs/sqle/__init__.py +0 -0
- teradataml/data/docs/sqle/docs_17_10/Antiselect.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/Attribution.py +200 -0
- teradataml/data/docs/sqle/docs_17_10/BincodeFit.py +172 -0
- teradataml/data/docs/sqle/docs_17_10/BincodeTransform.py +131 -0
- teradataml/data/docs/sqle/docs_17_10/CategoricalSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_10/ChiSq.py +90 -0
- teradataml/data/docs/sqle/docs_17_10/ColumnSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_10/ConvertTo.py +96 -0
- teradataml/data/docs/sqle/docs_17_10/DecisionForestPredict.py +139 -0
- teradataml/data/docs/sqle/docs_17_10/DecisionTreePredict.py +152 -0
- teradataml/data/docs/sqle/docs_17_10/FTest.py +161 -0
- teradataml/data/docs/sqle/docs_17_10/FillRowId.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/Fit.py +88 -0
- teradataml/data/docs/sqle/docs_17_10/GLMPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_10/GetRowsWithMissingValues.py +85 -0
- teradataml/data/docs/sqle/docs_17_10/GetRowsWithoutMissingValues.py +82 -0
- teradataml/data/docs/sqle/docs_17_10/Histogram.py +165 -0
- teradataml/data/docs/sqle/docs_17_10/MovingAverage.py +134 -0
- teradataml/data/docs/sqle/docs_17_10/NGramSplitter.py +209 -0
- teradataml/data/docs/sqle/docs_17_10/NPath.py +266 -0
- teradataml/data/docs/sqle/docs_17_10/NaiveBayesPredict.py +116 -0
- teradataml/data/docs/sqle/docs_17_10/NaiveBayesTextClassifierPredict.py +176 -0
- teradataml/data/docs/sqle/docs_17_10/NumApply.py +147 -0
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +135 -0
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +109 -0
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterFit.py +166 -0
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +105 -0
- teradataml/data/docs/sqle/docs_17_10/Pack.py +128 -0
- teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesFit.py +112 -0
- teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesTransform.py +102 -0
- teradataml/data/docs/sqle/docs_17_10/QQNorm.py +105 -0
- teradataml/data/docs/sqle/docs_17_10/RoundColumns.py +110 -0
- teradataml/data/docs/sqle/docs_17_10/RowNormalizeFit.py +118 -0
- teradataml/data/docs/sqle/docs_17_10/RowNormalizeTransform.py +99 -0
- teradataml/data/docs/sqle/docs_17_10/SVMSparsePredict.py +153 -0
- teradataml/data/docs/sqle/docs_17_10/ScaleFit.py +197 -0
- teradataml/data/docs/sqle/docs_17_10/ScaleTransform.py +99 -0
- teradataml/data/docs/sqle/docs_17_10/Sessionize.py +114 -0
- teradataml/data/docs/sqle/docs_17_10/SimpleImputeFit.py +116 -0
- teradataml/data/docs/sqle/docs_17_10/SimpleImputeTransform.py +98 -0
- teradataml/data/docs/sqle/docs_17_10/StrApply.py +187 -0
- teradataml/data/docs/sqle/docs_17_10/StringSimilarity.py +146 -0
- teradataml/data/docs/sqle/docs_17_10/Transform.py +105 -0
- teradataml/data/docs/sqle/docs_17_10/UnivariateStatistics.py +142 -0
- teradataml/data/docs/sqle/docs_17_10/Unpack.py +214 -0
- teradataml/data/docs/sqle/docs_17_10/WhichMax.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/WhichMin.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/ZTest.py +155 -0
- teradataml/data/docs/sqle/docs_17_10/__init__.py +0 -0
- teradataml/data/docs/sqle/docs_17_20/ANOVA.py +186 -0
- teradataml/data/docs/sqle/docs_17_20/Antiselect.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/Apriori.py +138 -0
- teradataml/data/docs/sqle/docs_17_20/Attribution.py +201 -0
- teradataml/data/docs/sqle/docs_17_20/BincodeFit.py +172 -0
- teradataml/data/docs/sqle/docs_17_20/BincodeTransform.py +139 -0
- teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
- teradataml/data/docs/sqle/docs_17_20/CategoricalSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_20/ChiSq.py +90 -0
- teradataml/data/docs/sqle/docs_17_20/ClassificationEvaluator.py +166 -0
- teradataml/data/docs/sqle/docs_17_20/ColumnSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +246 -0
- teradataml/data/docs/sqle/docs_17_20/ConvertTo.py +113 -0
- teradataml/data/docs/sqle/docs_17_20/DecisionForest.py +280 -0
- teradataml/data/docs/sqle/docs_17_20/DecisionForestPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_20/DecisionTreePredict.py +136 -0
- teradataml/data/docs/sqle/docs_17_20/FTest.py +240 -0
- teradataml/data/docs/sqle/docs_17_20/FillRowId.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/Fit.py +88 -0
- teradataml/data/docs/sqle/docs_17_20/GLM.py +541 -0
- teradataml/data/docs/sqle/docs_17_20/GLMPerSegment.py +415 -0
- teradataml/data/docs/sqle/docs_17_20/GLMPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_20/GLMPredictPerSegment.py +233 -0
- teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +125 -0
- teradataml/data/docs/sqle/docs_17_20/GetRowsWithMissingValues.py +109 -0
- teradataml/data/docs/sqle/docs_17_20/GetRowsWithoutMissingValues.py +106 -0
- teradataml/data/docs/sqle/docs_17_20/Histogram.py +224 -0
- teradataml/data/docs/sqle/docs_17_20/KMeans.py +251 -0
- teradataml/data/docs/sqle/docs_17_20/KMeansPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_20/KNN.py +215 -0
- teradataml/data/docs/sqle/docs_17_20/MovingAverage.py +134 -0
- teradataml/data/docs/sqle/docs_17_20/NERExtractor.py +121 -0
- teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +209 -0
- teradataml/data/docs/sqle/docs_17_20/NPath.py +266 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesPredict.py +116 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierPredict.py +177 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierTrainer.py +127 -0
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +119 -0
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineTransform.py +112 -0
- teradataml/data/docs/sqle/docs_17_20/NumApply.py +147 -0
- teradataml/data/docs/sqle/docs_17_20/OneClassSVM.py +307 -0
- teradataml/data/docs/sqle/docs_17_20/OneClassSVMPredict.py +185 -0
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +231 -0
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +121 -0
- teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingFit.py +220 -0
- teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingTransform.py +127 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +191 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterTransform.py +117 -0
- teradataml/data/docs/sqle/docs_17_20/Pack.py +128 -0
- teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
- teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesFit.py +112 -0
- teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesTransform.py +112 -0
- teradataml/data/docs/sqle/docs_17_20/QQNorm.py +105 -0
- teradataml/data/docs/sqle/docs_17_20/ROC.py +164 -0
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionFit.py +155 -0
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionMinComponents.py +106 -0
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionTransform.py +120 -0
- teradataml/data/docs/sqle/docs_17_20/RegressionEvaluator.py +211 -0
- teradataml/data/docs/sqle/docs_17_20/RoundColumns.py +109 -0
- teradataml/data/docs/sqle/docs_17_20/RowNormalizeFit.py +118 -0
- teradataml/data/docs/sqle/docs_17_20/RowNormalizeTransform.py +111 -0
- teradataml/data/docs/sqle/docs_17_20/SMOTE.py +212 -0
- teradataml/data/docs/sqle/docs_17_20/SVM.py +414 -0
- teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +213 -0
- teradataml/data/docs/sqle/docs_17_20/SVMSparsePredict.py +153 -0
- teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +315 -0
- teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +202 -0
- teradataml/data/docs/sqle/docs_17_20/SentimentExtractor.py +206 -0
- teradataml/data/docs/sqle/docs_17_20/Sessionize.py +114 -0
- teradataml/data/docs/sqle/docs_17_20/Shap.py +225 -0
- teradataml/data/docs/sqle/docs_17_20/Silhouette.py +153 -0
- teradataml/data/docs/sqle/docs_17_20/SimpleImputeFit.py +116 -0
- teradataml/data/docs/sqle/docs_17_20/SimpleImputeTransform.py +109 -0
- teradataml/data/docs/sqle/docs_17_20/StrApply.py +187 -0
- teradataml/data/docs/sqle/docs_17_20/StringSimilarity.py +146 -0
- teradataml/data/docs/sqle/docs_17_20/TDDecisionForestPredict.py +207 -0
- teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +333 -0
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
- teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/TargetEncodingFit.py +267 -0
- teradataml/data/docs/sqle/docs_17_20/TargetEncodingTransform.py +141 -0
- teradataml/data/docs/sqle/docs_17_20/TextMorph.py +119 -0
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +224 -0
- teradataml/data/docs/sqle/docs_17_20/TrainTestSplit.py +160 -0
- teradataml/data/docs/sqle/docs_17_20/Transform.py +123 -0
- teradataml/data/docs/sqle/docs_17_20/UnivariateStatistics.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/Unpack.py +214 -0
- teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
- teradataml/data/docs/sqle/docs_17_20/VectorDistance.py +169 -0
- teradataml/data/docs/sqle/docs_17_20/WhichMax.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/WhichMin.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/WordEmbeddings.py +237 -0
- teradataml/data/docs/sqle/docs_17_20/XGBoost.py +362 -0
- teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +281 -0
- teradataml/data/docs/sqle/docs_17_20/ZTest.py +220 -0
- teradataml/data/docs/sqle/docs_17_20/__init__.py +0 -0
- teradataml/data/docs/tableoperator/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_00/ReadNOS.py +430 -0
- teradataml/data/docs/tableoperator/docs_17_00/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_05/ReadNOS.py +430 -0
- teradataml/data/docs/tableoperator/docs_17_05/WriteNOS.py +348 -0
- teradataml/data/docs/tableoperator/docs_17_05/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_10/ReadNOS.py +429 -0
- teradataml/data/docs/tableoperator/docs_17_10/WriteNOS.py +348 -0
- teradataml/data/docs/tableoperator/docs_17_10/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
- teradataml/data/docs/tableoperator/docs_17_20/ReadNOS.py +440 -0
- teradataml/data/docs/tableoperator/docs_17_20/WriteNOS.py +387 -0
- teradataml/data/docs/tableoperator/docs_17_20/__init__.py +0 -0
- teradataml/data/docs/uaf/__init__.py +0 -0
- teradataml/data/docs/uaf/docs_17_20/ACF.py +186 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +370 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +172 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +161 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
- teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
- teradataml/data/docs/uaf/docs_17_20/BinaryMatrixOp.py +248 -0
- teradataml/data/docs/uaf/docs_17_20/BinarySeriesOp.py +252 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +178 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +175 -0
- teradataml/data/docs/uaf/docs_17_20/Convolve.py +230 -0
- teradataml/data/docs/uaf/docs_17_20/Convolve2.py +218 -0
- teradataml/data/docs/uaf/docs_17_20/CopyArt.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +185 -0
- teradataml/data/docs/uaf/docs_17_20/DFFT.py +204 -0
- teradataml/data/docs/uaf/docs_17_20/DFFT2.py +216 -0
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +216 -0
- teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +192 -0
- teradataml/data/docs/uaf/docs_17_20/DIFF.py +175 -0
- teradataml/data/docs/uaf/docs_17_20/DTW.py +180 -0
- teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +217 -0
- teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +142 -0
- teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +184 -0
- teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +185 -0
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
- teradataml/data/docs/uaf/docs_17_20/FitMetrics.py +172 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesFormula.py +206 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +143 -0
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +198 -0
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +260 -0
- teradataml/data/docs/uaf/docs_17_20/IDFFT.py +165 -0
- teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +191 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
- teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/InputValidator.py +121 -0
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +156 -0
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +215 -0
- teradataml/data/docs/uaf/docs_17_20/MAMean.py +174 -0
- teradataml/data/docs/uaf/docs_17_20/MInfo.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
- teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +191 -0
- teradataml/data/docs/uaf/docs_17_20/PACF.py +157 -0
- teradataml/data/docs/uaf/docs_17_20/Portman.py +217 -0
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +203 -0
- teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +155 -0
- teradataml/data/docs/uaf/docs_17_20/Resample.py +237 -0
- teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
- teradataml/data/docs/uaf/docs_17_20/SInfo.py +123 -0
- teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +173 -0
- teradataml/data/docs/uaf/docs_17_20/SelectionCriteria.py +174 -0
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +171 -0
- teradataml/data/docs/uaf/docs_17_20/SignifResidmean.py +164 -0
- teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +180 -0
- teradataml/data/docs/uaf/docs_17_20/Smoothma.py +208 -0
- teradataml/data/docs/uaf/docs_17_20/TrackingOp.py +151 -0
- teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +171 -0
- teradataml/data/docs/uaf/docs_17_20/Unnormalize.py +202 -0
- teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +171 -0
- teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
- teradataml/data/docs/uaf/docs_17_20/__init__.py +0 -0
- teradataml/data/dtw_example.json +18 -0
- teradataml/data/dtw_t1.csv +11 -0
- teradataml/data/dtw_t2.csv +4 -0
- teradataml/data/dwt2d_dataTable.csv +65 -0
- teradataml/data/dwt2d_example.json +16 -0
- teradataml/data/dwt_dataTable.csv +8 -0
- teradataml/data/dwt_example.json +15 -0
- teradataml/data/dwt_filterTable.csv +3 -0
- teradataml/data/dwt_filter_dim.csv +5 -0
- teradataml/data/emission.csv +9 -0
- teradataml/data/emp_table_by_dept.csv +19 -0
- teradataml/data/employee_info.csv +4 -0
- teradataml/data/employee_table.csv +6 -0
- teradataml/data/excluding_event_table.csv +2 -0
- teradataml/data/finance_data.csv +6 -0
- teradataml/data/finance_data2.csv +61 -0
- teradataml/data/finance_data3.csv +93 -0
- teradataml/data/finance_data4.csv +13 -0
- teradataml/data/fish.csv +160 -0
- teradataml/data/fm_blood2ageandweight.csv +26 -0
- teradataml/data/fmeasure_example.json +12 -0
- teradataml/data/followers_leaders.csv +10 -0
- teradataml/data/fpgrowth_example.json +12 -0
- teradataml/data/frequentpaths_example.json +29 -0
- teradataml/data/friends.csv +9 -0
- teradataml/data/fs_input.csv +33 -0
- teradataml/data/fs_input1.csv +33 -0
- teradataml/data/genData.csv +513 -0
- teradataml/data/geodataframe_example.json +40 -0
- teradataml/data/glass_types.csv +215 -0
- teradataml/data/glm_admissions_model.csv +12 -0
- teradataml/data/glm_example.json +56 -0
- teradataml/data/glml1l2_example.json +28 -0
- teradataml/data/glml1l2predict_example.json +54 -0
- teradataml/data/glmpredict_example.json +54 -0
- teradataml/data/gq_t1.csv +21 -0
- teradataml/data/grocery_transaction.csv +19 -0
- teradataml/data/hconvolve_complex_right.csv +5 -0
- teradataml/data/hconvolve_complex_rightmulti.csv +5 -0
- teradataml/data/histogram_example.json +12 -0
- teradataml/data/hmmdecoder_example.json +79 -0
- teradataml/data/hmmevaluator_example.json +25 -0
- teradataml/data/hmmsupervised_example.json +10 -0
- teradataml/data/hmmunsupervised_example.json +8 -0
- teradataml/data/hnsw_alter_data.csv +5 -0
- teradataml/data/hnsw_data.csv +10 -0
- teradataml/data/house_values.csv +12 -0
- teradataml/data/house_values2.csv +13 -0
- teradataml/data/housing_cat.csv +7 -0
- teradataml/data/housing_data.csv +9 -0
- teradataml/data/housing_test.csv +47 -0
- teradataml/data/housing_test_binary.csv +47 -0
- teradataml/data/housing_train.csv +493 -0
- teradataml/data/housing_train_attribute.csv +5 -0
- teradataml/data/housing_train_binary.csv +437 -0
- teradataml/data/housing_train_parameter.csv +2 -0
- teradataml/data/housing_train_response.csv +493 -0
- teradataml/data/housing_train_segment.csv +201 -0
- teradataml/data/ibm_stock.csv +370 -0
- teradataml/data/ibm_stock1.csv +370 -0
- teradataml/data/identitymatch_example.json +22 -0
- teradataml/data/idf_table.csv +4 -0
- teradataml/data/idwt2d_dataTable.csv +5 -0
- teradataml/data/idwt_dataTable.csv +8 -0
- teradataml/data/idwt_filterTable.csv +3 -0
- teradataml/data/impressions.csv +101 -0
- teradataml/data/inflation.csv +21 -0
- teradataml/data/initial.csv +3 -0
- teradataml/data/insect2Cols.csv +61 -0
- teradataml/data/insect_sprays.csv +13 -0
- teradataml/data/insurance.csv +1339 -0
- teradataml/data/interpolator_example.json +13 -0
- teradataml/data/interval_data.csv +5 -0
- teradataml/data/iris_altinput.csv +481 -0
- teradataml/data/iris_attribute_output.csv +8 -0
- teradataml/data/iris_attribute_test.csv +121 -0
- teradataml/data/iris_attribute_train.csv +481 -0
- teradataml/data/iris_category_expect_predict.csv +31 -0
- teradataml/data/iris_data.csv +151 -0
- teradataml/data/iris_input.csv +151 -0
- teradataml/data/iris_response_train.csv +121 -0
- teradataml/data/iris_test.csv +31 -0
- teradataml/data/iris_train.csv +121 -0
- teradataml/data/join_table1.csv +4 -0
- teradataml/data/join_table2.csv +4 -0
- teradataml/data/jsons/anly_function_name.json +7 -0
- teradataml/data/jsons/byom/ONNXSeq2Seq.json +287 -0
- teradataml/data/jsons/byom/dataikupredict.json +148 -0
- teradataml/data/jsons/byom/datarobotpredict.json +147 -0
- teradataml/data/jsons/byom/h2opredict.json +195 -0
- teradataml/data/jsons/byom/onnxembeddings.json +267 -0
- teradataml/data/jsons/byom/onnxpredict.json +187 -0
- teradataml/data/jsons/byom/pmmlpredict.json +147 -0
- teradataml/data/jsons/paired_functions.json +450 -0
- teradataml/data/jsons/sqle/16.20/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/16.20/Attribution.json +249 -0
- teradataml/data/jsons/sqle/16.20/DecisionForestPredict.json +156 -0
- teradataml/data/jsons/sqle/16.20/DecisionTreePredict.json +170 -0
- teradataml/data/jsons/sqle/16.20/GLMPredict.json +122 -0
- teradataml/data/jsons/sqle/16.20/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/16.20/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/16.20/NaiveBayesPredict.json +136 -0
- teradataml/data/jsons/sqle/16.20/NaiveBayesTextClassifierPredict.json +235 -0
- teradataml/data/jsons/sqle/16.20/Pack.json +98 -0
- teradataml/data/jsons/sqle/16.20/SVMSparsePredict.json +162 -0
- teradataml/data/jsons/sqle/16.20/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/16.20/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/16.20/Unpack.json +166 -0
- teradataml/data/jsons/sqle/16.20/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.00/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.00/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.00/DecisionForestPredict.json +156 -0
- teradataml/data/jsons/sqle/17.00/DecisionTreePredict.json +170 -0
- teradataml/data/jsons/sqle/17.00/GLMPredict.json +122 -0
- teradataml/data/jsons/sqle/17.00/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/17.00/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.00/NaiveBayesPredict.json +136 -0
- teradataml/data/jsons/sqle/17.00/NaiveBayesTextClassifierPredict.json +235 -0
- teradataml/data/jsons/sqle/17.00/Pack.json +98 -0
- teradataml/data/jsons/sqle/17.00/SVMSparsePredict.json +162 -0
- teradataml/data/jsons/sqle/17.00/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.00/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.00/Unpack.json +166 -0
- teradataml/data/jsons/sqle/17.00/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.05/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.05/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.05/DecisionForestPredict.json +156 -0
- teradataml/data/jsons/sqle/17.05/DecisionTreePredict.json +170 -0
- teradataml/data/jsons/sqle/17.05/GLMPredict.json +122 -0
- teradataml/data/jsons/sqle/17.05/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/17.05/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.05/NaiveBayesPredict.json +136 -0
- teradataml/data/jsons/sqle/17.05/NaiveBayesTextClassifierPredict.json +235 -0
- teradataml/data/jsons/sqle/17.05/Pack.json +98 -0
- teradataml/data/jsons/sqle/17.05/SVMSparsePredict.json +162 -0
- teradataml/data/jsons/sqle/17.05/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.05/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.05/Unpack.json +166 -0
- teradataml/data/jsons/sqle/17.05/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.10/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.10/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.10/DecisionForestPredict.json +185 -0
- teradataml/data/jsons/sqle/17.10/DecisionTreePredict.json +172 -0
- teradataml/data/jsons/sqle/17.10/GLMPredict.json +151 -0
- teradataml/data/jsons/sqle/17.10/MovingAverage.json +368 -0
- teradataml/data/jsons/sqle/17.10/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.10/NaiveBayesPredict.json +149 -0
- teradataml/data/jsons/sqle/17.10/NaiveBayesTextClassifierPredict.json +288 -0
- teradataml/data/jsons/sqle/17.10/Pack.json +133 -0
- teradataml/data/jsons/sqle/17.10/SVMSparsePredict.json +193 -0
- teradataml/data/jsons/sqle/17.10/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.10/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.10/TD_BinCodeFit.json +239 -0
- teradataml/data/jsons/sqle/17.10/TD_BinCodeTransform.json +70 -0
- teradataml/data/jsons/sqle/17.10/TD_CategoricalSummary.json +54 -0
- teradataml/data/jsons/sqle/17.10/TD_Chisq.json +68 -0
- teradataml/data/jsons/sqle/17.10/TD_ColumnSummary.json +54 -0
- teradataml/data/jsons/sqle/17.10/TD_ConvertTo.json +69 -0
- teradataml/data/jsons/sqle/17.10/TD_FTest.json +187 -0
- teradataml/data/jsons/sqle/17.10/TD_FillRowID.json +52 -0
- teradataml/data/jsons/sqle/17.10/TD_FunctionFit.json +46 -0
- teradataml/data/jsons/sqle/17.10/TD_FunctionTransform.json +72 -0
- teradataml/data/jsons/sqle/17.10/TD_GetRowsWithMissingValues.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_GetRowsWithoutMissingValues.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_Histogram.json +133 -0
- teradataml/data/jsons/sqle/17.10/TD_NumApply.json +147 -0
- teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingFit.json +183 -0
- teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingTransform.json +66 -0
- teradataml/data/jsons/sqle/17.10/TD_OutlierFilterFit.json +197 -0
- teradataml/data/jsons/sqle/17.10/TD_OutlierFilterTransform.json +48 -0
- teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesFit.json +114 -0
- teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesTransform.json +72 -0
- teradataml/data/jsons/sqle/17.10/TD_QQNorm.json +112 -0
- teradataml/data/jsons/sqle/17.10/TD_RoundColumns.json +93 -0
- teradataml/data/jsons/sqle/17.10/TD_RowNormalizeFit.json +128 -0
- teradataml/data/jsons/sqle/17.10/TD_RowNormalizeTransform.json +71 -0
- teradataml/data/jsons/sqle/17.10/TD_ScaleFit.json +157 -0
- teradataml/data/jsons/sqle/17.10/TD_ScaleTransform.json +71 -0
- teradataml/data/jsons/sqle/17.10/TD_SimpleImputeFit.json +148 -0
- teradataml/data/jsons/sqle/17.10/TD_SimpleImputeTransform.json +48 -0
- teradataml/data/jsons/sqle/17.10/TD_StrApply.json +240 -0
- teradataml/data/jsons/sqle/17.10/TD_UnivariateStatistics.json +119 -0
- teradataml/data/jsons/sqle/17.10/TD_WhichMax.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_WhichMin.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_ZTest.json +171 -0
- teradataml/data/jsons/sqle/17.10/Unpack.json +188 -0
- teradataml/data/jsons/sqle/17.10/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.20/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.20/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.20/DecisionForestPredict.json +185 -0
- teradataml/data/jsons/sqle/17.20/DecisionTreePredict.json +172 -0
- teradataml/data/jsons/sqle/17.20/GLMPredict.json +151 -0
- teradataml/data/jsons/sqle/17.20/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/17.20/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.20/NaiveBayesPredict.json +149 -0
- teradataml/data/jsons/sqle/17.20/NaiveBayesTextClassifierPredict.json +287 -0
- teradataml/data/jsons/sqle/17.20/Pack.json +133 -0
- teradataml/data/jsons/sqle/17.20/SVMSparsePredict.json +192 -0
- teradataml/data/jsons/sqle/17.20/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.20/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +149 -0
- teradataml/data/jsons/sqle/17.20/TD_Apriori.json +181 -0
- teradataml/data/jsons/sqle/17.20/TD_BinCodeFit.json +239 -0
- teradataml/data/jsons/sqle/17.20/TD_BinCodeTransform.json +71 -0
- teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
- teradataml/data/jsons/sqle/17.20/TD_CategoricalSummary.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_Chisq.json +68 -0
- teradataml/data/jsons/sqle/17.20/TD_ClassificationEvaluator.json +146 -0
- teradataml/data/jsons/sqle/17.20/TD_ColumnSummary.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_ColumnTransformer.json +218 -0
- teradataml/data/jsons/sqle/17.20/TD_ConvertTo.json +92 -0
- teradataml/data/jsons/sqle/17.20/TD_DecisionForest.json +260 -0
- teradataml/data/jsons/sqle/17.20/TD_DecisionForestPredict.json +139 -0
- teradataml/data/jsons/sqle/17.20/TD_FTest.json +269 -0
- teradataml/data/jsons/sqle/17.20/TD_FillRowID.json +52 -0
- teradataml/data/jsons/sqle/17.20/TD_FunctionFit.json +46 -0
- teradataml/data/jsons/sqle/17.20/TD_FunctionTransform.json +72 -0
- teradataml/data/jsons/sqle/17.20/TD_GLM.json +507 -0
- teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +168 -0
- teradataml/data/jsons/sqle/17.20/TD_GLMPerSegment.json +411 -0
- teradataml/data/jsons/sqle/17.20/TD_GLMPredictPerSegment.json +146 -0
- teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +93 -0
- teradataml/data/jsons/sqle/17.20/TD_GetRowsWithMissingValues.json +76 -0
- teradataml/data/jsons/sqle/17.20/TD_GetRowsWithoutMissingValues.json +76 -0
- teradataml/data/jsons/sqle/17.20/TD_Histogram.json +152 -0
- teradataml/data/jsons/sqle/17.20/TD_KMeans.json +232 -0
- teradataml/data/jsons/sqle/17.20/TD_KMeansPredict.json +87 -0
- teradataml/data/jsons/sqle/17.20/TD_KNN.json +262 -0
- teradataml/data/jsons/sqle/17.20/TD_NERExtractor.json +145 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesTextClassifierTrainer.json +137 -0
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +102 -0
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineTransform.json +71 -0
- teradataml/data/jsons/sqle/17.20/TD_NumApply.json +147 -0
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +316 -0
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVMPredict.json +124 -0
- teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingFit.json +271 -0
- teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingTransform.json +65 -0
- teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingFit.json +229 -0
- teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingTransform.json +75 -0
- teradataml/data/jsons/sqle/17.20/TD_OutlierFilterFit.json +217 -0
- teradataml/data/jsons/sqle/17.20/TD_OutlierFilterTransform.json +48 -0
- teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
- teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesFit.json +114 -0
- teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesTransform.json +72 -0
- teradataml/data/jsons/sqle/17.20/TD_QQNorm.json +111 -0
- teradataml/data/jsons/sqle/17.20/TD_ROC.json +179 -0
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionFit.json +179 -0
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionMinComponents.json +74 -0
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionTransform.json +74 -0
- teradataml/data/jsons/sqle/17.20/TD_RegressionEvaluator.json +138 -0
- teradataml/data/jsons/sqle/17.20/TD_RoundColumns.json +93 -0
- teradataml/data/jsons/sqle/17.20/TD_RowNormalizeFit.json +128 -0
- teradataml/data/jsons/sqle/17.20/TD_RowNormalizeTransform.json +71 -0
- teradataml/data/jsons/sqle/17.20/TD_SMOTE.json +267 -0
- teradataml/data/jsons/sqle/17.20/TD_SVM.json +389 -0
- teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +142 -0
- teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +310 -0
- teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +120 -0
- teradataml/data/jsons/sqle/17.20/TD_SentimentExtractor.json +194 -0
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +221 -0
- teradataml/data/jsons/sqle/17.20/TD_Silhouette.json +143 -0
- teradataml/data/jsons/sqle/17.20/TD_SimpleImputeFit.json +147 -0
- teradataml/data/jsons/sqle/17.20/TD_SimpleImputeTransform.json +48 -0
- teradataml/data/jsons/sqle/17.20/TD_StrApply.json +240 -0
- teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
- teradataml/data/jsons/sqle/17.20/TD_TargetEncodingFit.json +248 -0
- teradataml/data/jsons/sqle/17.20/TD_TargetEncodingTransform.json +75 -0
- teradataml/data/jsons/sqle/17.20/TD_TextMorph.json +134 -0
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +297 -0
- teradataml/data/jsons/sqle/17.20/TD_TrainTestSplit.json +142 -0
- teradataml/data/jsons/sqle/17.20/TD_UnivariateStatistics.json +117 -0
- teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
- teradataml/data/jsons/sqle/17.20/TD_VectorDistance.json +183 -0
- teradataml/data/jsons/sqle/17.20/TD_WhichMax.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_WhichMin.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_WordEmbeddings.json +241 -0
- teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +330 -0
- teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +195 -0
- teradataml/data/jsons/sqle/17.20/TD_ZTest.json +247 -0
- teradataml/data/jsons/sqle/17.20/Unpack.json +188 -0
- teradataml/data/jsons/sqle/17.20/nPath.json +269 -0
- teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +370 -0
- teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +460 -0
- teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +385 -0
- teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +400 -0
- teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +401 -0
- teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +384 -0
- teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +384 -0
- teradataml/data/jsons/sqle/20.00/TD_API_AzureML.json +151 -0
- teradataml/data/jsons/sqle/20.00/TD_API_Sagemaker.json +182 -0
- teradataml/data/jsons/sqle/20.00/TD_API_VertexAI.json +183 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
- teradataml/data/jsons/tableoperator/17.00/read_nos.json +198 -0
- teradataml/data/jsons/tableoperator/17.05/read_nos.json +198 -0
- teradataml/data/jsons/tableoperator/17.05/write_nos.json +195 -0
- teradataml/data/jsons/tableoperator/17.10/read_nos.json +184 -0
- teradataml/data/jsons/tableoperator/17.10/write_nos.json +195 -0
- teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -0
- teradataml/data/jsons/tableoperator/17.20/read_nos.json +183 -0
- teradataml/data/jsons/tableoperator/17.20/write_nos.json +224 -0
- teradataml/data/jsons/uaf/17.20/TD_ACF.json +132 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +396 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +77 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +153 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
- teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +107 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +106 -0
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +89 -0
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +104 -0
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +78 -0
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +66 -0
- teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +87 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFT.json +134 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +144 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +108 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +108 -0
- teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +78 -0
- teradataml/data/jsons/uaf/17.20/TD_DIFF.json +92 -0
- teradataml/data/jsons/uaf/17.20/TD_DTW.json +114 -0
- teradataml/data/jsons/uaf/17.20/TD_DURBIN_WATSON.json +101 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
- teradataml/data/jsons/uaf/17.20/TD_EXTRACT_RESULTS.json +39 -0
- teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +101 -0
- teradataml/data/jsons/uaf/17.20/TD_GENSERIES4FORMULA.json +85 -0
- teradataml/data/jsons/uaf/17.20/TD_GENSERIES4SINUSOIDS.json +71 -0
- teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +139 -0
- teradataml/data/jsons/uaf/17.20/TD_HOLT_WINTERS_FORECASTER.json +313 -0
- teradataml/data/jsons/uaf/17.20/TD_IDFFT.json +58 -0
- teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +81 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
- teradataml/data/jsons/uaf/17.20/TD_INPUTVALIDATOR.json +64 -0
- teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
- teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +182 -0
- teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +103 -0
- teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +181 -0
- teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
- teradataml/data/jsons/uaf/17.20/TD_MATRIXMULTIPLY.json +68 -0
- teradataml/data/jsons/uaf/17.20/TD_MINFO.json +67 -0
- teradataml/data/jsons/uaf/17.20/TD_MULTIVAR_REGR.json +179 -0
- teradataml/data/jsons/uaf/17.20/TD_PACF.json +114 -0
- teradataml/data/jsons/uaf/17.20/TD_PORTMAN.json +119 -0
- teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +175 -0
- teradataml/data/jsons/uaf/17.20/TD_POWERTRANSFORM.json +98 -0
- teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +194 -0
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +210 -0
- teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +143 -0
- teradataml/data/jsons/uaf/17.20/TD_SELECTION_CRITERIA.json +90 -0
- teradataml/data/jsons/uaf/17.20/TD_SIGNIF_PERIODICITIES.json +80 -0
- teradataml/data/jsons/uaf/17.20/TD_SIGNIF_RESIDMEAN.json +68 -0
- teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +184 -0
- teradataml/data/jsons/uaf/17.20/TD_SINFO.json +58 -0
- teradataml/data/jsons/uaf/17.20/TD_SMOOTHMA.json +163 -0
- teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +101 -0
- teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +112 -0
- teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +95 -0
- teradataml/data/jsons/uaf/17.20/TD_WHITES_GENERAL.json +78 -0
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +410 -0
- teradataml/data/kmeans_example.json +23 -0
- teradataml/data/kmeans_table.csv +10 -0
- teradataml/data/kmeans_us_arrests_data.csv +51 -0
- teradataml/data/knn_example.json +19 -0
- teradataml/data/knnrecommender_example.json +7 -0
- teradataml/data/knnrecommenderpredict_example.json +12 -0
- teradataml/data/lar_example.json +17 -0
- teradataml/data/larpredict_example.json +30 -0
- teradataml/data/lc_new_predictors.csv +5 -0
- teradataml/data/lc_new_reference.csv +9 -0
- teradataml/data/lda_example.json +9 -0
- teradataml/data/ldainference_example.json +15 -0
- teradataml/data/ldatopicsummary_example.json +9 -0
- teradataml/data/levendist_input.csv +13 -0
- teradataml/data/levenshteindistance_example.json +10 -0
- teradataml/data/linreg_example.json +10 -0
- teradataml/data/load_example_data.py +350 -0
- teradataml/data/loan_prediction.csv +295 -0
- teradataml/data/lungcancer.csv +138 -0
- teradataml/data/mappingdata.csv +12 -0
- teradataml/data/medical_readings.csv +101 -0
- teradataml/data/milk_timeseries.csv +157 -0
- teradataml/data/min_max_titanic.csv +4 -0
- teradataml/data/minhash_example.json +6 -0
- teradataml/data/ml_ratings.csv +7547 -0
- teradataml/data/ml_ratings_10.csv +2445 -0
- teradataml/data/mobile_data.csv +13 -0
- teradataml/data/model1_table.csv +5 -0
- teradataml/data/model2_table.csv +5 -0
- teradataml/data/models/License_file.txt +1 -0
- teradataml/data/models/License_file_empty.txt +0 -0
- teradataml/data/models/dataiku_iris_data_ann_thin +0 -0
- teradataml/data/models/dr_iris_rf +0 -0
- teradataml/data/models/iris_db_dt_model_sklearn.onnx +0 -0
- teradataml/data/models/iris_db_dt_model_sklearn_floattensor.onnx +0 -0
- teradataml/data/models/iris_db_glm_model.pmml +57 -0
- teradataml/data/models/iris_db_xgb_model.pmml +4471 -0
- teradataml/data/models/iris_kmeans_model +0 -0
- teradataml/data/models/iris_mojo_glm_h2o_model +0 -0
- teradataml/data/models/iris_mojo_xgb_h2o_model +0 -0
- teradataml/data/modularity_example.json +12 -0
- teradataml/data/movavg_example.json +8 -0
- teradataml/data/mtx1.csv +7 -0
- teradataml/data/mtx2.csv +13 -0
- teradataml/data/multi_model_classification.csv +401 -0
- teradataml/data/multi_model_regression.csv +401 -0
- teradataml/data/mvdfft8.csv +9 -0
- teradataml/data/naivebayes_example.json +10 -0
- teradataml/data/naivebayespredict_example.json +19 -0
- teradataml/data/naivebayestextclassifier2_example.json +7 -0
- teradataml/data/naivebayestextclassifier_example.json +8 -0
- teradataml/data/naivebayestextclassifierpredict_example.json +32 -0
- teradataml/data/name_Find_configure.csv +10 -0
- teradataml/data/namedentityfinder_example.json +14 -0
- teradataml/data/namedentityfinderevaluator_example.json +10 -0
- teradataml/data/namedentityfindertrainer_example.json +6 -0
- teradataml/data/nb_iris_input_test.csv +31 -0
- teradataml/data/nb_iris_input_train.csv +121 -0
- teradataml/data/nbp_iris_model.csv +13 -0
- teradataml/data/ner_dict.csv +8 -0
- teradataml/data/ner_extractor_text.csv +2 -0
- teradataml/data/ner_input_eng.csv +7 -0
- teradataml/data/ner_rule.csv +5 -0
- teradataml/data/ner_sports_test2.csv +29 -0
- teradataml/data/ner_sports_train.csv +501 -0
- teradataml/data/nerevaluator_example.json +6 -0
- teradataml/data/nerextractor_example.json +18 -0
- teradataml/data/nermem_sports_test.csv +18 -0
- teradataml/data/nermem_sports_train.csv +51 -0
- teradataml/data/nertrainer_example.json +7 -0
- teradataml/data/ngrams_example.json +7 -0
- teradataml/data/notebooks/__init__.py +0 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Aggregate Functions using SQLAlchemy.ipynb +1455 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Arithmetic Functions Using SQLAlchemy.ipynb +1993 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Bit-Byte Manipulation Functions using SQLAlchemy.ipynb +1492 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Built-in functions using SQLAlchemy.ipynb +536 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Regular Expressions Using SQLAlchemy.ipynb +570 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage String Functions Using SQLAlchemy.ipynb +2559 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Window Aggregate Functions using SQLAlchemy.ipynb +2911 -0
- teradataml/data/notebooks/sqlalchemy/Using Generic SQLAlchemy ClauseElements teradataml DataFrame assign method.ipynb +698 -0
- teradataml/data/notebooks/sqlalchemy/__init__.py +0 -0
- teradataml/data/notebooks/sqlalchemy/teradataml filtering using SQLAlchemy ClauseElements.ipynb +784 -0
- teradataml/data/npath_example.json +23 -0
- teradataml/data/ntree_example.json +14 -0
- teradataml/data/numeric_strings.csv +5 -0
- teradataml/data/numerics.csv +4 -0
- teradataml/data/ocean_buoy.csv +17 -0
- teradataml/data/ocean_buoy2.csv +17 -0
- teradataml/data/ocean_buoys.csv +28 -0
- teradataml/data/ocean_buoys2.csv +10 -0
- teradataml/data/ocean_buoys_nonpti.csv +28 -0
- teradataml/data/ocean_buoys_seq.csv +29 -0
- teradataml/data/onehot_encoder_train.csv +4 -0
- teradataml/data/openml_example.json +92 -0
- teradataml/data/optional_event_table.csv +4 -0
- teradataml/data/orders1.csv +11 -0
- teradataml/data/orders1_12.csv +13 -0
- teradataml/data/orders_ex.csv +4 -0
- teradataml/data/pack_example.json +9 -0
- teradataml/data/package_tracking.csv +19 -0
- teradataml/data/package_tracking_pti.csv +19 -0
- teradataml/data/pagerank_example.json +13 -0
- teradataml/data/paragraphs_input.csv +6 -0
- teradataml/data/pathanalyzer_example.json +8 -0
- teradataml/data/pathgenerator_example.json +8 -0
- teradataml/data/patient_profile.csv +101 -0
- teradataml/data/pattern_matching_data.csv +11 -0
- teradataml/data/payment_fraud_dataset.csv +10001 -0
- teradataml/data/peppers.png +0 -0
- teradataml/data/phrases.csv +7 -0
- teradataml/data/pivot_example.json +9 -0
- teradataml/data/pivot_input.csv +22 -0
- teradataml/data/playerRating.csv +31 -0
- teradataml/data/pos_input.csv +40 -0
- teradataml/data/postagger_example.json +7 -0
- teradataml/data/posttagger_output.csv +44 -0
- teradataml/data/production_data.csv +17 -0
- teradataml/data/production_data2.csv +7 -0
- teradataml/data/randomsample_example.json +32 -0
- teradataml/data/randomwalksample_example.json +9 -0
- teradataml/data/rank_table.csv +6 -0
- teradataml/data/real_values.csv +14 -0
- teradataml/data/ref_mobile_data.csv +4 -0
- teradataml/data/ref_mobile_data_dense.csv +2 -0
- teradataml/data/ref_url.csv +17 -0
- teradataml/data/restaurant_reviews.csv +7 -0
- teradataml/data/retail_churn_table.csv +27772 -0
- teradataml/data/river_data.csv +145 -0
- teradataml/data/roc_example.json +8 -0
- teradataml/data/roc_input.csv +101 -0
- teradataml/data/rule_inputs.csv +6 -0
- teradataml/data/rule_table.csv +2 -0
- teradataml/data/sales.csv +7 -0
- teradataml/data/sales_transaction.csv +501 -0
- teradataml/data/salesdata.csv +342 -0
- teradataml/data/sample_cities.csv +3 -0
- teradataml/data/sample_shapes.csv +11 -0
- teradataml/data/sample_streets.csv +3 -0
- teradataml/data/sampling_example.json +16 -0
- teradataml/data/sax_example.json +17 -0
- teradataml/data/scale_attributes.csv +3 -0
- teradataml/data/scale_example.json +74 -0
- teradataml/data/scale_housing.csv +11 -0
- teradataml/data/scale_housing_test.csv +6 -0
- teradataml/data/scale_input_part_sparse.csv +31 -0
- teradataml/data/scale_input_partitioned.csv +16 -0
- teradataml/data/scale_input_sparse.csv +11 -0
- teradataml/data/scale_parameters.csv +3 -0
- teradataml/data/scale_stat.csv +11 -0
- teradataml/data/scalebypartition_example.json +13 -0
- teradataml/data/scalemap_example.json +13 -0
- teradataml/data/scalesummary_example.json +12 -0
- teradataml/data/score_category.csv +101 -0
- teradataml/data/score_summary.csv +4 -0
- teradataml/data/script_example.json +10 -0
- teradataml/data/scripts/deploy_script.py +84 -0
- teradataml/data/scripts/lightgbm/dataset.template +175 -0
- teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +264 -0
- teradataml/data/scripts/lightgbm/lightgbm_function.template +234 -0
- teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +177 -0
- teradataml/data/scripts/mapper.R +20 -0
- teradataml/data/scripts/mapper.py +16 -0
- teradataml/data/scripts/mapper_replace.py +16 -0
- teradataml/data/scripts/sklearn/__init__.py +0 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +205 -0
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +148 -0
- teradataml/data/scripts/sklearn/sklearn_function.template +144 -0
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +166 -0
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +161 -0
- teradataml/data/scripts/sklearn/sklearn_score.py +145 -0
- teradataml/data/scripts/sklearn/sklearn_transform.py +327 -0
- teradataml/data/sdk/modelops/modelops_spec.json +101737 -0
- teradataml/data/seeds.csv +10 -0
- teradataml/data/sentenceextractor_example.json +7 -0
- teradataml/data/sentiment_extract_input.csv +11 -0
- teradataml/data/sentiment_train.csv +16 -0
- teradataml/data/sentiment_word.csv +20 -0
- teradataml/data/sentiment_word_input.csv +20 -0
- teradataml/data/sentimentextractor_example.json +24 -0
- teradataml/data/sentimenttrainer_example.json +8 -0
- teradataml/data/sequence_table.csv +10 -0
- teradataml/data/seriessplitter_example.json +8 -0
- teradataml/data/sessionize_example.json +17 -0
- teradataml/data/sessionize_table.csv +116 -0
- teradataml/data/setop_test1.csv +24 -0
- teradataml/data/setop_test2.csv +22 -0
- teradataml/data/soc_nw_edges.csv +11 -0
- teradataml/data/soc_nw_vertices.csv +8 -0
- teradataml/data/souvenir_timeseries.csv +168 -0
- teradataml/data/sparse_iris_attribute.csv +5 -0
- teradataml/data/sparse_iris_test.csv +121 -0
- teradataml/data/sparse_iris_train.csv +601 -0
- teradataml/data/star1.csv +6 -0
- teradataml/data/star_pivot.csv +8 -0
- teradataml/data/state_transition.csv +5 -0
- teradataml/data/stock_data.csv +53 -0
- teradataml/data/stock_movement.csv +11 -0
- teradataml/data/stock_vol.csv +76 -0
- teradataml/data/stop_words.csv +8 -0
- teradataml/data/store_sales.csv +37 -0
- teradataml/data/stringsimilarity_example.json +8 -0
- teradataml/data/strsimilarity_input.csv +13 -0
- teradataml/data/students.csv +101 -0
- teradataml/data/svm_iris_input_test.csv +121 -0
- teradataml/data/svm_iris_input_train.csv +481 -0
- teradataml/data/svm_iris_model.csv +7 -0
- teradataml/data/svmdense_example.json +10 -0
- teradataml/data/svmdensepredict_example.json +19 -0
- teradataml/data/svmsparse_example.json +8 -0
- teradataml/data/svmsparsepredict_example.json +14 -0
- teradataml/data/svmsparsesummary_example.json +8 -0
- teradataml/data/target_mobile_data.csv +13 -0
- teradataml/data/target_mobile_data_dense.csv +5 -0
- teradataml/data/target_udt_data.csv +8 -0
- teradataml/data/tdnerextractor_example.json +14 -0
- teradataml/data/templatedata.csv +1201 -0
- teradataml/data/templates/open_source_ml.json +11 -0
- teradataml/data/teradata_icon.ico +0 -0
- teradataml/data/teradataml_example.json +1473 -0
- teradataml/data/test_classification.csv +101 -0
- teradataml/data/test_loan_prediction.csv +53 -0
- teradataml/data/test_pacf_12.csv +37 -0
- teradataml/data/test_prediction.csv +101 -0
- teradataml/data/test_regression.csv +101 -0
- teradataml/data/test_river2.csv +109 -0
- teradataml/data/text_inputs.csv +6 -0
- teradataml/data/textchunker_example.json +8 -0
- teradataml/data/textclassifier_example.json +7 -0
- teradataml/data/textclassifier_input.csv +7 -0
- teradataml/data/textclassifiertrainer_example.json +7 -0
- teradataml/data/textmorph_example.json +11 -0
- teradataml/data/textparser_example.json +15 -0
- teradataml/data/texttagger_example.json +12 -0
- teradataml/data/texttokenizer_example.json +7 -0
- teradataml/data/texttrainer_input.csv +11 -0
- teradataml/data/tf_example.json +7 -0
- teradataml/data/tfidf_example.json +14 -0
- teradataml/data/tfidf_input1.csv +201 -0
- teradataml/data/tfidf_train.csv +6 -0
- teradataml/data/time_table1.csv +535 -0
- teradataml/data/time_table2.csv +14 -0
- teradataml/data/timeseriesdata.csv +1601 -0
- teradataml/data/timeseriesdatasetsd4.csv +105 -0
- teradataml/data/timestamp_data.csv +4 -0
- teradataml/data/titanic.csv +892 -0
- teradataml/data/titanic_dataset_unpivoted.csv +19 -0
- teradataml/data/to_num_data.csv +4 -0
- teradataml/data/tochar_data.csv +5 -0
- teradataml/data/token_table.csv +696 -0
- 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 +28 -0
- teradataml/data/trans_dense.csv +16 -0
- teradataml/data/trans_sparse.csv +55 -0
- teradataml/data/transformation_table.csv +6 -0
- teradataml/data/transformation_table_new.csv +2 -0
- teradataml/data/tv_spots.csv +16 -0
- teradataml/data/twod_climate_data.csv +117 -0
- teradataml/data/uaf_example.json +529 -0
- teradataml/data/univariatestatistics_example.json +9 -0
- teradataml/data/unpack_example.json +10 -0
- teradataml/data/unpivot_example.json +25 -0
- teradataml/data/unpivot_input.csv +8 -0
- teradataml/data/url_data.csv +10 -0
- teradataml/data/us_air_pass.csv +37 -0
- teradataml/data/us_population.csv +624 -0
- teradataml/data/us_states_shapes.csv +52 -0
- teradataml/data/varmax_example.json +18 -0
- teradataml/data/vectordistance_example.json +30 -0
- teradataml/data/ville_climatedata.csv +121 -0
- teradataml/data/ville_tempdata.csv +12 -0
- teradataml/data/ville_tempdata1.csv +12 -0
- teradataml/data/ville_temperature.csv +11 -0
- teradataml/data/waveletTable.csv +1605 -0
- teradataml/data/waveletTable2.csv +1605 -0
- teradataml/data/weightedmovavg_example.json +9 -0
- teradataml/data/wft_testing.csv +5 -0
- teradataml/data/windowdfft.csv +16 -0
- teradataml/data/wine_data.csv +1600 -0
- teradataml/data/word_embed_input_table1.csv +6 -0
- teradataml/data/word_embed_input_table2.csv +5 -0
- teradataml/data/word_embed_model.csv +23 -0
- teradataml/data/words_input.csv +13 -0
- teradataml/data/xconvolve_complex_left.csv +6 -0
- teradataml/data/xconvolve_complex_leftmulti.csv +6 -0
- teradataml/data/xgboost_example.json +36 -0
- teradataml/data/xgboostpredict_example.json +32 -0
- teradataml/data/ztest_example.json +16 -0
- teradataml/dataframe/__init__.py +0 -0
- teradataml/dataframe/copy_to.py +2446 -0
- teradataml/dataframe/data_transfer.py +2840 -0
- teradataml/dataframe/dataframe.py +20908 -0
- teradataml/dataframe/dataframe_utils.py +2114 -0
- teradataml/dataframe/fastload.py +794 -0
- teradataml/dataframe/functions.py +2110 -0
- teradataml/dataframe/indexer.py +424 -0
- teradataml/dataframe/row.py +160 -0
- teradataml/dataframe/setop.py +1171 -0
- teradataml/dataframe/sql.py +10904 -0
- teradataml/dataframe/sql_function_parameters.py +440 -0
- teradataml/dataframe/sql_functions.py +652 -0
- teradataml/dataframe/sql_interfaces.py +220 -0
- teradataml/dataframe/vantage_function_types.py +675 -0
- teradataml/dataframe/window.py +694 -0
- teradataml/dbutils/__init__.py +3 -0
- teradataml/dbutils/dbutils.py +2871 -0
- teradataml/dbutils/filemgr.py +318 -0
- teradataml/gen_ai/__init__.py +2 -0
- teradataml/gen_ai/convAI.py +473 -0
- teradataml/geospatial/__init__.py +4 -0
- teradataml/geospatial/geodataframe.py +1105 -0
- teradataml/geospatial/geodataframecolumn.py +392 -0
- teradataml/geospatial/geometry_types.py +926 -0
- teradataml/hyperparameter_tuner/__init__.py +1 -0
- teradataml/hyperparameter_tuner/optimizer.py +4115 -0
- teradataml/hyperparameter_tuner/utils.py +303 -0
- teradataml/lib/__init__.py +0 -0
- 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/lib/libaed_0_1_aarch64.so +0 -0
- teradataml/lib/libaed_0_1_ppc64le.so +0 -0
- teradataml/opensource/__init__.py +1 -0
- teradataml/opensource/_base.py +1321 -0
- teradataml/opensource/_class.py +464 -0
- teradataml/opensource/_constants.py +61 -0
- teradataml/opensource/_lightgbm.py +949 -0
- teradataml/opensource/_sklearn.py +1008 -0
- teradataml/opensource/_wrapper_utils.py +267 -0
- teradataml/options/__init__.py +148 -0
- teradataml/options/configure.py +489 -0
- teradataml/options/display.py +187 -0
- teradataml/plot/__init__.py +3 -0
- teradataml/plot/axis.py +1427 -0
- teradataml/plot/constants.py +15 -0
- teradataml/plot/figure.py +431 -0
- teradataml/plot/plot.py +810 -0
- teradataml/plot/query_generator.py +83 -0
- teradataml/plot/subplot.py +216 -0
- teradataml/scriptmgmt/UserEnv.py +4273 -0
- teradataml/scriptmgmt/__init__.py +3 -0
- teradataml/scriptmgmt/lls_utils.py +2157 -0
- teradataml/sdk/README.md +79 -0
- teradataml/sdk/__init__.py +4 -0
- teradataml/sdk/_auth_modes.py +422 -0
- teradataml/sdk/_func_params.py +487 -0
- teradataml/sdk/_json_parser.py +453 -0
- teradataml/sdk/_openapi_spec_constants.py +249 -0
- teradataml/sdk/_utils.py +236 -0
- teradataml/sdk/api_client.py +900 -0
- teradataml/sdk/constants.py +62 -0
- teradataml/sdk/modelops/__init__.py +98 -0
- teradataml/sdk/modelops/_client.py +409 -0
- teradataml/sdk/modelops/_constants.py +304 -0
- teradataml/sdk/modelops/models.py +2308 -0
- teradataml/sdk/spinner.py +107 -0
- teradataml/series/__init__.py +0 -0
- teradataml/series/series.py +537 -0
- teradataml/series/series_utils.py +71 -0
- teradataml/store/__init__.py +12 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +658 -0
- teradataml/store/feature_store/feature_store.py +4814 -0
- teradataml/store/feature_store/mind_map.py +639 -0
- teradataml/store/feature_store/models.py +7330 -0
- teradataml/store/feature_store/utils.py +390 -0
- teradataml/table_operators/Apply.py +979 -0
- teradataml/table_operators/Script.py +1739 -0
- teradataml/table_operators/TableOperator.py +1343 -0
- teradataml/table_operators/__init__.py +2 -0
- teradataml/table_operators/apply_query_generator.py +262 -0
- teradataml/table_operators/query_generator.py +493 -0
- teradataml/table_operators/table_operator_query_generator.py +462 -0
- teradataml/table_operators/table_operator_util.py +726 -0
- teradataml/table_operators/templates/dataframe_apply.template +184 -0
- teradataml/table_operators/templates/dataframe_map.template +176 -0
- teradataml/table_operators/templates/dataframe_register.template +73 -0
- teradataml/table_operators/templates/dataframe_udf.template +67 -0
- teradataml/table_operators/templates/script_executor.template +170 -0
- teradataml/telemetry_utils/__init__.py +0 -0
- teradataml/telemetry_utils/queryband.py +53 -0
- teradataml/utils/__init__.py +0 -0
- teradataml/utils/docstring.py +527 -0
- teradataml/utils/dtypes.py +943 -0
- teradataml/utils/internal_buffer.py +122 -0
- teradataml/utils/print_versions.py +206 -0
- teradataml/utils/utils.py +451 -0
- teradataml/utils/validators.py +3305 -0
- teradataml-20.0.0.8.dist-info/METADATA +2804 -0
- teradataml-20.0.0.8.dist-info/RECORD +1208 -0
- teradataml-20.0.0.8.dist-info/WHEEL +5 -0
- teradataml-20.0.0.8.dist-info/top_level.txt +1 -0
- teradataml-20.0.0.8.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,2078 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Unpublished work.
|
|
3
|
+
Copyright (c) 2018 by Teradata Corporation. All rights reserved.
|
|
4
|
+
TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
|
|
5
|
+
|
|
6
|
+
Primary Owner: pankajvinod.purandare@teradata.com
|
|
7
|
+
Secondary Owner: Mark.Sandan@teradata.com
|
|
8
|
+
|
|
9
|
+
This file implements the wrapper's around AED API's from eleCommon library.
|
|
10
|
+
This facilitates the teradataml library infrastructure code to call these functions
|
|
11
|
+
and not change anything in future, regardless, of the design changes on
|
|
12
|
+
AED side.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
import platform
|
|
17
|
+
import re
|
|
18
|
+
|
|
19
|
+
from ctypes import c_int, c_char_p, c_char, POINTER, byref
|
|
20
|
+
|
|
21
|
+
from teradataml.common.exceptions import TeradataMlException
|
|
22
|
+
from teradataml.common.constants import TeradataConstants
|
|
23
|
+
from teradataml.common.messagecodes import MessageCodes
|
|
24
|
+
from teradataml.common.messages import Messages
|
|
25
|
+
from teradataml.common.utils import UtilFuncs
|
|
26
|
+
from teradataml.common.constants import AEDConstants
|
|
27
|
+
from teradataml.common.constants import SQLPattern
|
|
28
|
+
from teradataml.context.aed_context import AEDContext
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class AedUtils:
|
|
32
|
+
|
|
33
|
+
def __init__(self):
|
|
34
|
+
self.aed_context = AEDContext()
|
|
35
|
+
|
|
36
|
+
def _aed_table(self, source):
|
|
37
|
+
"""
|
|
38
|
+
This wrapper function facilitates a integration with 'aed_table',
|
|
39
|
+
a C++ function, in AED library, with Python tdml library.
|
|
40
|
+
|
|
41
|
+
This function must be called when a Python (tdml) data frame is to be
|
|
42
|
+
created using a table name.
|
|
43
|
+
|
|
44
|
+
PARAMETERS:
|
|
45
|
+
source - Fully qualified source table name i.e. dbname.tablename
|
|
46
|
+
|
|
47
|
+
EXAMPLES:
|
|
48
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
49
|
+
|
|
50
|
+
RETURNS:
|
|
51
|
+
A node id in DAG - AED, for a data frame.
|
|
52
|
+
|
|
53
|
+
RAISES:
|
|
54
|
+
teradataml exceptions:
|
|
55
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
56
|
+
"""
|
|
57
|
+
# Specify the argument types
|
|
58
|
+
self.aed_context.ele_common_lib.aed_table.argtypes =[POINTER(c_char_p),
|
|
59
|
+
POINTER(c_char_p),
|
|
60
|
+
POINTER(c_char_p),
|
|
61
|
+
POINTER(c_char_p),
|
|
62
|
+
POINTER(c_char_p),
|
|
63
|
+
POINTER(c_int)
|
|
64
|
+
]
|
|
65
|
+
# Input arguments for 'C' function.
|
|
66
|
+
arg_name = ["source"]
|
|
67
|
+
arg_value = [source]
|
|
68
|
+
output_table = [""]
|
|
69
|
+
output_schema = [""]
|
|
70
|
+
|
|
71
|
+
# Ouptut nodeid
|
|
72
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
73
|
+
|
|
74
|
+
# return code
|
|
75
|
+
ret_code = self.aed_context._int_array1(0)
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
# *** AED request for TABLE
|
|
79
|
+
self.aed_context.ele_common_lib.aed_table(self.aed_context._arr_c(arg_name),
|
|
80
|
+
self.aed_context._arr_c(arg_value),
|
|
81
|
+
self.aed_context._arr_c(output_table),
|
|
82
|
+
self.aed_context._arr_c(output_schema),
|
|
83
|
+
nodeid_out,
|
|
84
|
+
ret_code)
|
|
85
|
+
except Exception as emsg:
|
|
86
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_table)" + str(emsg)),
|
|
87
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
88
|
+
|
|
89
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
90
|
+
|
|
91
|
+
def _aed_query(self, query, temp_table_name=None):
|
|
92
|
+
"""
|
|
93
|
+
This wrapper function facilitates a integration with 'aed_query',
|
|
94
|
+
a C++ function, in AED library, with Python tdml library.
|
|
95
|
+
|
|
96
|
+
This function must be called when a Python (tdml) data frame is to be
|
|
97
|
+
created using a SQL query.
|
|
98
|
+
|
|
99
|
+
PARAMETERS:
|
|
100
|
+
query - SQL query
|
|
101
|
+
temp_table_name - Temporary table name to be used for output of aed_query node.
|
|
102
|
+
|
|
103
|
+
EXAMPLES:
|
|
104
|
+
aed_table_nodeid = AedObj._aed_query("select * from table")
|
|
105
|
+
|
|
106
|
+
RETURNS:
|
|
107
|
+
A node id in DAG - AED, for a data frame.
|
|
108
|
+
|
|
109
|
+
RAISES:
|
|
110
|
+
teradataml exceptions:
|
|
111
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
112
|
+
"""
|
|
113
|
+
# Specify the argument types
|
|
114
|
+
self.aed_context.ele_common_lib.aed_query.argtypes =[POINTER(c_char_p),
|
|
115
|
+
POINTER(c_char_p),
|
|
116
|
+
POINTER(c_char_p),
|
|
117
|
+
POINTER(c_char_p),
|
|
118
|
+
POINTER(c_char_p),
|
|
119
|
+
POINTER(c_int)
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
# Input arguments for 'C' function.
|
|
123
|
+
arg_name = ["source"]
|
|
124
|
+
arg_value = [query]
|
|
125
|
+
if temp_table_name is None:
|
|
126
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="query_", use_default_database=True, quote=False)
|
|
127
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
128
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
129
|
+
if output_schema[0] is None:
|
|
130
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_INVALID_GEN_TABLENAME,
|
|
131
|
+
"(aed_query) :: Received tablename as - {}".format(temp_table_name)),
|
|
132
|
+
MessageCodes.AED_INVALID_GEN_TABLENAME)
|
|
133
|
+
|
|
134
|
+
# Ouptut nodeid
|
|
135
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
136
|
+
|
|
137
|
+
# return code
|
|
138
|
+
ret_code = self.aed_context._int_array1(0)
|
|
139
|
+
|
|
140
|
+
try:
|
|
141
|
+
self.aed_context.ele_common_lib.aed_query(self.aed_context._arr_c(arg_name),
|
|
142
|
+
self.aed_context._arr_c(arg_value),
|
|
143
|
+
self.aed_context._arr_c(output_table),
|
|
144
|
+
self.aed_context._arr_c(output_schema),
|
|
145
|
+
nodeid_out,
|
|
146
|
+
ret_code)
|
|
147
|
+
except Exception as emsg:
|
|
148
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_query)" + str(emsg)),
|
|
149
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
150
|
+
|
|
151
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
152
|
+
|
|
153
|
+
def _aed_select(self, nodeid, select_expr, distinct=False, timestamp_expr=None):
|
|
154
|
+
"""
|
|
155
|
+
This wrapper function facilitates a integration with 'aed_select',
|
|
156
|
+
a C++ function, in AED library, with Python tdml library.
|
|
157
|
+
|
|
158
|
+
This function must be called when a SELECT operation that is
|
|
159
|
+
columns are to be selected from a Python (tdml) data frame.
|
|
160
|
+
|
|
161
|
+
PARAMETERS:
|
|
162
|
+
nodeid - A DAG node, a input to the select API.
|
|
163
|
+
select_expr - Columns, to be selected from the data frame.
|
|
164
|
+
distinct - Boolean, to decide addition of Distinct clause.
|
|
165
|
+
timestamp_expr - A string, to specify the temporal table clause.
|
|
166
|
+
|
|
167
|
+
EXAMPLES:
|
|
168
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
169
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
170
|
+
|
|
171
|
+
RETURNS:
|
|
172
|
+
A node id in DAG - AED select API.
|
|
173
|
+
|
|
174
|
+
RAISES:
|
|
175
|
+
teradataml exceptions:
|
|
176
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
177
|
+
"""
|
|
178
|
+
# Specify the argument types
|
|
179
|
+
self.aed_context.ele_common_lib.aed_select.argtypes =[POINTER(c_char_p),
|
|
180
|
+
POINTER(c_char_p),
|
|
181
|
+
POINTER(c_char_p),
|
|
182
|
+
POINTER(c_char_p),
|
|
183
|
+
POINTER(c_char_p),
|
|
184
|
+
POINTER(c_char_p),
|
|
185
|
+
POINTER(c_int),
|
|
186
|
+
POINTER(c_int)
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
arg_name = ["projection"]
|
|
190
|
+
arg_value = ["DISTINCT " + select_expr if distinct else select_expr]
|
|
191
|
+
if timestamp_expr:
|
|
192
|
+
arg_name.append("timestamp_expr")
|
|
193
|
+
arg_value.append(timestamp_expr)
|
|
194
|
+
|
|
195
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="select_", use_default_database=True, quote=False)
|
|
196
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
197
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
198
|
+
|
|
199
|
+
# Output nodeid
|
|
200
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
201
|
+
|
|
202
|
+
# return code
|
|
203
|
+
ret_code = self.aed_context._int_array1(0)
|
|
204
|
+
|
|
205
|
+
length = self.aed_context._int_array1(len(arg_value))
|
|
206
|
+
try:
|
|
207
|
+
# *** AED request to select columns
|
|
208
|
+
self.aed_context.ele_common_lib.aed_select(self.aed_context._arr_c([nodeid]),
|
|
209
|
+
self.aed_context._arr_c(arg_name),
|
|
210
|
+
self.aed_context._arr_c(arg_value),
|
|
211
|
+
self.aed_context._arr_c(output_table),
|
|
212
|
+
self.aed_context._arr_c(output_schema),
|
|
213
|
+
nodeid_out,
|
|
214
|
+
length,
|
|
215
|
+
ret_code)
|
|
216
|
+
except Exception as emsg:
|
|
217
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_select)" + str(emsg)),
|
|
218
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
219
|
+
|
|
220
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
221
|
+
|
|
222
|
+
def _aed_aggregate(self, nodeid, aggregate_expr, operation):
|
|
223
|
+
"""
|
|
224
|
+
This wrapper function facilitates a integration with
|
|
225
|
+
'aed_aggregate', a C++ function, in AED library, with Python
|
|
226
|
+
tdml library.
|
|
227
|
+
|
|
228
|
+
This function must be called when an aggregate functions like
|
|
229
|
+
MIN, MAX, AVG are to be performed on dataframe columns
|
|
230
|
+
|
|
231
|
+
PARAMETERS:
|
|
232
|
+
nodeid - String. It is a DAG node which is given as an
|
|
233
|
+
input to the aggregate API.
|
|
234
|
+
aggregate_expr - String. Expressions like
|
|
235
|
+
'min(col1) as min_col1, min(col2) as min_col2'
|
|
236
|
+
or 'max(col1) as max_col1, max(col2) as max_col2'
|
|
237
|
+
operation - String. Aggregate Operation to be performed on
|
|
238
|
+
the columns eg. min
|
|
239
|
+
|
|
240
|
+
EXAMPLES:
|
|
241
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
242
|
+
aed_aggregate_nodeid = AedObj._aed_aggregate(
|
|
243
|
+
aed_table_nodeid, "min(col1) as min_col1,
|
|
244
|
+
min(col2) as min_col2", operation = 'min')
|
|
245
|
+
aed_aggregate_nodeid1 = AedObj._aed_aggregate(
|
|
246
|
+
aed_table_nodeid, "max(col1) as max_col1,
|
|
247
|
+
max(col2) as max_col2", operation = 'max')
|
|
248
|
+
|
|
249
|
+
RETURNS:
|
|
250
|
+
A node id in DAG - AED aggregate API.
|
|
251
|
+
|
|
252
|
+
RAISES:
|
|
253
|
+
teradataml exceptions:
|
|
254
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
# Specify the argument types
|
|
258
|
+
self.aed_context.ele_common_lib.aed_aggregate.argtypes = [POINTER(c_char_p),
|
|
259
|
+
POINTER(c_char_p),
|
|
260
|
+
POINTER(c_char_p),
|
|
261
|
+
POINTER(c_char_p),
|
|
262
|
+
POINTER(c_char_p),
|
|
263
|
+
POINTER(c_char_p),
|
|
264
|
+
POINTER(c_int)
|
|
265
|
+
]
|
|
266
|
+
arg_name = ["expr"]
|
|
267
|
+
arg_value = [aggregate_expr]
|
|
268
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(
|
|
269
|
+
prefix = "aggregate_" + operation + "_",
|
|
270
|
+
use_default_database = True, quote = False)
|
|
271
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
272
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
273
|
+
|
|
274
|
+
# Output nodeid
|
|
275
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
276
|
+
|
|
277
|
+
# return code
|
|
278
|
+
ret_code = self.aed_context._int_array1(0)
|
|
279
|
+
try:
|
|
280
|
+
# *** AED request to get aggregate of columns
|
|
281
|
+
self.aed_context.ele_common_lib.aed_aggregate(self.aed_context._arr_c([nodeid]),
|
|
282
|
+
self.aed_context._arr_c(arg_name),
|
|
283
|
+
self.aed_context._arr_c(arg_value),
|
|
284
|
+
self.aed_context._arr_c(output_table),
|
|
285
|
+
self.aed_context._arr_c(output_schema),
|
|
286
|
+
nodeid_out,
|
|
287
|
+
ret_code)
|
|
288
|
+
except Exception as emsg:
|
|
289
|
+
raise TeradataMlException(Messages.get_message( MessageCodes.AED_EXEC_FAILED,
|
|
290
|
+
"(aed_aggregate_" + operation + ")" + str(emsg)), MessageCodes.AED_EXEC_FAILED)
|
|
291
|
+
|
|
292
|
+
return self.aed_context._validate_aed_return_code(ret_code[0],
|
|
293
|
+
nodeid_out[0].decode("utf-8"))
|
|
294
|
+
|
|
295
|
+
def _aed_filter(self, nodeid, filter_expr):
|
|
296
|
+
"""
|
|
297
|
+
This wrapper function facilitates a integration with 'aed_filter',
|
|
298
|
+
a C++ function, in AED library, with Python tdml library.
|
|
299
|
+
|
|
300
|
+
This function must be called when a FILTER operation that is
|
|
301
|
+
results needs to filtered from a Python (tdml) data frame.
|
|
302
|
+
|
|
303
|
+
PARAMETERS:
|
|
304
|
+
nodeid - A DAG node, a input to the filter API.
|
|
305
|
+
filter_expr - Expression in SQL format, to be used to filter data from the data frame.
|
|
306
|
+
|
|
307
|
+
EXAMPLES:
|
|
308
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
309
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
310
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
311
|
+
|
|
312
|
+
RETURNS:
|
|
313
|
+
A node id in DAG - AED filter API.
|
|
314
|
+
|
|
315
|
+
RAISES:
|
|
316
|
+
teradataml exceptions:
|
|
317
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
318
|
+
"""
|
|
319
|
+
# Specify the argument types
|
|
320
|
+
self.aed_context.ele_common_lib.aed_filter.argtypes =[POINTER(c_char_p),
|
|
321
|
+
POINTER(c_char_p),
|
|
322
|
+
POINTER(c_char_p),
|
|
323
|
+
POINTER(c_char_p),
|
|
324
|
+
POINTER(c_char_p),
|
|
325
|
+
POINTER(c_char_p),
|
|
326
|
+
POINTER(c_int)
|
|
327
|
+
]
|
|
328
|
+
|
|
329
|
+
arg_name = ["projection"]
|
|
330
|
+
arg_value = [filter_expr]
|
|
331
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="filter_", use_default_database=True, quote=False)
|
|
332
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
333
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
334
|
+
|
|
335
|
+
# Output nodeid
|
|
336
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
337
|
+
|
|
338
|
+
# return code
|
|
339
|
+
ret_code = self.aed_context._int_array1(0)
|
|
340
|
+
|
|
341
|
+
try:
|
|
342
|
+
# *** AED request to filter
|
|
343
|
+
self.aed_context.ele_common_lib.aed_filter(self.aed_context._arr_c([nodeid]),
|
|
344
|
+
self.aed_context._arr_c(arg_name),
|
|
345
|
+
self.aed_context._arr_c(arg_value),
|
|
346
|
+
self.aed_context._arr_c(output_table),
|
|
347
|
+
self.aed_context._arr_c(output_schema),
|
|
348
|
+
nodeid_out,
|
|
349
|
+
ret_code)
|
|
350
|
+
except Exception as emsg:
|
|
351
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_filter)" + str(emsg)),
|
|
352
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
353
|
+
|
|
354
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
355
|
+
|
|
356
|
+
def _aed_ml_query(self, inp_nodeids, query, output_tables, function_name,
|
|
357
|
+
multi_query_inp_nodeids = []):
|
|
358
|
+
"""
|
|
359
|
+
This wrapper function facilitates a integration with 'aed_ml_query',
|
|
360
|
+
a C++ function, in AED library, with Python tdml library.
|
|
361
|
+
|
|
362
|
+
This function must be called when a Python (tdml) wrapper functions to generate
|
|
363
|
+
DAG node for analytical queries.
|
|
364
|
+
|
|
365
|
+
PARAMETERS:
|
|
366
|
+
inp_nodeids - A list of input table/query nodeids.
|
|
367
|
+
query - Complete SQL-MR query
|
|
368
|
+
output_tables - List of output table names to be used for output of aed_ml_query node.
|
|
369
|
+
function_name - Analytical function name.
|
|
370
|
+
multi_query_inp_nodeids - List of input node ids which gives more than one queries on resolution.
|
|
371
|
+
|
|
372
|
+
EXAMPLES:
|
|
373
|
+
nodeid_out = self.aedObj._aed_ml_query([inp_node_id1, inp_node_id2], sqlmr_query, [stdout_table, out_table1, out_table2],
|
|
374
|
+
"Sessionize", [inp_node_id1])
|
|
375
|
+
|
|
376
|
+
RETURNS:
|
|
377
|
+
Returns a list of node ids corresponding to each output table, starting with STDOUT table and then
|
|
378
|
+
SQL-MR output tables.
|
|
379
|
+
|
|
380
|
+
RAISES:
|
|
381
|
+
teradataml exceptions:
|
|
382
|
+
AED_INVALID_SQLMR_QUERY, AED_INVALID_GEN_TABLENAME, AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
383
|
+
TypeErrors - For internal errors. For type mismatch.
|
|
384
|
+
|
|
385
|
+
"""
|
|
386
|
+
|
|
387
|
+
if not isinstance(inp_nodeids, list) or not all(isinstance(nodeid, str) for nodeid in inp_nodeids):
|
|
388
|
+
raise TypeError("AED Internal Error: 'inp_nodeids' should be of type list containing strings.")
|
|
389
|
+
|
|
390
|
+
if not isinstance(query, str):
|
|
391
|
+
raise TypeError("AED Internal Error: 'query' should be of type str.")
|
|
392
|
+
|
|
393
|
+
if not isinstance(output_tables, list) or not all(isinstance(otab, str) for otab in output_tables):
|
|
394
|
+
raise TypeError("AED Internal Error: 'output_tables' should be of type list containing strings.")
|
|
395
|
+
|
|
396
|
+
if not isinstance(function_name, str):
|
|
397
|
+
raise TypeError("AED Internal Error: 'function_name' should be of type str")
|
|
398
|
+
|
|
399
|
+
if not isinstance(multi_query_inp_nodeids, list) or not all(isinstance(nodeid, str)
|
|
400
|
+
for nodeid in multi_query_inp_nodeids):
|
|
401
|
+
raise TypeError("AED Internal Error: 'multi_query_inp_nodeids' should be of type list containing strings.")
|
|
402
|
+
|
|
403
|
+
if not SQLPattern.SQLMR.value.match(query):
|
|
404
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_INVALID_SQLMR_QUERY, "query (aed_ml_query)"),
|
|
405
|
+
MessageCodes.AED_INVALID_SQLMR_QUERY)
|
|
406
|
+
|
|
407
|
+
# Specify the argument types
|
|
408
|
+
self.aed_context.ele_common_lib.aed_ml_query.argtypes =[POINTER(c_char_p), # Node Ids
|
|
409
|
+
POINTER(c_char_p), # arg_name
|
|
410
|
+
POINTER(c_char_p), # arg_value
|
|
411
|
+
POINTER(c_char_p), # output_table
|
|
412
|
+
POINTER(c_char_p), # output_schema
|
|
413
|
+
POINTER(c_char_p), # function_name
|
|
414
|
+
POINTER(c_int), # Num of Inputs
|
|
415
|
+
POINTER(c_int), # Num of Outputs
|
|
416
|
+
POINTER(c_char_p), # Output Node Ids
|
|
417
|
+
POINTER(c_int), # Return code
|
|
418
|
+
POINTER(c_char_p), # Input nodeids incase of multiple queries
|
|
419
|
+
POINTER(c_int) # Number of input nodeids
|
|
420
|
+
]
|
|
421
|
+
|
|
422
|
+
# Input arguments for 'C' function.
|
|
423
|
+
arg_name = ["source"]
|
|
424
|
+
arg_value = [query]
|
|
425
|
+
|
|
426
|
+
# Input and Output Lengths
|
|
427
|
+
num_inputs = len(inp_nodeids)
|
|
428
|
+
num_outputs = len(output_tables)
|
|
429
|
+
num_input_nodes_incaseof_multiqueries = len(multi_query_inp_nodeids)
|
|
430
|
+
|
|
431
|
+
# Ouptut nodeids
|
|
432
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"] * num_outputs)
|
|
433
|
+
output_table_names = []
|
|
434
|
+
output_schemas = []
|
|
435
|
+
for index in range(num_outputs):
|
|
436
|
+
output_table_names.append(UtilFuncs._extract_table_name(output_tables[index]))
|
|
437
|
+
output_schemas.append(UtilFuncs._extract_db_name(output_tables[index]))
|
|
438
|
+
if output_schemas[index] is None:
|
|
439
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_INVALID_GEN_TABLENAME, "(aed_ml_query) " + output_tables[index]),
|
|
440
|
+
MessageCodes.AED_INVALID_GEN_TABLENAME)
|
|
441
|
+
|
|
442
|
+
# return code
|
|
443
|
+
ret_code = self.aed_context._int_array1(0)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
try:
|
|
447
|
+
self.aed_context.ele_common_lib.aed_ml_query(self.aed_context._arr_c(inp_nodeids),
|
|
448
|
+
self.aed_context._arr_c(arg_name),
|
|
449
|
+
self.aed_context._arr_c(arg_value),
|
|
450
|
+
self.aed_context._arr_c(output_table_names),
|
|
451
|
+
self.aed_context._arr_c(output_schemas),
|
|
452
|
+
self.aed_context._arr_c([function_name]),
|
|
453
|
+
self.aed_context._int_array1(num_inputs),
|
|
454
|
+
self.aed_context._int_array1(num_outputs),
|
|
455
|
+
nodeid_out,
|
|
456
|
+
ret_code,
|
|
457
|
+
self.aed_context._arr_c(multi_query_inp_nodeids),
|
|
458
|
+
self.aed_context._int_array1(num_input_nodes_incaseof_multiqueries))
|
|
459
|
+
output_nodeids = self.aed_context._decode_list(nodeid_out)
|
|
460
|
+
del nodeid_out
|
|
461
|
+
except Exception as emsg:
|
|
462
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_ml_query)" + str(emsg)),
|
|
463
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
464
|
+
|
|
465
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], output_nodeids)
|
|
466
|
+
|
|
467
|
+
def _aed_gen_exec_queries(self, nodeid):
|
|
468
|
+
"""
|
|
469
|
+
This wrapper function facilitates a integration with 'aed_gen_exec_queries',
|
|
470
|
+
a C++ function, in AED library, with Python tdml library.
|
|
471
|
+
|
|
472
|
+
This function must be called with DAG node id, to generate a complete DAG
|
|
473
|
+
path and the executable queries for that node.
|
|
474
|
+
Most of the times, user must call _aed_get_exec_query, which will call
|
|
475
|
+
this particular function too.
|
|
476
|
+
|
|
477
|
+
PARAMETERS:
|
|
478
|
+
nodeid - A DAG node id for which executable queries needs to be generated.
|
|
479
|
+
|
|
480
|
+
EXAMPLES:
|
|
481
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
482
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
483
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
484
|
+
num_nodes = AedObj._aed_gen_exec_queries(aed_filter_nodeid)
|
|
485
|
+
|
|
486
|
+
RETURNS:
|
|
487
|
+
Number of queries generated for the provided node ID.
|
|
488
|
+
|
|
489
|
+
RAISES:
|
|
490
|
+
teradataml exceptions:
|
|
491
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
492
|
+
"""
|
|
493
|
+
# Specify the argument types
|
|
494
|
+
self.aed_context.ele_common_lib.aed_gen_exec_queries.argtypes = [POINTER(c_char_p),
|
|
495
|
+
POINTER(c_int),
|
|
496
|
+
POINTER(c_int)
|
|
497
|
+
]
|
|
498
|
+
|
|
499
|
+
queries_count = self.aed_context._int_array1(0)
|
|
500
|
+
|
|
501
|
+
ret_code = self.aed_context._int_array1(0)
|
|
502
|
+
try:
|
|
503
|
+
# *** AED request to generate executable queries
|
|
504
|
+
self.aed_context.ele_common_lib.aed_gen_exec_queries(self.aed_context._arr_c([nodeid]), queries_count, ret_code)
|
|
505
|
+
except Exception as emsg:
|
|
506
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_gen_exec_queries)" + str(emsg)),
|
|
507
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
508
|
+
|
|
509
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], queries_count[0])
|
|
510
|
+
|
|
511
|
+
def _aed_get_exec_querysize(self, nodeid, queries_count=None):
|
|
512
|
+
"""
|
|
513
|
+
This wrapper function facilitates a integration with 'aed_get_exec_querysize',
|
|
514
|
+
a C++ function, in AED library, with Python tdml library.
|
|
515
|
+
|
|
516
|
+
This function is called to get the length of the queries generated for provided
|
|
517
|
+
the nodeid.
|
|
518
|
+
|
|
519
|
+
PARAMETERS:
|
|
520
|
+
nodeid - A DAG node ID for which query size needs to be calculated.
|
|
521
|
+
queries_count - Number of queries generated for the provided node ID.
|
|
522
|
+
|
|
523
|
+
EXAMPLES:
|
|
524
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
525
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
526
|
+
num_nodes = AedObj._aed_gen_dag_path(aed_select_nodeid)
|
|
527
|
+
qry_size = AedObj._aed_get_exec_querysize(aed_select_nodeid, num_nodes)
|
|
528
|
+
|
|
529
|
+
RETURNS:
|
|
530
|
+
exec_query_size - Query size/s for the generated query/ies.
|
|
531
|
+
|
|
532
|
+
RAISES:
|
|
533
|
+
teradataml exceptions:
|
|
534
|
+
AED_QUERY_COUNT_MISMATCH, AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
535
|
+
"""
|
|
536
|
+
# Specify the argument types
|
|
537
|
+
self.aed_context.ele_common_lib.aed_get_exec_querysize.argtypes = [POINTER(c_char_p),
|
|
538
|
+
POINTER(c_int),
|
|
539
|
+
POINTER(c_int),
|
|
540
|
+
POINTER(c_int)
|
|
541
|
+
]
|
|
542
|
+
if self._aed_is_node_executed(nodeid):
|
|
543
|
+
# If node is already executed, then we do not need to run _aed_get_dag_querysize
|
|
544
|
+
raise TeradataMlException(
|
|
545
|
+
Messages.get_message(MessageCodes.AED_NODE_ALREADY_EXECUTED, "(aed_get_exec_querysize)"),
|
|
546
|
+
MessageCodes.AED_NODE_ALREADY_EXECUTED)
|
|
547
|
+
|
|
548
|
+
# Let's validate the provided queries count
|
|
549
|
+
queries_count_verify = self._aed_gen_exec_queries(nodeid)
|
|
550
|
+
if queries_count is None:
|
|
551
|
+
# Check if queries count for the provided node_id is given or not.
|
|
552
|
+
queries_count = queries_count_verify
|
|
553
|
+
|
|
554
|
+
elif queries_count != queries_count_verify:
|
|
555
|
+
# If provided and does not match with the actual one, raise exception.
|
|
556
|
+
raise TeradataMlException(
|
|
557
|
+
Messages.get_message(MessageCodes.AED_QUERY_COUNT_MISMATCH, "(aed_get_exec_querysize)"),
|
|
558
|
+
MessageCodes.AED_QUERY_COUNT_MISMATCH)
|
|
559
|
+
|
|
560
|
+
int_array_n = c_int * queries_count
|
|
561
|
+
exec_query_size = int_array_n(0)
|
|
562
|
+
ret_code = self.aed_context._int_array1(0)
|
|
563
|
+
|
|
564
|
+
try:
|
|
565
|
+
# *** AED request to get executable query/ies size/s
|
|
566
|
+
self.aed_context.ele_common_lib.aed_get_exec_querysize(self.aed_context._arr_c([nodeid]),
|
|
567
|
+
c_int(queries_count), exec_query_size, ret_code)
|
|
568
|
+
except Exception as emsg:
|
|
569
|
+
raise TeradataMlException(
|
|
570
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_get_exec_querysize)" + str(emsg)),
|
|
571
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
572
|
+
|
|
573
|
+
exec_query_size = [qry_size for qry_size in exec_query_size]
|
|
574
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], exec_query_size)
|
|
575
|
+
|
|
576
|
+
def _aed_get_exec_query(self, nodeid, queries_count=None, exec_query_len=None):
|
|
577
|
+
"""
|
|
578
|
+
This wrapper function facilitates a integration with 'aed_get_exec_query',
|
|
579
|
+
a C++ function, in AED library, with Python tdml library.
|
|
580
|
+
|
|
581
|
+
This function must be called when all the queries in the required node to
|
|
582
|
+
be constructed and executed on Python client.
|
|
583
|
+
|
|
584
|
+
PARAMETERS:
|
|
585
|
+
nodeid - A DAG node ID for which queries are to be retrieved.
|
|
586
|
+
queries_count - Number of queries generated for given nodeid.
|
|
587
|
+
exec_query_len - Query size for the generated queries.
|
|
588
|
+
|
|
589
|
+
EXAMPLES:
|
|
590
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
591
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
592
|
+
num_nodes = AedObj._aed_get_exec_query(aed_select_nodeid)
|
|
593
|
+
|
|
594
|
+
RETURNS:
|
|
595
|
+
A list of list, where first list has strings (table/view) to be created upon execution of SQL.
|
|
596
|
+
And second list has equivalent SQL queries, those needs to be executed for complete execution
|
|
597
|
+
of a node.
|
|
598
|
+
|
|
599
|
+
RAISES:
|
|
600
|
+
teradataml exceptions:
|
|
601
|
+
AED_QUERY_COUNT_MISMATCH, AED_NODE_QUERY_LENGTH_MISMATCH
|
|
602
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
603
|
+
"""
|
|
604
|
+
# Specify the argument types
|
|
605
|
+
self.aed_context.ele_common_lib.aed_get_exec_query.argtypes = [POINTER(c_char_p),
|
|
606
|
+
POINTER(c_int),
|
|
607
|
+
POINTER(c_char_p),
|
|
608
|
+
POINTER(c_char_p),
|
|
609
|
+
POINTER(c_char_p),
|
|
610
|
+
POINTER(c_char_p),
|
|
611
|
+
POINTER(c_int)
|
|
612
|
+
]
|
|
613
|
+
|
|
614
|
+
if self._aed_is_node_executed(nodeid):
|
|
615
|
+
# If node is already executed, then we do not need to run _aed_get_dag_querysize
|
|
616
|
+
raise TeradataMlException(
|
|
617
|
+
Messages.get_message(MessageCodes.AED_NODE_ALREADY_EXECUTED, "(_aed_get_exec_query)"),
|
|
618
|
+
MessageCodes.AED_NODE_ALREADY_EXECUTED)
|
|
619
|
+
|
|
620
|
+
# Validate the provided queries count.
|
|
621
|
+
queries_count_verify = self._aed_gen_exec_queries(nodeid)
|
|
622
|
+
if queries_count is None:
|
|
623
|
+
# Check if queries count for the provided node_id is given or not.
|
|
624
|
+
queries_count = queries_count_verify
|
|
625
|
+
|
|
626
|
+
elif queries_count != queries_count_verify:
|
|
627
|
+
# If provided and does not match with the actual one, raise exception.
|
|
628
|
+
raise TeradataMlException(
|
|
629
|
+
Messages.get_message(MessageCodes.AED_QUERY_COUNT_MISMATCH, "(_aed_get_exec_query)"),
|
|
630
|
+
MessageCodes.AED_QUERY_COUNT_MISMATCH)
|
|
631
|
+
|
|
632
|
+
# Validate the provided exec query length.
|
|
633
|
+
if exec_query_len is not None:
|
|
634
|
+
if not isinstance(exec_query_len, list) or not all(isinstance(size, int) for size in exec_query_len):
|
|
635
|
+
raise TypeError("AED Internal Error: 'exec_query_len' should be of type list containing integers.")
|
|
636
|
+
|
|
637
|
+
exec_query_len_verify = self._aed_get_exec_querysize(nodeid, queries_count)
|
|
638
|
+
if exec_query_len is None:
|
|
639
|
+
exec_query_len = exec_query_len_verify
|
|
640
|
+
|
|
641
|
+
elif exec_query_len != exec_query_len_verify:
|
|
642
|
+
# If provided and does not match with the actual one, raise exception.
|
|
643
|
+
raise TeradataMlException(
|
|
644
|
+
Messages.get_message(MessageCodes.AED_NODE_QUERY_LENGTH_MISMATCH, "(_aed_get_exec_query)"
|
|
645
|
+
+ str(exec_query_len) + " and " + str(exec_query_len_verify)),
|
|
646
|
+
MessageCodes.AED_NODE_QUERY_LENGTH_MISMATCH)
|
|
647
|
+
|
|
648
|
+
# dag_query_len contains a list of integers, for all the queries included in DAG PATH.
|
|
649
|
+
# Accordingly, let's construct a query buffer.
|
|
650
|
+
query_buffer = []
|
|
651
|
+
for index in range(len(exec_query_len)):
|
|
652
|
+
query_buffer.append(" " * exec_query_len[index])
|
|
653
|
+
query_buffer = self.aed_context._arr_c(query_buffer)
|
|
654
|
+
|
|
655
|
+
# Let's construct a table name buffer.
|
|
656
|
+
table_name_buffer = self.aed_context._arr_c(
|
|
657
|
+
[" " * AEDConstants.AED_DB_OBJECT_NAME_BUFFER_SIZE.value * 2] * queries_count)
|
|
658
|
+
node_type_buffer = self.aed_context._arr_c(
|
|
659
|
+
[" " * AEDConstants.AED_NODE_TYPE_BUFFER_SIZE.value] * queries_count)
|
|
660
|
+
node_id_buffer = self.aed_context._arr_c(["00000000000000000000"] * queries_count)
|
|
661
|
+
ret_code = self.aed_context._int_array1(0)
|
|
662
|
+
|
|
663
|
+
try:
|
|
664
|
+
# *** AED request to generate queries
|
|
665
|
+
self.aed_context.ele_common_lib.aed_get_exec_query(self.aed_context._arr_c([nodeid]),
|
|
666
|
+
c_int(queries_count),
|
|
667
|
+
query_buffer,
|
|
668
|
+
table_name_buffer,
|
|
669
|
+
node_type_buffer,
|
|
670
|
+
node_id_buffer,
|
|
671
|
+
ret_code)
|
|
672
|
+
# Decode UTF-8 strings
|
|
673
|
+
table_name_buffer_out = self.aed_context._decode_list(table_name_buffer)
|
|
674
|
+
del table_name_buffer
|
|
675
|
+
query_buffer_out = self.aed_context._decode_list(query_buffer)
|
|
676
|
+
del query_buffer
|
|
677
|
+
node_type_out = self.aed_context._decode_list(node_type_buffer)
|
|
678
|
+
del node_type_buffer
|
|
679
|
+
node_id_out = self.aed_context._decode_list(node_id_buffer)
|
|
680
|
+
del node_id_buffer
|
|
681
|
+
|
|
682
|
+
except Exception as emsg:
|
|
683
|
+
raise TeradataMlException(
|
|
684
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_get_exec_query)" + str(emsg)),
|
|
685
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
686
|
+
|
|
687
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], [table_name_buffer_out, query_buffer_out,
|
|
688
|
+
node_type_out, node_id_out])
|
|
689
|
+
|
|
690
|
+
def _aed_update_node_state(self, nodeid, nodestate=AEDConstants.AED_NODE_EXECUTED.value):
|
|
691
|
+
"""
|
|
692
|
+
This wrapper function facilitates a integration with 'aed_update_node_state',
|
|
693
|
+
a C++ function, in AED library, with Python tdml library.
|
|
694
|
+
|
|
695
|
+
A function to update all the nodes in the DAG node path, when executed
|
|
696
|
+
from client. This function needs to be called once all the node queries
|
|
697
|
+
have been executed.
|
|
698
|
+
|
|
699
|
+
PARAMETERS:
|
|
700
|
+
nodeid - A DAG node ID for which node state has to updated.
|
|
701
|
+
nodestate - Node state to which node should be updated.
|
|
702
|
+
|
|
703
|
+
EXAMPLES:
|
|
704
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
705
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
706
|
+
tables_queries = AedObj._aed_get_exec_query(aed_select_nodeid)
|
|
707
|
+
num_nodes_updated = AedObj._aed_update_node_state(self, nodeid)
|
|
708
|
+
|
|
709
|
+
RETURNS:
|
|
710
|
+
Returns number of DAG Nodes updated.
|
|
711
|
+
|
|
712
|
+
RAISES:
|
|
713
|
+
teradataml exceptions:
|
|
714
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
715
|
+
"""
|
|
716
|
+
# Specify the argument types
|
|
717
|
+
self.aed_context.ele_common_lib.aed_update_node_state.argtypes = [POINTER(c_char_p),
|
|
718
|
+
POINTER(c_int),
|
|
719
|
+
POINTER(c_int),
|
|
720
|
+
POINTER(c_int)
|
|
721
|
+
]
|
|
722
|
+
|
|
723
|
+
ret_code = self.aed_context._int_array1(0)
|
|
724
|
+
# If num_dag_nodes is 1, then only single node will be updated.
|
|
725
|
+
# So, assign num_dag_nodes to 0 (other than 1) to update all the nodes in the DAG node path.
|
|
726
|
+
num_dag_nodes = self.aed_context._int_array1(0)
|
|
727
|
+
|
|
728
|
+
if nodestate not in (AEDConstants.AED_NODE_NOT_EXECUTED.value, AEDConstants.AED_NODE_EXECUTED.value):
|
|
729
|
+
raise TeradataMlException(
|
|
730
|
+
Messages.get_message(MessageCodes.AED_INVALID_ARGUMENT, "(_aed_update_node_state)", "nodestate",
|
|
731
|
+
[AEDConstants.AED_NODE_NOT_EXECUTED.value, AEDConstants.AED_NODE_EXECUTED.value]),
|
|
732
|
+
MessageCodes.AED_INVALID_ARGUMENT)
|
|
733
|
+
|
|
734
|
+
try:
|
|
735
|
+
# # *** AED request to update node states of a DAG
|
|
736
|
+
self.aed_context.ele_common_lib.aed_update_node_state(self.aed_context._arr_c([nodeid]),
|
|
737
|
+
c_int(nodestate), num_dag_nodes, ret_code)
|
|
738
|
+
except Exception as emsg:
|
|
739
|
+
raise TeradataMlException(
|
|
740
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_update_node_state)" + str(emsg)),
|
|
741
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
742
|
+
|
|
743
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], num_dag_nodes[0])
|
|
744
|
+
|
|
745
|
+
def _aed_update_node_state_single(self, nodeid, nodestate=AEDConstants.AED_NODE_EXECUTED.value):
|
|
746
|
+
"""
|
|
747
|
+
This wrapper function facilitates a integration with 'aed_update_node_state_single',
|
|
748
|
+
a C++ function, in AED library, with Python tdml library.
|
|
749
|
+
|
|
750
|
+
A function to update a node id of DAG to executed state.
|
|
751
|
+
This function needs to be called when to update single node state to execute.
|
|
752
|
+
|
|
753
|
+
PARAMETERS:
|
|
754
|
+
nodeid - A DAG node ID for which node state has to updated.
|
|
755
|
+
nodestate - Node state to which node should be updated.
|
|
756
|
+
|
|
757
|
+
EXAMPLES:
|
|
758
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
759
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
760
|
+
AedObj._aed_update_node_state_single(self, aed_select_nodeid)
|
|
761
|
+
|
|
762
|
+
RETURNS:
|
|
763
|
+
None
|
|
764
|
+
|
|
765
|
+
RAISES:
|
|
766
|
+
teradataml exceptions:
|
|
767
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
768
|
+
"""
|
|
769
|
+
# Specify the argument types
|
|
770
|
+
self.aed_context.ele_common_lib.aed_update_node_state_single.argtypes = [POINTER(c_char_p),
|
|
771
|
+
POINTER(c_int),
|
|
772
|
+
POINTER(c_int)
|
|
773
|
+
]
|
|
774
|
+
|
|
775
|
+
ret_code = self.aed_context._int_array1(0)
|
|
776
|
+
|
|
777
|
+
if nodestate not in (AEDConstants.AED_NODE_NOT_EXECUTED.value, AEDConstants.AED_NODE_EXECUTED.value):
|
|
778
|
+
raise TeradataMlException(
|
|
779
|
+
Messages.get_message(MessageCodes.AED_INVALID_ARGUMENT, "(_aed_update_node_state)", "nodestate",
|
|
780
|
+
[AEDConstants.AED_NODE_NOT_EXECUTED.value, AEDConstants.AED_NODE_EXECUTED.value]),
|
|
781
|
+
MessageCodes.AED_INVALID_ARGUMENT)
|
|
782
|
+
|
|
783
|
+
try:
|
|
784
|
+
# *** AED request to update single node state
|
|
785
|
+
self.aed_context.ele_common_lib.aed_update_node_state_single(self.aed_context._arr_c([nodeid]),
|
|
786
|
+
c_int(nodestate), ret_code)
|
|
787
|
+
except Exception as emsg:
|
|
788
|
+
raise TeradataMlException(
|
|
789
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_update_node_state_single)" + str(emsg)),
|
|
790
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
791
|
+
|
|
792
|
+
return self.aed_context._validate_aed_return_code(ret_code[0])
|
|
793
|
+
|
|
794
|
+
def _print_dag(self):
|
|
795
|
+
"""
|
|
796
|
+
This wrapper function facilitates a integration with 'print_dag',
|
|
797
|
+
a C++ function, in AED library, with Python tdml library.
|
|
798
|
+
|
|
799
|
+
To get all node contents and print the same.
|
|
800
|
+
|
|
801
|
+
PARAMETERS:
|
|
802
|
+
None
|
|
803
|
+
|
|
804
|
+
EXAMPLES:
|
|
805
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
806
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
807
|
+
AedObj._print_dag()
|
|
808
|
+
|
|
809
|
+
RETURNS:
|
|
810
|
+
None
|
|
811
|
+
|
|
812
|
+
RAISES:
|
|
813
|
+
teradataml exceptions:
|
|
814
|
+
AED_EXEC_FAILED
|
|
815
|
+
"""
|
|
816
|
+
# TODO:: Needs support from AED to accept node to be printed.
|
|
817
|
+
# Specify the argument types
|
|
818
|
+
self.aed_context.ele_common_lib.print_dag.argtypes = []
|
|
819
|
+
|
|
820
|
+
try:
|
|
821
|
+
# *** AED request to generate DAG path
|
|
822
|
+
self.aed_context.ele_common_lib.print_dag()
|
|
823
|
+
except Exception as emsg:
|
|
824
|
+
raise TeradataMlException(
|
|
825
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(print_dag)" + str(emsg)),
|
|
826
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
827
|
+
|
|
828
|
+
def _print_dag_path(self, nodeid):
|
|
829
|
+
"""
|
|
830
|
+
This wrapper function facilitates a integration with 'print_dag_path',
|
|
831
|
+
a C++ function, in AED library, with Python tdml library.
|
|
832
|
+
|
|
833
|
+
Function to print complete node path for a DAG, from given nodeid.
|
|
834
|
+
|
|
835
|
+
PARAMETERS:
|
|
836
|
+
nodeid - A DAG node ID.
|
|
837
|
+
|
|
838
|
+
EXAMPLES:
|
|
839
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
840
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
841
|
+
AedObj._print_dag_path(aed_select_nodeid)
|
|
842
|
+
|
|
843
|
+
RETURNS:
|
|
844
|
+
None
|
|
845
|
+
|
|
846
|
+
RAISES:
|
|
847
|
+
teradataml exceptions:
|
|
848
|
+
AED_EXEC_FAILED
|
|
849
|
+
"""
|
|
850
|
+
# Specify the argument types
|
|
851
|
+
self.aed_context.ele_common_lib.print_dag_path.argtypes = [POINTER(c_char_p)]
|
|
852
|
+
|
|
853
|
+
try:
|
|
854
|
+
# *** AED request to print DAG path
|
|
855
|
+
self.aed_context.ele_common_lib.print_dag_path(self.aed_context._arr_c([nodeid]))
|
|
856
|
+
except Exception as emsg:
|
|
857
|
+
raise TeradataMlException(
|
|
858
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(print_dag_path)" + str(emsg)),
|
|
859
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
860
|
+
|
|
861
|
+
def _aed_is_node_executed(self, nodeid):
|
|
862
|
+
"""
|
|
863
|
+
This wrapper function facilitates a integration with 'aed_is_node_executed',
|
|
864
|
+
a C++ function, in AED library, with Python tdml library.
|
|
865
|
+
|
|
866
|
+
Function to check whether node is already executed or not.
|
|
867
|
+
|
|
868
|
+
PARAMETERS:
|
|
869
|
+
nodeid - A DAG node ID.
|
|
870
|
+
|
|
871
|
+
RETURNS:
|
|
872
|
+
True if node is executed, false if not executed.
|
|
873
|
+
|
|
874
|
+
RAISES:
|
|
875
|
+
teradataml exceptions:
|
|
876
|
+
AED_EXEC_FAILED
|
|
877
|
+
|
|
878
|
+
EXAMPLES:
|
|
879
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
880
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
881
|
+
node_flag = AedObj._aed_is_node_executed(aed_select_nodeid) # Returns false.
|
|
882
|
+
# Let's mark node as executed.
|
|
883
|
+
num_nodes_updated = AedObj._aed_update_node_state(self, nodeid)
|
|
884
|
+
node_flag = AedObj._aed_is_node_executed(aed_select_nodeid) # Returns True.
|
|
885
|
+
|
|
886
|
+
"""
|
|
887
|
+
# Specify the argument types
|
|
888
|
+
self.aed_context.ele_common_lib.aed_is_node_executed.argtypes = [POINTER(c_char_p),
|
|
889
|
+
POINTER(c_int),
|
|
890
|
+
POINTER(c_int)]
|
|
891
|
+
|
|
892
|
+
node_flag = self.aed_context._int_array1(0)
|
|
893
|
+
ret_code = self.aed_context._int_array1(0)
|
|
894
|
+
|
|
895
|
+
try:
|
|
896
|
+
# *** AED request to check whether node is executed or not.
|
|
897
|
+
self.aed_context.ele_common_lib.aed_is_node_executed(self.aed_context._arr_c([nodeid]),
|
|
898
|
+
node_flag,
|
|
899
|
+
ret_code
|
|
900
|
+
)
|
|
901
|
+
except Exception as emsg:
|
|
902
|
+
raise TeradataMlException(
|
|
903
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_is_node_executed)" + str(emsg)),
|
|
904
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
905
|
+
|
|
906
|
+
node_executed = True
|
|
907
|
+
if node_flag[0] == AEDConstants.AED_NODE_NOT_EXECUTED.value:
|
|
908
|
+
node_executed = False
|
|
909
|
+
|
|
910
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], node_executed)
|
|
911
|
+
|
|
912
|
+
def _aed_get_tablename(self, nodeid):
|
|
913
|
+
"""
|
|
914
|
+
This wrapper function facilitates a integration with 'aed_get_tablename',
|
|
915
|
+
a C++ function, in AED library, with Python tdml library.
|
|
916
|
+
|
|
917
|
+
Function to get table name for the provided node id..
|
|
918
|
+
|
|
919
|
+
PARAMETERS:
|
|
920
|
+
nodeid - A DAG node ID.
|
|
921
|
+
|
|
922
|
+
RETURNS:
|
|
923
|
+
Fully qualified table name. (dbname.tablename)
|
|
924
|
+
|
|
925
|
+
RAISES:
|
|
926
|
+
teradataml exceptions:
|
|
927
|
+
AED_EXEC_FAILED
|
|
928
|
+
|
|
929
|
+
EXAMPLES:
|
|
930
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
931
|
+
table_name = AedObj._aed_get_table(aed_table_nodeid).
|
|
932
|
+
|
|
933
|
+
"""
|
|
934
|
+
# Specify the argument types
|
|
935
|
+
self.aed_context.ele_common_lib.aed_get_tablename.argtypes = [POINTER(c_char_p),
|
|
936
|
+
POINTER(c_char_p),
|
|
937
|
+
POINTER(c_char_p),
|
|
938
|
+
POINTER(c_int)]
|
|
939
|
+
outstr = "0" * AEDConstants.AED_DB_OBJECT_NAME_BUFFER_SIZE.value
|
|
940
|
+
output_table = self.aed_context._arr_c([outstr])
|
|
941
|
+
output_schema = self.aed_context._arr_c([outstr])
|
|
942
|
+
ret_code = self.aed_context._int_array1(0)
|
|
943
|
+
|
|
944
|
+
try:
|
|
945
|
+
# *** AED request to get table name from node id.
|
|
946
|
+
self.aed_context.ele_common_lib.aed_get_tablename(self.aed_context._arr_c([nodeid]),
|
|
947
|
+
output_table,
|
|
948
|
+
output_schema,
|
|
949
|
+
ret_code
|
|
950
|
+
)
|
|
951
|
+
|
|
952
|
+
tablename = UtilFuncs._teradata_quote_arg(output_table[0].decode('UTF-8'), "\"", False)
|
|
953
|
+
|
|
954
|
+
if output_schema[0].decode('UTF-8') != outstr and len(output_schema[0]) != 0:
|
|
955
|
+
tablename = "{}.{}".format(UtilFuncs._teradata_quote_arg(output_schema[0].decode('UTF-8'), "\"", False),
|
|
956
|
+
tablename)
|
|
957
|
+
|
|
958
|
+
del outstr
|
|
959
|
+
del output_schema
|
|
960
|
+
del output_table
|
|
961
|
+
except Exception as emsg:
|
|
962
|
+
raise TeradataMlException(
|
|
963
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_get_tablename)" + str(emsg)),
|
|
964
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
965
|
+
|
|
966
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], tablename)
|
|
967
|
+
|
|
968
|
+
def _aed_get_source_tablename(self, nodeid):
|
|
969
|
+
"""
|
|
970
|
+
This wrapper function facilitates a integration with 'aed_get_source_table',
|
|
971
|
+
a C++ function, in AED library, with Python teradataml library.
|
|
972
|
+
|
|
973
|
+
Function to get table name for the provided node id. In addition, It returns source table name.
|
|
974
|
+
|
|
975
|
+
PARAMETERS:
|
|
976
|
+
nodeid - A DAG node ID.
|
|
977
|
+
|
|
978
|
+
RETURNS:
|
|
979
|
+
Fully qualified table name including source table name.
|
|
980
|
+
|
|
981
|
+
RAISES:
|
|
982
|
+
teradataml exceptions:
|
|
983
|
+
AED_EXEC_FAILED
|
|
984
|
+
|
|
985
|
+
EXAMPLES:
|
|
986
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
987
|
+
table_name = AedObj._aed_get_source_tablename(aed_table_nodeid)
|
|
988
|
+
|
|
989
|
+
"""
|
|
990
|
+
# Specify the argument types
|
|
991
|
+
self.aed_context.ele_common_lib.aed_get_source_tablename.argtypes = [POINTER(c_char_p),
|
|
992
|
+
POINTER(c_char_p),
|
|
993
|
+
POINTER(c_char_p),
|
|
994
|
+
POINTER(c_int)]
|
|
995
|
+
outstr = "0" * AEDConstants.AED_DB_OBJECT_NAME_BUFFER_SIZE.value
|
|
996
|
+
output_table = self.aed_context._arr_c([outstr])
|
|
997
|
+
output_schema = self.aed_context._arr_c([outstr])
|
|
998
|
+
ret_code = self.aed_context._int_array1(0)
|
|
999
|
+
|
|
1000
|
+
try:
|
|
1001
|
+
# *** AED request to get source table name from node id.
|
|
1002
|
+
self.aed_context.ele_common_lib.aed_get_source_tablename(self.aed_context._arr_c([nodeid]),
|
|
1003
|
+
output_table,
|
|
1004
|
+
output_schema,
|
|
1005
|
+
ret_code
|
|
1006
|
+
)
|
|
1007
|
+
|
|
1008
|
+
tablename = UtilFuncs._teradata_quote_arg(output_table[0].decode('UTF-8'), "\"", False)
|
|
1009
|
+
|
|
1010
|
+
if output_schema[0].decode('UTF-8') != outstr and len(output_schema[0]) != 0:
|
|
1011
|
+
tablename = "{}.{}".format(UtilFuncs._teradata_quote_arg(output_schema[0].decode('UTF-8'), "\"", False),
|
|
1012
|
+
tablename)
|
|
1013
|
+
|
|
1014
|
+
del outstr
|
|
1015
|
+
del output_schema
|
|
1016
|
+
del output_table
|
|
1017
|
+
except Exception as emsg:
|
|
1018
|
+
raise TeradataMlException(
|
|
1019
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_get_source_tablename)" + str(emsg)),
|
|
1020
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1021
|
+
|
|
1022
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], tablename)
|
|
1023
|
+
|
|
1024
|
+
def _aed_orderby(self, nodeid, orderby_expr):
|
|
1025
|
+
"""
|
|
1026
|
+
This wrapper function facilitates a integration with 'aed_orderby',
|
|
1027
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1028
|
+
|
|
1029
|
+
This function must be called when a ORDERBY operation that is
|
|
1030
|
+
columns are to be ordered from a Python (tdml) data frame.
|
|
1031
|
+
|
|
1032
|
+
PARAMETERS:
|
|
1033
|
+
nodeid - A DAG node, a input to the orderby API.
|
|
1034
|
+
orderby_expr - orderby expression.
|
|
1035
|
+
|
|
1036
|
+
EXAMPLES:
|
|
1037
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1038
|
+
aed_select_nodeid = AedObj._aed_orderby(aed_table_nodeid, "col1 ASC, col2 DESC")
|
|
1039
|
+
|
|
1040
|
+
RETURNS:
|
|
1041
|
+
A node id in DAG - AED orderby API.
|
|
1042
|
+
|
|
1043
|
+
RAISES:
|
|
1044
|
+
teradataml exceptions:
|
|
1045
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1046
|
+
"""
|
|
1047
|
+
# Specify the argument types
|
|
1048
|
+
self.aed_context.ele_common_lib.aed_orderby.argtypes =[POINTER(c_char_p),
|
|
1049
|
+
POINTER(c_char_p),
|
|
1050
|
+
POINTER(c_char_p),
|
|
1051
|
+
POINTER(c_char_p),
|
|
1052
|
+
POINTER(c_char_p),
|
|
1053
|
+
POINTER(c_char_p),
|
|
1054
|
+
POINTER(c_int)
|
|
1055
|
+
]
|
|
1056
|
+
|
|
1057
|
+
arg_name = ["orderby"]
|
|
1058
|
+
arg_value = [orderby_expr]
|
|
1059
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="orderby_", use_default_database=True, quote=False)
|
|
1060
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1061
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1062
|
+
|
|
1063
|
+
# Output nodeid
|
|
1064
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1065
|
+
# return code
|
|
1066
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1067
|
+
try:
|
|
1068
|
+
# *** AED request to select columns
|
|
1069
|
+
self.aed_context.ele_common_lib.aed_orderby(self.aed_context._arr_c([nodeid]),
|
|
1070
|
+
self.aed_context._arr_c(arg_name),
|
|
1071
|
+
self.aed_context._arr_c(arg_value),
|
|
1072
|
+
self.aed_context._arr_c(output_table),
|
|
1073
|
+
self.aed_context._arr_c(output_schema),
|
|
1074
|
+
nodeid_out,
|
|
1075
|
+
ret_code)
|
|
1076
|
+
except Exception as emsg:
|
|
1077
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_orderby)" + str(emsg)),
|
|
1078
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1079
|
+
|
|
1080
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1081
|
+
|
|
1082
|
+
def _aed_join(self, left_nodeid, right_nodeid, select_expr, join_type, join_condition, l_alias=None, r_alias=None):
|
|
1083
|
+
"""
|
|
1084
|
+
This wrapper function facilitates a integration with 'aed_join',
|
|
1085
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1086
|
+
|
|
1087
|
+
This function must be called when a JOIN operation that is
|
|
1088
|
+
two Python (tdml) data frames to be joined on a condition.
|
|
1089
|
+
|
|
1090
|
+
PARAMETERS:
|
|
1091
|
+
left_nodeid - A DAG node, left table to be join.
|
|
1092
|
+
right_nodeid - A DAG node, right table to be join.
|
|
1093
|
+
select_expr - Columns to select after performing join.
|
|
1094
|
+
join_type - Type of join to perform on two tables.
|
|
1095
|
+
join_condition - Join condition to perform JOIN on two tables.
|
|
1096
|
+
l_alias - Alias name to be added to left table.
|
|
1097
|
+
r_alias - Alias name to be added to right table.
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
EXAMPLES:
|
|
1101
|
+
aed_table1_nodeid = AedObj._aed_table("dbname.tablename1")
|
|
1102
|
+
aed_table2_nodeid = AedObj._aed_table("dbname.tablename2")
|
|
1103
|
+
aed_join_nodeid = self.aed_obj._aed_join(filter_node_id1, select_node_id1,
|
|
1104
|
+
"df1.col1 as df1_col1, df2.col1 as df2_col1, df1.col2,df2.col3",
|
|
1105
|
+
"inner", "df1.col1 = df2.col1 and df1.col2 = df2.col3", "df1", "df2")
|
|
1106
|
+
|
|
1107
|
+
RETURNS:
|
|
1108
|
+
A node id in DAG - AED join API.
|
|
1109
|
+
|
|
1110
|
+
RAISES:
|
|
1111
|
+
teradataml exceptions:
|
|
1112
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1113
|
+
"""
|
|
1114
|
+
# Specify the argument types
|
|
1115
|
+
self.aed_context.ele_common_lib.aed_join.argtypes =[POINTER(c_char_p),
|
|
1116
|
+
POINTER(c_char_p),
|
|
1117
|
+
POINTER(c_char_p),
|
|
1118
|
+
POINTER(c_char_p),
|
|
1119
|
+
POINTER(c_char_p),
|
|
1120
|
+
POINTER(c_char_p),
|
|
1121
|
+
POINTER(c_int)
|
|
1122
|
+
]
|
|
1123
|
+
|
|
1124
|
+
arg_name = [join_type, l_alias, r_alias, "projection"]
|
|
1125
|
+
arg_value = [join_condition, l_alias, r_alias, select_expr]
|
|
1126
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="join_", use_default_database=True, quote=False)
|
|
1127
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1128
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1129
|
+
|
|
1130
|
+
# Output nodeid
|
|
1131
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1132
|
+
# return code
|
|
1133
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1134
|
+
try:
|
|
1135
|
+
# *** AED request to select columns
|
|
1136
|
+
self.aed_context.ele_common_lib.aed_join(self.aed_context._arr_c([left_nodeid,right_nodeid]),
|
|
1137
|
+
self.aed_context._arr_c(arg_name),
|
|
1138
|
+
self.aed_context._arr_c(arg_value),
|
|
1139
|
+
self.aed_context._arr_c(output_table),
|
|
1140
|
+
self.aed_context._arr_c(output_schema),
|
|
1141
|
+
nodeid_out,
|
|
1142
|
+
ret_code)
|
|
1143
|
+
except Exception as emsg:
|
|
1144
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_join)" + str(emsg)),
|
|
1145
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1146
|
+
|
|
1147
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1148
|
+
|
|
1149
|
+
def _aed_assign(self, nodeid, assign_expr,
|
|
1150
|
+
drop_existing_columns = AEDConstants.AED_ASSIGN_DO_NOT_DROP_EXISITING_COLUMNS.value):
|
|
1151
|
+
"""
|
|
1152
|
+
This wrapper function facilitates a integration with 'aed_assign',
|
|
1153
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1154
|
+
|
|
1155
|
+
This function must be called when evaluating SQL expressions.
|
|
1156
|
+
|
|
1157
|
+
PARAMETERS:
|
|
1158
|
+
nodeid - A DAG node, a input to the aed_assign API.
|
|
1159
|
+
assign_expr - SQL expression to evaluate.
|
|
1160
|
+
drop_existing_columns - Whether to drop exisitng columns or not.
|
|
1161
|
+
|
|
1162
|
+
EXAMPLES:
|
|
1163
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1164
|
+
aed_assign_nodeid = AedObj._aed_assign(aed_table_nodeid,
|
|
1165
|
+
"abs(col1) as abs_col1, upper(col2) as upper_col2", "Y")
|
|
1166
|
+
|
|
1167
|
+
RETURNS:
|
|
1168
|
+
A node id in DAG - AED assign API.
|
|
1169
|
+
|
|
1170
|
+
RAISES:
|
|
1171
|
+
teradataml exceptions:
|
|
1172
|
+
AED_EXEC_FAILED, AED_NON_ZERO_STATUS and AED_INVALID_ARGUMENT
|
|
1173
|
+
"""
|
|
1174
|
+
# Specify the argument types
|
|
1175
|
+
self.aed_context.ele_common_lib.aed_assign.argtypes = [POINTER(c_char_p),
|
|
1176
|
+
POINTER(c_char_p),
|
|
1177
|
+
POINTER(c_char_p),
|
|
1178
|
+
POINTER(c_char_p),
|
|
1179
|
+
POINTER(c_char_p),
|
|
1180
|
+
POINTER(c_char_p),
|
|
1181
|
+
POINTER(c_int)
|
|
1182
|
+
]
|
|
1183
|
+
if drop_existing_columns not in (AEDConstants.AED_ASSIGN_DROP_EXISITING_COLUMNS.value,
|
|
1184
|
+
AEDConstants.AED_ASSIGN_DO_NOT_DROP_EXISITING_COLUMNS.value):
|
|
1185
|
+
raise TeradataMlException(
|
|
1186
|
+
Messages.get_message(MessageCodes.AED_INVALID_ARGUMENT, "(_aed_assign)", "drop_existing_columns",
|
|
1187
|
+
[AEDConstants.AED_ASSIGN_DROP_EXISITING_COLUMNS.value,
|
|
1188
|
+
AEDConstants.AED_ASSIGN_DO_NOT_DROP_EXISITING_COLUMNS.value]),
|
|
1189
|
+
MessageCodes.AED_INVALID_ARGUMENT)
|
|
1190
|
+
|
|
1191
|
+
arg_name = ["assign", "drop_cols"]
|
|
1192
|
+
arg_value = [assign_expr, drop_existing_columns]
|
|
1193
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="assign_", use_default_database=True, quote=False)
|
|
1194
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1195
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1196
|
+
|
|
1197
|
+
# Output nodeid
|
|
1198
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1199
|
+
# return code
|
|
1200
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1201
|
+
try:
|
|
1202
|
+
# *** AED request to evaluate sql expressions
|
|
1203
|
+
self.aed_context.ele_common_lib.aed_assign(self.aed_context._arr_c([nodeid]),
|
|
1204
|
+
self.aed_context._arr_c(arg_name),
|
|
1205
|
+
self.aed_context._arr_c(arg_value),
|
|
1206
|
+
self.aed_context._arr_c(output_table),
|
|
1207
|
+
self.aed_context._arr_c(output_schema),
|
|
1208
|
+
nodeid_out,
|
|
1209
|
+
ret_code)
|
|
1210
|
+
except Exception as emsg:
|
|
1211
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_assign)" + str(emsg)),
|
|
1212
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1213
|
+
|
|
1214
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1215
|
+
|
|
1216
|
+
def _aed_get_node_query_type(self, nodeid):
|
|
1217
|
+
"""
|
|
1218
|
+
This wrapper function facilitates a integration with 'aed_get_node_query_type',
|
|
1219
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1220
|
+
|
|
1221
|
+
Function to get type of provided node id.
|
|
1222
|
+
|
|
1223
|
+
PARAMETERS:
|
|
1224
|
+
nodeid - A DAG node ID.
|
|
1225
|
+
|
|
1226
|
+
RETURNS:
|
|
1227
|
+
Node query type.
|
|
1228
|
+
|
|
1229
|
+
RAISES:
|
|
1230
|
+
teradataml exceptions:
|
|
1231
|
+
AED_EXEC_FAILED
|
|
1232
|
+
|
|
1233
|
+
EXAMPLES:
|
|
1234
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1235
|
+
node_type = AedObj._aed_get_node_query_type(aed_table_nodeid).
|
|
1236
|
+
|
|
1237
|
+
"""
|
|
1238
|
+
# Specify the argument types
|
|
1239
|
+
self.aed_context.ele_common_lib.aed_get_node_query_type.argtypes = [POINTER(c_char_p),
|
|
1240
|
+
POINTER(c_char_p),
|
|
1241
|
+
POINTER(c_int)]
|
|
1242
|
+
outstr = "0" * AEDConstants.AED_NODE_TYPE_BUFFER_SIZE.value
|
|
1243
|
+
node_type_buf = self.aed_context._arr_c([outstr])
|
|
1244
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1245
|
+
|
|
1246
|
+
try:
|
|
1247
|
+
# *** AED request to get type of the node id.
|
|
1248
|
+
self.aed_context.ele_common_lib.aed_get_node_query_type(self.aed_context._arr_c([nodeid]),
|
|
1249
|
+
node_type_buf,
|
|
1250
|
+
ret_code
|
|
1251
|
+
)
|
|
1252
|
+
node_type = node_type_buf[0].decode('UTF-8')
|
|
1253
|
+
del node_type_buf
|
|
1254
|
+
except Exception as emsg:
|
|
1255
|
+
raise TeradataMlException(
|
|
1256
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_get_node_query_type)" + str(emsg)),
|
|
1257
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1258
|
+
|
|
1259
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], node_type)
|
|
1260
|
+
|
|
1261
|
+
def _aed_groupby(self, nodeid, groupby_expr, option=None):
|
|
1262
|
+
"""
|
|
1263
|
+
This wrapper function facilitates a integration with 'aed_groupby',
|
|
1264
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1265
|
+
|
|
1266
|
+
This function must be called when a GROUP BY operation for specific
|
|
1267
|
+
columns are to be selected from a Python (tdml) data frame.
|
|
1268
|
+
|
|
1269
|
+
PARAMETERS:
|
|
1270
|
+
nodeid - A DAG node, a input to the select API.
|
|
1271
|
+
groupby_expr - Columns, to be given from the data frame.
|
|
1272
|
+
option - Option, to be given from the GROUP BY Clause.
|
|
1273
|
+
|
|
1274
|
+
EXAMPLES:
|
|
1275
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1276
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1277
|
+
aed_groupby_nodeid = AedObj._aed_groupby(aed_select_nodeid, "col1, col2, col3")
|
|
1278
|
+
|
|
1279
|
+
RETURNS:
|
|
1280
|
+
A node id in DAG - AED group_by API.
|
|
1281
|
+
|
|
1282
|
+
RAISES:
|
|
1283
|
+
teradataml exceptions:
|
|
1284
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1285
|
+
"""
|
|
1286
|
+
# Specify the argument types
|
|
1287
|
+
self.aed_context.ele_common_lib.aed_groupby.argtypes =[POINTER(c_char_p),
|
|
1288
|
+
POINTER(c_char_p),
|
|
1289
|
+
POINTER(c_char_p),
|
|
1290
|
+
POINTER(c_char_p),
|
|
1291
|
+
POINTER(c_char_p),
|
|
1292
|
+
POINTER(c_char_p),
|
|
1293
|
+
POINTER(c_int)
|
|
1294
|
+
]
|
|
1295
|
+
|
|
1296
|
+
arg_name = ["group by"]
|
|
1297
|
+
# If option is passed, add prefix of the option to the groupby_expr,
|
|
1298
|
+
# else, add prefix as empty string.
|
|
1299
|
+
if isinstance(groupby_expr, str):
|
|
1300
|
+
arg_value = ["{} | {}".format(option, groupby_expr)] if option \
|
|
1301
|
+
else ["{}| {}".format("", groupby_expr)]
|
|
1302
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="groupby_", use_default_database=True, quote=False)
|
|
1303
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1304
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1305
|
+
|
|
1306
|
+
# Output nodeid
|
|
1307
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1308
|
+
|
|
1309
|
+
# return code
|
|
1310
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1311
|
+
try:
|
|
1312
|
+
# *** AED request to group by
|
|
1313
|
+
self.aed_context.ele_common_lib.aed_groupby(self.aed_context._arr_c([nodeid]),
|
|
1314
|
+
self.aed_context._arr_c(arg_name),
|
|
1315
|
+
self.aed_context._arr_c(arg_value),
|
|
1316
|
+
self.aed_context._arr_c(output_table),
|
|
1317
|
+
self.aed_context._arr_c(output_schema),
|
|
1318
|
+
nodeid_out,
|
|
1319
|
+
ret_code)
|
|
1320
|
+
except Exception as emsg:
|
|
1321
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_groupby)" + str(emsg)),
|
|
1322
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1323
|
+
|
|
1324
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1325
|
+
|
|
1326
|
+
def _aed_setop(self, input_nodeids, setop_type, input_table_columns):
|
|
1327
|
+
"""
|
|
1328
|
+
This wrapper function facilitates a integration with 'aed_setop',
|
|
1329
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1330
|
+
|
|
1331
|
+
This function must be called to perform set operation on
|
|
1332
|
+
two Python (tdml) data frames.
|
|
1333
|
+
|
|
1334
|
+
PARAMETERS:
|
|
1335
|
+
input_nodeids - List of DAG nodeids, input teradataml DataFrames for the set operation.
|
|
1336
|
+
setop_type - Type of set operation to perform on two tables.
|
|
1337
|
+
Valid values for setop_type: {union, unionall, minus, intersect}
|
|
1338
|
+
input_table_columns - List of strings which contain comma seperated list of input teradataml DataFrame columns.
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
EXAMPLES:
|
|
1342
|
+
aed_table1_nodeid = AedObj._aed_table("dbname.tablename1")
|
|
1343
|
+
aed_table2_nodeid = AedObj._aed_table("dbname.tablename2")
|
|
1344
|
+
aed_setop_nodeid = self.aed_obj._aed_setop([aed_table1_nodeid, aed_table2_nodeid],
|
|
1345
|
+
"union", ["col1, col2", "col1, col2"])
|
|
1346
|
+
|
|
1347
|
+
RETURNS:
|
|
1348
|
+
A node id in DAG - AED setop API.
|
|
1349
|
+
|
|
1350
|
+
RAISES:
|
|
1351
|
+
teradataml exceptions:
|
|
1352
|
+
AED_SETOP_INPUT_TABLE_COLUMNS_COUNT_MISMATCH, AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1353
|
+
"""
|
|
1354
|
+
if not isinstance(input_nodeids, list) or not all(isinstance(nodeid, str) for nodeid in input_nodeids):
|
|
1355
|
+
msg = Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, "input_nodeids", "list containing strings")
|
|
1356
|
+
raise TypeError(msg, MessageCodes.UNSUPPORTED_DATATYPE)
|
|
1357
|
+
|
|
1358
|
+
if not isinstance(input_table_columns, list) or not all(isinstance(columns, str) for columns in input_table_columns):
|
|
1359
|
+
msg = Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, "input_table_columns", "list containing strings")
|
|
1360
|
+
raise TypeError(msg, MessageCodes.UNSUPPORTED_DATATYPE)
|
|
1361
|
+
|
|
1362
|
+
# number of input nodes
|
|
1363
|
+
num_inputs = len(input_nodeids)
|
|
1364
|
+
# Validate if number of input_nodeids is more than one
|
|
1365
|
+
if num_inputs < 2:
|
|
1366
|
+
msg = Messages.get_message(MessageCodes.AED_SETOP_INVALID_NUMBER_OF_INPUT_NODES, "(aed_setop)")
|
|
1367
|
+
raise TeradataMlException(msg, MessageCodes.AED_SETOP_INVALID_NUMBER_OF_INPUT_NODES)
|
|
1368
|
+
# Validate if length of input_table_columns is equal to number of input nodes
|
|
1369
|
+
if num_inputs != len(input_table_columns):
|
|
1370
|
+
raise TeradataMlException(
|
|
1371
|
+
Messages.get_message(MessageCodes.AED_SETOP_INPUT_TABLE_COLUMNS_COUNT_MISMATCH, "(aed_setop)"),
|
|
1372
|
+
MessageCodes.AED_SETOP_INPUT_TABLE_COLUMNS_COUNT_MISMATCH)
|
|
1373
|
+
|
|
1374
|
+
# Specify the argument types
|
|
1375
|
+
self.aed_context.ele_common_lib.aed_setop.argtypes =[POINTER(c_char_p),
|
|
1376
|
+
POINTER(c_char_p),
|
|
1377
|
+
POINTER(c_char_p),
|
|
1378
|
+
POINTER(c_char_p),
|
|
1379
|
+
POINTER(c_char_p),
|
|
1380
|
+
POINTER(c_int),
|
|
1381
|
+
POINTER(c_char_p),
|
|
1382
|
+
POINTER(c_int)
|
|
1383
|
+
]
|
|
1384
|
+
arg_name = [setop_type]
|
|
1385
|
+
arg_value = input_table_columns
|
|
1386
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="setop_", use_default_database=True, quote=False)
|
|
1387
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1388
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1389
|
+
# Output nodeid
|
|
1390
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1391
|
+
# return code
|
|
1392
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1393
|
+
try:
|
|
1394
|
+
# *** AED request to select columns
|
|
1395
|
+
self.aed_context.ele_common_lib.aed_setop(self.aed_context._arr_c(input_nodeids),
|
|
1396
|
+
self.aed_context._arr_c(arg_name),
|
|
1397
|
+
self.aed_context._arr_c(arg_value),
|
|
1398
|
+
self.aed_context._arr_c(output_table),
|
|
1399
|
+
self.aed_context._arr_c(output_schema),
|
|
1400
|
+
self.aed_context._int_array1(num_inputs),
|
|
1401
|
+
nodeid_out,
|
|
1402
|
+
ret_code)
|
|
1403
|
+
except Exception as emsg:
|
|
1404
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_setop)" + str(emsg)),
|
|
1405
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1406
|
+
|
|
1407
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1408
|
+
|
|
1409
|
+
def _aed_show_query_length(self, nodeid, include_all_queries = False, query_with_reference_to_top = False, query_count = None):
|
|
1410
|
+
"""
|
|
1411
|
+
This wrapper function facilitates a integration of the 'aed_show_query_length'
|
|
1412
|
+
C++ function, in AED library, with Python tdml library.
|
|
1413
|
+
|
|
1414
|
+
This is an internal function to get the length of the full SQL query/queries for
|
|
1415
|
+
a DAG node representing the teradataml DataFrames and operations on them; no data
|
|
1416
|
+
is moved. This call precedes the _aed_show_query call so that the developer can
|
|
1417
|
+
obtain the proper amount of storage space.
|
|
1418
|
+
|
|
1419
|
+
PARAMETERS:
|
|
1420
|
+
nodeid:
|
|
1421
|
+
Required Argument.
|
|
1422
|
+
Specifies a DAG node for which the length of the generated SQL query/queries
|
|
1423
|
+
is to be returned.
|
|
1424
|
+
Types: str
|
|
1425
|
+
|
|
1426
|
+
include_all_queries:
|
|
1427
|
+
Optional Argument.
|
|
1428
|
+
Specifies a boolean indicating whether to return length of individual queries or not.
|
|
1429
|
+
True, if length of the individual queries is required otherwise False.
|
|
1430
|
+
Default Value: False
|
|
1431
|
+
Types: bool
|
|
1432
|
+
|
|
1433
|
+
query_with_reference_to_top:
|
|
1434
|
+
Optional Argument.
|
|
1435
|
+
Specifies a boolean flag indicating whether queries needs to be returned with reference
|
|
1436
|
+
to the top node in AED, i.e., a teradataml DataFrame created from table or query.
|
|
1437
|
+
Default Value: False
|
|
1438
|
+
Types: bool
|
|
1439
|
+
|
|
1440
|
+
query_count:
|
|
1441
|
+
Optional Argument.
|
|
1442
|
+
Specifies the number of queries returned for the given nodeid.
|
|
1443
|
+
Default Value: None
|
|
1444
|
+
Types: int
|
|
1445
|
+
|
|
1446
|
+
EXAMPLES:
|
|
1447
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1448
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1449
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
1450
|
+
query_lengths = AedObj._aed_show_query_length(aed_filter_nodeid, include_all_queries = True, query_count = 1)
|
|
1451
|
+
|
|
1452
|
+
RETURNS:
|
|
1453
|
+
The resolved SQL query/queries length/s.
|
|
1454
|
+
|
|
1455
|
+
RAISES:
|
|
1456
|
+
teradataml exceptions:
|
|
1457
|
+
AED_EXEC_FAILED, AED_NON_ZERO_STATUS,
|
|
1458
|
+
AED_SHOW_QUERY_MULTIPLE_OPTIONS and AED_QUERY_COUNT_MISMATCH
|
|
1459
|
+
"""
|
|
1460
|
+
|
|
1461
|
+
self.aed_context.ele_common_lib.aed_show_query_length.argtypes = [POINTER(c_char_p),
|
|
1462
|
+
POINTER(c_int),
|
|
1463
|
+
POINTER(c_int),
|
|
1464
|
+
POINTER(c_int)
|
|
1465
|
+
]
|
|
1466
|
+
if include_all_queries and query_with_reference_to_top:
|
|
1467
|
+
raise TeradataMlException(
|
|
1468
|
+
Messages.get_message(MessageCodes.AED_SHOW_QUERY_MULTIPLE_OPTIONS,
|
|
1469
|
+
"(_aed_show_query_length)","include_all_queries", "query_with_reference_to_top"),
|
|
1470
|
+
MessageCodes.AED_SHOW_QUERY_MULTIPLE_OPTIONS)
|
|
1471
|
+
|
|
1472
|
+
if not include_all_queries and not query_with_reference_to_top:
|
|
1473
|
+
# If both arguments are False then going with default option
|
|
1474
|
+
option = 1
|
|
1475
|
+
# Directly assgining 1, as only 1 query will be returned for
|
|
1476
|
+
# default option
|
|
1477
|
+
query_count_verify = 1
|
|
1478
|
+
elif include_all_queries:
|
|
1479
|
+
# If only include_all_queries is True
|
|
1480
|
+
option = 2
|
|
1481
|
+
# Making call to _aed_gen_full_dagpath to get number of
|
|
1482
|
+
# queries for nodeid, as it gives number of nodes in the
|
|
1483
|
+
# DAG path and hence the number of queries for include_all
|
|
1484
|
+
# _queries option
|
|
1485
|
+
query_count_verify = self._aed_gen_full_dagpath(nodeid)
|
|
1486
|
+
elif query_with_reference_to_top:
|
|
1487
|
+
option = 3
|
|
1488
|
+
# Making call to _aed_gen_queries_with_reference_to_topnode to
|
|
1489
|
+
# get number of queries for nodeid, as it generates queries
|
|
1490
|
+
# with respect to base table/query nodes.
|
|
1491
|
+
query_count_verify = self._aed_gen_queries_with_reference_to_topnode(nodeid)
|
|
1492
|
+
|
|
1493
|
+
# Let's validate the provided queries count.
|
|
1494
|
+
if query_count is not None and query_count != query_count_verify:
|
|
1495
|
+
# If provided and does not match with the actual one, raise exception.
|
|
1496
|
+
raise TeradataMlException(
|
|
1497
|
+
Messages.get_message(MessageCodes.AED_QUERY_COUNT_MISMATCH, "(_aed_show_query_length)"),
|
|
1498
|
+
MessageCodes.AED_QUERY_COUNT_MISMATCH)
|
|
1499
|
+
else:
|
|
1500
|
+
query_count = query_count_verify
|
|
1501
|
+
int_array_n = c_int * query_count
|
|
1502
|
+
query_sizes = int_array_n(0)
|
|
1503
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1504
|
+
|
|
1505
|
+
try:
|
|
1506
|
+
# *** AED request to get show query size
|
|
1507
|
+
self.aed_context.ele_common_lib.aed_show_query_length(self.aed_context._arr_c([nodeid]),
|
|
1508
|
+
c_int(option), query_sizes, ret_code)
|
|
1509
|
+
except Exception as emsg:
|
|
1510
|
+
raise TeradataMlException(
|
|
1511
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(_aed_show_query_length)" + str(emsg)),
|
|
1512
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1513
|
+
|
|
1514
|
+
query_sizes = [qry_size for qry_size in query_sizes]
|
|
1515
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], query_sizes)
|
|
1516
|
+
|
|
1517
|
+
def _aed_show_query(self, nodeid, include_all_queries = False, query_with_reference_to_top = False, query_count = None, show_query_len = None):
|
|
1518
|
+
"""
|
|
1519
|
+
This wrapper function facilitates a integration of the 'aed_show_query'
|
|
1520
|
+
C++ function, in AED library, with Python tdml library.
|
|
1521
|
+
|
|
1522
|
+
This is an internal function to get the full SQL query for a DAG node
|
|
1523
|
+
representing the teradataml DataFrames and operations on them; no data is moved.
|
|
1524
|
+
|
|
1525
|
+
PARAMETERS:
|
|
1526
|
+
nodeid:
|
|
1527
|
+
Required Argument.
|
|
1528
|
+
Specifies a DAG node for which the SQL query is to be returned.
|
|
1529
|
+
Types: str
|
|
1530
|
+
|
|
1531
|
+
include_all_queries:
|
|
1532
|
+
Optional Argument.
|
|
1533
|
+
Specifies a boolean indicating whether to return length of individual queries or not.
|
|
1534
|
+
True, if length of the individual queries is required otherwise False.
|
|
1535
|
+
Default Value: False
|
|
1536
|
+
Types: bool
|
|
1537
|
+
|
|
1538
|
+
query_with_reference_to_top:
|
|
1539
|
+
Optional Argument.
|
|
1540
|
+
Specifies a boolean flag indicating whether queries needs to be returned with reference
|
|
1541
|
+
to the top node in AED, i.e., a teradataml DataFrame created from table or query.
|
|
1542
|
+
Default Value: False
|
|
1543
|
+
Types: bool
|
|
1544
|
+
|
|
1545
|
+
query_count:
|
|
1546
|
+
Optional Argument.
|
|
1547
|
+
Specifies the number of queries returned for the given nodeid.
|
|
1548
|
+
Default Value: None
|
|
1549
|
+
Types: int
|
|
1550
|
+
|
|
1551
|
+
show_query_len:
|
|
1552
|
+
Optional Argument.
|
|
1553
|
+
Specifies the lengths of queries for the given nodeid.
|
|
1554
|
+
Default Value: None
|
|
1555
|
+
Types: list of ints.
|
|
1556
|
+
|
|
1557
|
+
EXAMPLES:
|
|
1558
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1559
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1560
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
1561
|
+
query = AedObj._aed_show_query(aed_filter_nodeid, include_all_queries = True, query_count = 1, show_query_len = [54])
|
|
1562
|
+
|
|
1563
|
+
RETURNS:
|
|
1564
|
+
A list containing list of resolved SQL query/queries and list of
|
|
1565
|
+
nodeids.
|
|
1566
|
+
List of nodeids within the final list contains 0 if option chosen
|
|
1567
|
+
for aed_show_query is not include_all_queries option.
|
|
1568
|
+
|
|
1569
|
+
RAISES:
|
|
1570
|
+
teradataml exceptions:
|
|
1571
|
+
AED_EXEC_FAILED, AED_NON_ZERO_STATUS, AED_NODE_QUERY_LENGTH_MISMATCH
|
|
1572
|
+
AED_SHOW_QUERY_MULTIPLE_OPTIONS and AED_QUERY_COUNT_MISMATCH
|
|
1573
|
+
"""
|
|
1574
|
+
# Specify the argument types
|
|
1575
|
+
self.aed_context.ele_common_lib.aed_show_query.argtypes = [POINTER(c_char_p),
|
|
1576
|
+
POINTER(c_int),
|
|
1577
|
+
POINTER(c_char_p),
|
|
1578
|
+
POINTER(c_char_p),
|
|
1579
|
+
POINTER(c_int)
|
|
1580
|
+
]
|
|
1581
|
+
|
|
1582
|
+
if include_all_queries and query_with_reference_to_top:
|
|
1583
|
+
raise TeradataMlException(
|
|
1584
|
+
Messages.get_message(MessageCodes.AED_SHOW_QUERY_MULTIPLE_OPTIONS, "(_aed_show_query)",
|
|
1585
|
+
"include_all_queries", "query_with_reference_to_top"),
|
|
1586
|
+
MessageCodes.AED_SHOW_QUERY_MULTIPLE_OPTIONS)
|
|
1587
|
+
|
|
1588
|
+
# Validate the provided exec query length.
|
|
1589
|
+
if show_query_len is not None:
|
|
1590
|
+
if not isinstance(show_query_len, list) or not all(isinstance(size, int) for size in show_query_len):
|
|
1591
|
+
raise TypeError("AED Internal Error: 'show_query_len' should be of type list containing integers.")
|
|
1592
|
+
|
|
1593
|
+
if not include_all_queries and not query_with_reference_to_top:
|
|
1594
|
+
# If both arguments are False then going with default option
|
|
1595
|
+
option = 1
|
|
1596
|
+
# Directly assgining 1, as only 1 query will be returned for
|
|
1597
|
+
# default option
|
|
1598
|
+
query_count_verify = 1
|
|
1599
|
+
elif include_all_queries:
|
|
1600
|
+
# If only include_all_queries is True
|
|
1601
|
+
option = 2
|
|
1602
|
+
# Making call to _aed_gen_full_dagpath to get number of
|
|
1603
|
+
# queries for nodeid, as it gives number of nodes in the
|
|
1604
|
+
# DAG path and hence the number of queries for include_all
|
|
1605
|
+
# _queries option
|
|
1606
|
+
query_count_verify = self._aed_gen_full_dagpath(nodeid)
|
|
1607
|
+
elif query_with_reference_to_top:
|
|
1608
|
+
# If only query_with_reference_to_top is True
|
|
1609
|
+
option = 3
|
|
1610
|
+
# Making call to _aed_gen_queries_with_reference_to_topnode to
|
|
1611
|
+
# get number of queries for nodeid, as it generates quereis
|
|
1612
|
+
# with respect to base table/query nodes.
|
|
1613
|
+
query_count_verify = self._aed_gen_queries_with_reference_to_topnode(nodeid)
|
|
1614
|
+
|
|
1615
|
+
# Let's validate the provided queries count.
|
|
1616
|
+
if query_count is not None and query_count != query_count_verify:
|
|
1617
|
+
# If provided and does not match with the actual one, raise exception.
|
|
1618
|
+
raise TeradataMlException(
|
|
1619
|
+
Messages.get_message(MessageCodes.AED_QUERY_COUNT_MISMATCH, "(_aed_show_query)"),
|
|
1620
|
+
MessageCodes.AED_QUERY_COUNT_MISMATCH)
|
|
1621
|
+
else:
|
|
1622
|
+
query_count = query_count_verify
|
|
1623
|
+
|
|
1624
|
+
show_query_len_verify = self._aed_show_query_length(nodeid, include_all_queries = include_all_queries, query_with_reference_to_top = query_with_reference_to_top, query_count = query_count)
|
|
1625
|
+
|
|
1626
|
+
# Let's validate the provided show_query_len.
|
|
1627
|
+
if show_query_len is not None and show_query_len != show_query_len_verify:
|
|
1628
|
+
# If provided and does not match with the actual one, raise exception.
|
|
1629
|
+
raise TeradataMlException(
|
|
1630
|
+
Messages.get_message(MessageCodes.AED_NODE_QUERY_LENGTH_MISMATCH, "(_aed_show_query)"
|
|
1631
|
+
+ str(show_query_len) + " and " + str(show_query_len_verify)),
|
|
1632
|
+
MessageCodes.AED_NODE_QUERY_LENGTH_MISMATCH)
|
|
1633
|
+
else:
|
|
1634
|
+
show_query_len = show_query_len_verify
|
|
1635
|
+
|
|
1636
|
+
# show_query_len contains a list of integers, for all the queries generated for given nodeid.
|
|
1637
|
+
# Accordingly, let's construct a query buffer.
|
|
1638
|
+
query_buffer = []
|
|
1639
|
+
for index in range(len(show_query_len)):
|
|
1640
|
+
query_buffer.append(" " * show_query_len[index])
|
|
1641
|
+
query_buffer = self.aed_context._arr_c(query_buffer)
|
|
1642
|
+
|
|
1643
|
+
# Let's construct a nodeid buffer for option-2 i.e.
|
|
1644
|
+
# include_all_queries to match nodeids with the dataframes.
|
|
1645
|
+
node_id_buffer = self.aed_context._arr_c(["00000000000000000000"] * query_count)
|
|
1646
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1647
|
+
|
|
1648
|
+
try:
|
|
1649
|
+
# *** AED request to get show_queries
|
|
1650
|
+
self.aed_context.ele_common_lib.aed_show_query(self.aed_context._arr_c([nodeid]),c_int(option),query_buffer,node_id_buffer,ret_code)
|
|
1651
|
+
# Decode UTF-8 strings
|
|
1652
|
+
query_buffer_out = self.aed_context._decode_list(query_buffer)
|
|
1653
|
+
del query_buffer
|
|
1654
|
+
node_id_out = self.aed_context._decode_list(node_id_buffer)
|
|
1655
|
+
del node_id_buffer
|
|
1656
|
+
|
|
1657
|
+
except Exception as emsg:
|
|
1658
|
+
raise TeradataMlException(
|
|
1659
|
+
Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_show_query)" + str(emsg)),
|
|
1660
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1661
|
+
|
|
1662
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], [query_buffer_out, node_id_out])
|
|
1663
|
+
|
|
1664
|
+
def _aed_groupby_time(self, nodeid, timebucket_duration, value_expression = '', using_timecode = '', seqno_col = '', fill = ''):
|
|
1665
|
+
"""
|
|
1666
|
+
This wrapper function facilitates integration with 'aed_groupby_time',
|
|
1667
|
+
a C++ function in the AED library with teradataml library.
|
|
1668
|
+
|
|
1669
|
+
This function must be called to specify group by time clause parameters on teradataml DataFrames
|
|
1670
|
+
so that time series aggregate functions can be called on top of aed_groupby_time node.
|
|
1671
|
+
|
|
1672
|
+
PARAMETERS:
|
|
1673
|
+
nodeid:
|
|
1674
|
+
A DAG node, an input to the aed_groupby_time API.
|
|
1675
|
+
|
|
1676
|
+
timebucket_duration:
|
|
1677
|
+
Specifies the duration of each timebucket for aggregation and is used to
|
|
1678
|
+
assign each potential timebucket a unique number.
|
|
1679
|
+
Example: MINUTES(23) which is equal to 23 Minutes
|
|
1680
|
+
CAL_MONTHS(5) which is equal to 5 calender months
|
|
1681
|
+
|
|
1682
|
+
value_expression:
|
|
1683
|
+
The value_expression is a column or any expression involving columns (except for scalar subqueries).
|
|
1684
|
+
These expressions are used for grouping purposes not related to time.
|
|
1685
|
+
Example: col1
|
|
1686
|
+
|
|
1687
|
+
using_timecode:
|
|
1688
|
+
A column expression (with an optional table name) that serves as the timecode for a non-PTI table.
|
|
1689
|
+
TD_TIMECODE is used implicitly for PTI tables but can also be specified explicitly by the user
|
|
1690
|
+
with this parameter.
|
|
1691
|
+
|
|
1692
|
+
seqno_col:
|
|
1693
|
+
A column expression (with an optional table name) that is the sequence number. For a PTI
|
|
1694
|
+
table, it can be TD_SEQNO or any other column that acts as a sequence number. For a non-
|
|
1695
|
+
PTI table, seqno_col is a column that plays the role of TD_SEQNO (because non-PTI tables
|
|
1696
|
+
do not have TD_SEQNO).
|
|
1697
|
+
|
|
1698
|
+
fill:
|
|
1699
|
+
This clause allows you to provide values for missing timebucket values.
|
|
1700
|
+
Possible values: NULLS, PREV / PREVIOUS, NEXT, and any numeric_constant
|
|
1701
|
+
|
|
1702
|
+
EXAMPLES:
|
|
1703
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1704
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1705
|
+
aed_groupby_nodeid = AedObj._aed_groupby_time(aed_select_nodeid, "MINUTES(23)", "col1", "col2", "col3", "NULLS")
|
|
1706
|
+
|
|
1707
|
+
RETURNS:
|
|
1708
|
+
A node id in DAG - AED group_by_time API.
|
|
1709
|
+
|
|
1710
|
+
RAISES:
|
|
1711
|
+
TeradataMlException:
|
|
1712
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1713
|
+
"""
|
|
1714
|
+
# Specify the argument types
|
|
1715
|
+
self.aed_context.ele_common_lib.aed_groupby_time.argtypes =[POINTER(c_char_p),
|
|
1716
|
+
POINTER(c_char_p),
|
|
1717
|
+
POINTER(c_char_p),
|
|
1718
|
+
POINTER(c_char_p),
|
|
1719
|
+
POINTER(c_char_p),
|
|
1720
|
+
POINTER(c_char_p),
|
|
1721
|
+
POINTER(c_int)
|
|
1722
|
+
]
|
|
1723
|
+
|
|
1724
|
+
arg_name = ["timebucket duration", "value expression", "using_timecode", "seqno_col", "fill"]
|
|
1725
|
+
arg_value = [timebucket_duration, value_expression, using_timecode, seqno_col, fill]
|
|
1726
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(prefix="groupbytime_", use_default_database=True, quote=False)
|
|
1727
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1728
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1729
|
+
|
|
1730
|
+
# Output nodeid
|
|
1731
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1732
|
+
|
|
1733
|
+
# return code
|
|
1734
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1735
|
+
try:
|
|
1736
|
+
# *** AED request to group by
|
|
1737
|
+
self.aed_context.ele_common_lib.aed_groupby_time(self.aed_context._arr_c([nodeid]),
|
|
1738
|
+
self.aed_context._arr_c(arg_name),
|
|
1739
|
+
self.aed_context._arr_c(arg_value),
|
|
1740
|
+
self.aed_context._arr_c(output_table),
|
|
1741
|
+
self.aed_context._arr_c(output_schema),
|
|
1742
|
+
nodeid_out,
|
|
1743
|
+
ret_code)
|
|
1744
|
+
except Exception as emsg:
|
|
1745
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_groupby_time)" + str(emsg)),
|
|
1746
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1747
|
+
|
|
1748
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1749
|
+
|
|
1750
|
+
def _aed_sample(self, nodeid, columns_expr, fracs = [], replace = False, randomize = False, case_when_then = {}, case_else = []):
|
|
1751
|
+
"""
|
|
1752
|
+
This wrapper function facilitates a integration with 'aed_sample',
|
|
1753
|
+
a C++ function, in AED library, with Python teradataml library.
|
|
1754
|
+
|
|
1755
|
+
This function must be called when a sample operation is to be performed,
|
|
1756
|
+
i.e. some rows are to be sampled from a teradataml DataFrame.
|
|
1757
|
+
|
|
1758
|
+
PARAMETERS:
|
|
1759
|
+
nodeid - A DAG node, an input to the sample API.
|
|
1760
|
+
columns_expr - Columns, to be selected from the DataFrame.
|
|
1761
|
+
Columns should be specified as comma seperated string.
|
|
1762
|
+
fracs - This is the list of number of rows or percentage of rows
|
|
1763
|
+
in each sample.
|
|
1764
|
+
Example:
|
|
1765
|
+
[0.5, 0.2, 0.1] - List of percentage of rows in each sample.
|
|
1766
|
+
[10, 25, 30] - List of number of rows in each sample.
|
|
1767
|
+
replace - Specifies if replacement is required or not.
|
|
1768
|
+
Boolean parameter defaults to False.
|
|
1769
|
+
randomize - Specifies if randomization is required or not.
|
|
1770
|
+
Boolean parameter defaults to False.
|
|
1771
|
+
case_when_then - Dictionary specifying when_conditions as key and then_sample
|
|
1772
|
+
numbers as values.
|
|
1773
|
+
Example:
|
|
1774
|
+
case_when_then = {"state = 'WI'": [0.25, 0.5],
|
|
1775
|
+
"state = 'CA'": 10,
|
|
1776
|
+
"state = 'NY'": [0.25, 0.25]}
|
|
1777
|
+
For above case_when_then, corresponding SQL query will be:
|
|
1778
|
+
'SELECT city, state, SAMPLEID
|
|
1779
|
+
FROM stores
|
|
1780
|
+
SAMPLE RANDOMIZED ALLOCATION
|
|
1781
|
+
WHEN state = 'WI' THEN 0.25, 0.5
|
|
1782
|
+
WHEN state = 'CA' THEN 10
|
|
1783
|
+
WHEN state = 'NY' THEN 0.25, 0.25
|
|
1784
|
+
ELSE 10
|
|
1785
|
+
END.'
|
|
1786
|
+
|
|
1787
|
+
case_else - List specifying number of samples to be sampled when
|
|
1788
|
+
none of the conditions in key(when_conditions) of
|
|
1789
|
+
case_when_then are met.
|
|
1790
|
+
For above query case_else will be like
|
|
1791
|
+
case_else = [10]
|
|
1792
|
+
|
|
1793
|
+
EXAMPLES:
|
|
1794
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1795
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1796
|
+
aed_sample_nodeid = AedObj._aed_sample(aed_select_nodeid, "col1,col3",
|
|
1797
|
+
"100,50,70", True, False)
|
|
1798
|
+
|
|
1799
|
+
aed_sample_nodeid = AedObj._aed_sample(aed_select_nodeid, columns_expr =
|
|
1800
|
+
"col1,col3", replace = True, randomize = False,
|
|
1801
|
+
case_when_then = {"'col1<250'&&'col2<300'": [10, 20],
|
|
1802
|
+
"col1>250": 0.5, "col3>col1": [0.5, 0.1], "col1<col2": 10},
|
|
1803
|
+
case_else = [0.5, 0.2])
|
|
1804
|
+
|
|
1805
|
+
aed_sample_nodeid = AedObj._aed_sample(aed_select_nodeid, columns_expr =
|
|
1806
|
+
"col1,col3", replace = True, randomize = False,
|
|
1807
|
+
case_when_then = {"'col1<250'&&'col2<300'": [10, 20],
|
|
1808
|
+
"col1>250": 0.5, "col3>col1": [0.5, 0.1]})
|
|
1809
|
+
|
|
1810
|
+
RETURNS:
|
|
1811
|
+
A node id in DAG - an input to AED sample API.
|
|
1812
|
+
|
|
1813
|
+
RAISES:
|
|
1814
|
+
TeradataMLException:
|
|
1815
|
+
AED_EXEC_FAILED,
|
|
1816
|
+
AED_NON_ZERO_STATUS
|
|
1817
|
+
"""
|
|
1818
|
+
# Specify the argument types
|
|
1819
|
+
self.aed_context.ele_common_lib.aed_sample.argtypes =[POINTER(c_char_p),
|
|
1820
|
+
POINTER(c_char_p),
|
|
1821
|
+
POINTER(c_char_p),
|
|
1822
|
+
POINTER(c_char_p),
|
|
1823
|
+
POINTER(c_char_p),
|
|
1824
|
+
POINTER(c_char_p),
|
|
1825
|
+
POINTER(c_char_p),
|
|
1826
|
+
POINTER(c_char_p),
|
|
1827
|
+
POINTER(c_int),
|
|
1828
|
+
POINTER(c_int)
|
|
1829
|
+
]
|
|
1830
|
+
|
|
1831
|
+
replace = 'Y' if replace else 'N'
|
|
1832
|
+
randomize = 'Y' if randomize else 'N'
|
|
1833
|
+
|
|
1834
|
+
when_list = []
|
|
1835
|
+
then_list = []
|
|
1836
|
+
for when_condition, then_sample_number in case_when_then.items():
|
|
1837
|
+
when_list.append(when_condition)
|
|
1838
|
+
then_list.append(then_sample_number)
|
|
1839
|
+
|
|
1840
|
+
# when_list should be list containing strings
|
|
1841
|
+
if not all(isinstance(item, str) for item in when_list):
|
|
1842
|
+
raise TypeError(
|
|
1843
|
+
Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, "Keys in case_when_then",
|
|
1844
|
+
"'Strings'"), MessageCodes.UNSUPPORTED_DATATYPE)
|
|
1845
|
+
|
|
1846
|
+
fracs_expr = ",".join(map(str, fracs))
|
|
1847
|
+
then_list_expr = []
|
|
1848
|
+
for item in then_list:
|
|
1849
|
+
if (isinstance(item, list)):
|
|
1850
|
+
then_list_expr.append(",".join(map(str, item)))
|
|
1851
|
+
else:
|
|
1852
|
+
then_list_expr.append(str(item))
|
|
1853
|
+
case_else_expr = ",".join(map(str, case_else))
|
|
1854
|
+
|
|
1855
|
+
arg_name = ["projection", "replace", "randomize", "fracs_expr", "case_else"]
|
|
1856
|
+
arg_value = [columns_expr, replace, randomize, fracs_expr, case_else_expr]
|
|
1857
|
+
temp_table_name = UtilFuncs._generate_temp_table_name(
|
|
1858
|
+
prefix="sample_", use_default_database=True, quote=False, table_type=TeradataConstants.TERADATA_TABLE)
|
|
1859
|
+
output_table = [UtilFuncs._extract_table_name(temp_table_name)]
|
|
1860
|
+
output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
|
|
1861
|
+
|
|
1862
|
+
#Length of when list
|
|
1863
|
+
length_of_cond_list = self.aed_context._int_array1(len(when_list))
|
|
1864
|
+
|
|
1865
|
+
# Output nodeid
|
|
1866
|
+
nodeid_out = self.aed_context._arr_c(["00000000000000000000"])
|
|
1867
|
+
|
|
1868
|
+
# return code
|
|
1869
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1870
|
+
try:
|
|
1871
|
+
# *** AED request to sample
|
|
1872
|
+
self.aed_context.ele_common_lib.aed_sample(self.aed_context._arr_c([nodeid]),
|
|
1873
|
+
self.aed_context._arr_c(arg_name),
|
|
1874
|
+
self.aed_context._arr_c(arg_value),
|
|
1875
|
+
self.aed_context._arr_c(output_table),
|
|
1876
|
+
self.aed_context._arr_c(output_schema),
|
|
1877
|
+
nodeid_out,
|
|
1878
|
+
self.aed_context._arr_c(when_list),
|
|
1879
|
+
self.aed_context._arr_c(then_list_expr),
|
|
1880
|
+
length_of_cond_list,
|
|
1881
|
+
ret_code)
|
|
1882
|
+
except Exception as emsg:
|
|
1883
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_sample)" + str(emsg)),
|
|
1884
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1885
|
+
|
|
1886
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodeid_out[0].decode("utf-8"))
|
|
1887
|
+
|
|
1888
|
+
def _aed_gen_full_dagpath(self, nodeid):
|
|
1889
|
+
"""
|
|
1890
|
+
This wrapper function facilitates integration with 'aed_gen_full_dagpath',
|
|
1891
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1892
|
+
|
|
1893
|
+
This function must be called with DAG node id, when a complete DAG
|
|
1894
|
+
path for the node is to be generated.
|
|
1895
|
+
Most of the times, this api is called when user uses include_all_queries
|
|
1896
|
+
option to get queries, nodeid of each node in the dag path till the base or
|
|
1897
|
+
parent node.
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
PARAMETERS:
|
|
1901
|
+
nodeid:
|
|
1902
|
+
Required Argument.
|
|
1903
|
+
Specifies a DAG node id for which DAG path needs to be genertaed.
|
|
1904
|
+
Types: str
|
|
1905
|
+
|
|
1906
|
+
EXAMPLES:
|
|
1907
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1908
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1909
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
1910
|
+
num_nodes = AedObj._aed_gen_full_dagpath(aed_filter_nodeid)
|
|
1911
|
+
|
|
1912
|
+
RETURNS:
|
|
1913
|
+
Number of DAG nodes involved in the DAG path for the provided node ID.
|
|
1914
|
+
|
|
1915
|
+
RAISES:
|
|
1916
|
+
teradataml exceptions:
|
|
1917
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1918
|
+
"""
|
|
1919
|
+
# Specify the argument types
|
|
1920
|
+
self.aed_context.ele_common_lib.aed_gen_full_dagpath.argtypes = [POINTER(c_char_p),
|
|
1921
|
+
POINTER(c_int),
|
|
1922
|
+
POINTER(c_int)
|
|
1923
|
+
]
|
|
1924
|
+
|
|
1925
|
+
dag_node_count = self.aed_context._int_array1(0)
|
|
1926
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1927
|
+
|
|
1928
|
+
try:
|
|
1929
|
+
# *** AED request to generate full DAG path
|
|
1930
|
+
self.aed_context.ele_common_lib.aed_gen_full_dagpath(self.aed_context._arr_c([nodeid]),
|
|
1931
|
+
dag_node_count, ret_code)
|
|
1932
|
+
except Exception as emsg:
|
|
1933
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_gen_full_dagpath)" + str(emsg)),
|
|
1934
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1935
|
+
|
|
1936
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], dag_node_count[0])
|
|
1937
|
+
|
|
1938
|
+
def _aed_gen_queries_with_reference_to_topnode(self, nodeid):
|
|
1939
|
+
"""
|
|
1940
|
+
This wrapper function facilitates integration with 'aed_gen_exec_queries_with_reference_to_topnode',
|
|
1941
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1942
|
+
|
|
1943
|
+
This function must be called with DAG node id, when user wants to
|
|
1944
|
+
generate queries with reference to the top most node.
|
|
1945
|
+
|
|
1946
|
+
Most of the times, this api is called when user uses
|
|
1947
|
+
query_with_reference_to_top option in aed_show_query
|
|
1948
|
+
|
|
1949
|
+
|
|
1950
|
+
PARAMETERS:
|
|
1951
|
+
nodeid:
|
|
1952
|
+
Required Argument.
|
|
1953
|
+
Specifies a DAG node id for which DAG path needs to be genertaed.
|
|
1954
|
+
Types: str
|
|
1955
|
+
|
|
1956
|
+
EXAMPLES:
|
|
1957
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
1958
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
1959
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
1960
|
+
num_nodes = AedObj._aed_gen_queries_with_reference_to_topnode(aed_filter_nodeid)
|
|
1961
|
+
|
|
1962
|
+
RETURNS:
|
|
1963
|
+
Number of queries generated with reference to top node for given nodeid.
|
|
1964
|
+
|
|
1965
|
+
RAISES:
|
|
1966
|
+
teradataml exceptions:
|
|
1967
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
1968
|
+
"""
|
|
1969
|
+
# Specify the argument types
|
|
1970
|
+
self.aed_context.ele_common_lib.aed_gen_queries_with_reference_to_topnode.argtypes = [POINTER(c_char_p),
|
|
1971
|
+
POINTER(c_int),
|
|
1972
|
+
POINTER(c_int)
|
|
1973
|
+
]
|
|
1974
|
+
|
|
1975
|
+
queries_count = self.aed_context._int_array1(0)
|
|
1976
|
+
ret_code = self.aed_context._int_array1(0)
|
|
1977
|
+
|
|
1978
|
+
try:
|
|
1979
|
+
# *** AED request to generate queries with ref to top node
|
|
1980
|
+
self.aed_context.ele_common_lib.aed_gen_queries_with_reference_to_topnode(self.aed_context._arr_c([nodeid]), queries_count, ret_code)
|
|
1981
|
+
except Exception as emsg:
|
|
1982
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_gen_queries_with_reference_to_topnode)" + str(emsg)),
|
|
1983
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
1984
|
+
|
|
1985
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], queries_count[0])
|
|
1986
|
+
|
|
1987
|
+
def _aed_get_parent_node_count(self, nodeid):
|
|
1988
|
+
"""
|
|
1989
|
+
This wrapper function facilitates integration with 'aed_get_parent_node_count',
|
|
1990
|
+
a C++ function, in AED library, with Python tdml library.
|
|
1991
|
+
|
|
1992
|
+
This function must be called with DAG node id, to get number of parent nodes
|
|
1993
|
+
present for the given nodeid.
|
|
1994
|
+
Most of the times, user must call _aed_get_parent_nodeids, which will call
|
|
1995
|
+
this particular function too.
|
|
1996
|
+
|
|
1997
|
+
PARAMETERS:
|
|
1998
|
+
nodeid - A DAG node id for which number of parent nodes to be determined.
|
|
1999
|
+
|
|
2000
|
+
EXAMPLES:
|
|
2001
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
2002
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
2003
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
2004
|
+
num_nodes = AedObj._aed_get_parent_node_count(aed_filter_nodeid)
|
|
2005
|
+
|
|
2006
|
+
RETURNS:
|
|
2007
|
+
Number of parent nodes for the provided node ID.
|
|
2008
|
+
|
|
2009
|
+
RAISES:
|
|
2010
|
+
teradataml exceptions:
|
|
2011
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
2012
|
+
"""
|
|
2013
|
+
# Specify the argument types
|
|
2014
|
+
self.aed_context.ele_common_lib.aed_get_parent_nodes_count.argtypes = [POINTER(c_char_p),
|
|
2015
|
+
POINTER(c_int),
|
|
2016
|
+
POINTER(c_int)
|
|
2017
|
+
]
|
|
2018
|
+
nodes_count = self.aed_context._int_array1(0)
|
|
2019
|
+
ret_code = self.aed_context._int_array1(0)
|
|
2020
|
+
|
|
2021
|
+
try:
|
|
2022
|
+
# *** AED request to get number of parent nodes
|
|
2023
|
+
self.aed_context.ele_common_lib.aed_get_parent_nodes_count(
|
|
2024
|
+
self.aed_context._arr_c([nodeid]),
|
|
2025
|
+
nodes_count, ret_code)
|
|
2026
|
+
except Exception as emsg:
|
|
2027
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(_aed_get_parent_node_count)" + str(emsg)),
|
|
2028
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
2029
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], nodes_count[0])
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
def _aed_get_parent_nodeids(self, nodeid):
|
|
2033
|
+
"""
|
|
2034
|
+
This wrapper function facilitates integration with 'aed_get_parent_nodeids',
|
|
2035
|
+
a C++ function, in AED library, with Python tdml library.
|
|
2036
|
+
|
|
2037
|
+
This function must be called with DAG node id, to get parent nodeids
|
|
2038
|
+
for that node.
|
|
2039
|
+
|
|
2040
|
+
PARAMETERS:
|
|
2041
|
+
nodeid - A DAG node id for which parent nodeids are to be returned.
|
|
2042
|
+
|
|
2043
|
+
EXAMPLES:
|
|
2044
|
+
aed_table_nodeid = AedObj._aed_table("dbname.tablename")
|
|
2045
|
+
aed_select_nodeid = AedObj._aed_select(aed_table_nodeid, "col1, col2, col3")
|
|
2046
|
+
aed_filter_nodeid = AedObj._aed_filter(aed_select_nodeid, "col1 > col2")
|
|
2047
|
+
num_nodes = AedObj._aed_get_parent_nodeids(aed_filter_nodeid)
|
|
2048
|
+
|
|
2049
|
+
RETURNS:
|
|
2050
|
+
Parent nodeids for the provided node ID.
|
|
2051
|
+
|
|
2052
|
+
RAISES:
|
|
2053
|
+
teradataml exceptions:
|
|
2054
|
+
AED_EXEC_FAILED and AED_NON_ZERO_STATUS
|
|
2055
|
+
"""
|
|
2056
|
+
# Specify the argument types
|
|
2057
|
+
self.aed_context.ele_common_lib.aed_get_parent_nodeids.argtypes = [POINTER(c_char_p),
|
|
2058
|
+
POINTER(c_char_p),
|
|
2059
|
+
POINTER(c_int)
|
|
2060
|
+
]
|
|
2061
|
+
# Get number of parent nodes present to allocate enough memory
|
|
2062
|
+
number_of_parent_nodes = self._aed_get_parent_node_count(nodeid)
|
|
2063
|
+
parent_nodeids = self.aed_context._arr_c(["00000000000000000000"] * number_of_parent_nodes)
|
|
2064
|
+
ret_code = self.aed_context._int_array1(0)
|
|
2065
|
+
|
|
2066
|
+
try:
|
|
2067
|
+
# *** AED request to get parent nodeids
|
|
2068
|
+
self.aed_context.ele_common_lib.aed_get_parent_nodeids(
|
|
2069
|
+
self.aed_context._arr_c([nodeid]),
|
|
2070
|
+
parent_nodeids, ret_code)
|
|
2071
|
+
parent_nodeids_list = self.aed_context._decode_list(parent_nodeids)
|
|
2072
|
+
del parent_nodeids
|
|
2073
|
+
except Exception as emsg:
|
|
2074
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.AED_EXEC_FAILED, "(aed_get_parent_nodeids)" + str(emsg)),
|
|
2075
|
+
MessageCodes.AED_EXEC_FAILED)
|
|
2076
|
+
return self.aed_context._validate_aed_return_code(ret_code[0], parent_nodeids_list)
|
|
2077
|
+
|
|
2078
|
+
|