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.
Files changed (1208) hide show
  1. teradataml/LICENSE-3RD-PARTY.pdf +0 -0
  2. teradataml/LICENSE.pdf +0 -0
  3. teradataml/README.md +2762 -0
  4. teradataml/__init__.py +78 -0
  5. teradataml/_version.py +11 -0
  6. teradataml/analytics/Transformations.py +2996 -0
  7. teradataml/analytics/__init__.py +82 -0
  8. teradataml/analytics/analytic_function_executor.py +2416 -0
  9. teradataml/analytics/analytic_query_generator.py +1050 -0
  10. teradataml/analytics/byom/H2OPredict.py +514 -0
  11. teradataml/analytics/byom/PMMLPredict.py +437 -0
  12. teradataml/analytics/byom/__init__.py +16 -0
  13. teradataml/analytics/json_parser/__init__.py +133 -0
  14. teradataml/analytics/json_parser/analytic_functions_argument.py +1805 -0
  15. teradataml/analytics/json_parser/json_store.py +191 -0
  16. teradataml/analytics/json_parser/metadata.py +1666 -0
  17. teradataml/analytics/json_parser/utils.py +805 -0
  18. teradataml/analytics/meta_class.py +236 -0
  19. teradataml/analytics/sqle/DecisionTreePredict.py +456 -0
  20. teradataml/analytics/sqle/NaiveBayesPredict.py +420 -0
  21. teradataml/analytics/sqle/__init__.py +128 -0
  22. teradataml/analytics/sqle/json/decisiontreepredict_sqle.json +78 -0
  23. teradataml/analytics/sqle/json/naivebayespredict_sqle.json +62 -0
  24. teradataml/analytics/table_operator/__init__.py +11 -0
  25. teradataml/analytics/uaf/__init__.py +82 -0
  26. teradataml/analytics/utils.py +828 -0
  27. teradataml/analytics/valib.py +1617 -0
  28. teradataml/automl/__init__.py +5835 -0
  29. teradataml/automl/autodataprep/__init__.py +493 -0
  30. teradataml/automl/custom_json_utils.py +1625 -0
  31. teradataml/automl/data_preparation.py +1384 -0
  32. teradataml/automl/data_transformation.py +1254 -0
  33. teradataml/automl/feature_engineering.py +2273 -0
  34. teradataml/automl/feature_exploration.py +1873 -0
  35. teradataml/automl/model_evaluation.py +488 -0
  36. teradataml/automl/model_training.py +1407 -0
  37. teradataml/catalog/__init__.py +2 -0
  38. teradataml/catalog/byom.py +1759 -0
  39. teradataml/catalog/function_argument_mapper.py +859 -0
  40. teradataml/catalog/model_cataloging_utils.py +491 -0
  41. teradataml/clients/__init__.py +0 -0
  42. teradataml/clients/auth_client.py +137 -0
  43. teradataml/clients/keycloak_client.py +165 -0
  44. teradataml/clients/pkce_client.py +481 -0
  45. teradataml/common/__init__.py +1 -0
  46. teradataml/common/aed_utils.py +2078 -0
  47. teradataml/common/bulk_exposed_utils.py +113 -0
  48. teradataml/common/constants.py +1669 -0
  49. teradataml/common/deprecations.py +166 -0
  50. teradataml/common/exceptions.py +147 -0
  51. teradataml/common/formula.py +743 -0
  52. teradataml/common/garbagecollector.py +666 -0
  53. teradataml/common/logger.py +1261 -0
  54. teradataml/common/messagecodes.py +518 -0
  55. teradataml/common/messages.py +262 -0
  56. teradataml/common/pylogger.py +67 -0
  57. teradataml/common/sqlbundle.py +764 -0
  58. teradataml/common/td_coltype_code_to_tdtype.py +48 -0
  59. teradataml/common/utils.py +3166 -0
  60. teradataml/common/warnings.py +36 -0
  61. teradataml/common/wrapper_utils.py +625 -0
  62. teradataml/config/__init__.py +0 -0
  63. teradataml/config/dummy_file1.cfg +5 -0
  64. teradataml/config/dummy_file2.cfg +3 -0
  65. teradataml/config/sqlengine_alias_definitions_v1.0 +14 -0
  66. teradataml/config/sqlengine_alias_definitions_v1.1 +20 -0
  67. teradataml/config/sqlengine_alias_definitions_v1.3 +19 -0
  68. teradataml/context/__init__.py +0 -0
  69. teradataml/context/aed_context.py +223 -0
  70. teradataml/context/context.py +1462 -0
  71. teradataml/data/A_loan.csv +19 -0
  72. teradataml/data/BINARY_REALS_LEFT.csv +11 -0
  73. teradataml/data/BINARY_REALS_RIGHT.csv +11 -0
  74. teradataml/data/B_loan.csv +49 -0
  75. teradataml/data/BuoyData2.csv +17 -0
  76. teradataml/data/CONVOLVE2_COMPLEX_LEFT.csv +5 -0
  77. teradataml/data/CONVOLVE2_COMPLEX_RIGHT.csv +5 -0
  78. teradataml/data/Convolve2RealsLeft.csv +5 -0
  79. teradataml/data/Convolve2RealsRight.csv +5 -0
  80. teradataml/data/Convolve2ValidLeft.csv +11 -0
  81. teradataml/data/Convolve2ValidRight.csv +11 -0
  82. teradataml/data/DFFTConv_Real_8_8.csv +65 -0
  83. teradataml/data/Employee.csv +5 -0
  84. teradataml/data/Employee_Address.csv +4 -0
  85. teradataml/data/Employee_roles.csv +5 -0
  86. teradataml/data/JulesBelvezeDummyData.csv +100 -0
  87. teradataml/data/Mall_customer_data.csv +201 -0
  88. teradataml/data/Orders1_12mf.csv +25 -0
  89. teradataml/data/Pi_loan.csv +7 -0
  90. teradataml/data/SMOOTHED_DATA.csv +7 -0
  91. teradataml/data/TestDFFT8.csv +9 -0
  92. teradataml/data/TestRiver.csv +109 -0
  93. teradataml/data/Traindata.csv +28 -0
  94. teradataml/data/__init__.py +0 -0
  95. teradataml/data/acf.csv +17 -0
  96. teradataml/data/adaboost_example.json +34 -0
  97. teradataml/data/adaboostpredict_example.json +24 -0
  98. teradataml/data/additional_table.csv +11 -0
  99. teradataml/data/admissions_test.csv +21 -0
  100. teradataml/data/admissions_train.csv +41 -0
  101. teradataml/data/admissions_train_nulls.csv +41 -0
  102. teradataml/data/advertising.csv +201 -0
  103. teradataml/data/ageandheight.csv +13 -0
  104. teradataml/data/ageandpressure.csv +31 -0
  105. teradataml/data/amazon_reviews_25.csv +26 -0
  106. teradataml/data/antiselect_example.json +36 -0
  107. teradataml/data/antiselect_input.csv +8 -0
  108. teradataml/data/antiselect_input_mixed_case.csv +8 -0
  109. teradataml/data/applicant_external.csv +7 -0
  110. teradataml/data/applicant_reference.csv +7 -0
  111. teradataml/data/apriori_example.json +22 -0
  112. teradataml/data/arima_example.json +9 -0
  113. teradataml/data/assortedtext_input.csv +8 -0
  114. teradataml/data/attribution_example.json +34 -0
  115. teradataml/data/attribution_sample_table.csv +27 -0
  116. teradataml/data/attribution_sample_table1.csv +6 -0
  117. teradataml/data/attribution_sample_table2.csv +11 -0
  118. teradataml/data/bank_churn.csv +10001 -0
  119. teradataml/data/bank_marketing.csv +11163 -0
  120. teradataml/data/bank_web_clicks1.csv +43 -0
  121. teradataml/data/bank_web_clicks2.csv +91 -0
  122. teradataml/data/bank_web_url.csv +85 -0
  123. teradataml/data/barrier.csv +2 -0
  124. teradataml/data/barrier_new.csv +3 -0
  125. teradataml/data/betweenness_example.json +14 -0
  126. teradataml/data/bike_sharing.csv +732 -0
  127. teradataml/data/bin_breaks.csv +8 -0
  128. teradataml/data/bin_fit_ip.csv +4 -0
  129. teradataml/data/binary_complex_left.csv +11 -0
  130. teradataml/data/binary_complex_right.csv +11 -0
  131. teradataml/data/binary_matrix_complex_left.csv +21 -0
  132. teradataml/data/binary_matrix_complex_right.csv +21 -0
  133. teradataml/data/binary_matrix_real_left.csv +21 -0
  134. teradataml/data/binary_matrix_real_right.csv +21 -0
  135. teradataml/data/blood2ageandweight.csv +26 -0
  136. teradataml/data/bmi.csv +501 -0
  137. teradataml/data/boston.csv +507 -0
  138. teradataml/data/boston2cols.csv +721 -0
  139. teradataml/data/breast_cancer.csv +570 -0
  140. teradataml/data/buoydata_mix.csv +11 -0
  141. teradataml/data/burst_data.csv +5 -0
  142. teradataml/data/burst_example.json +21 -0
  143. teradataml/data/byom_example.json +34 -0
  144. teradataml/data/bytes_table.csv +4 -0
  145. teradataml/data/cal_housing_ex_raw.csv +70 -0
  146. teradataml/data/callers.csv +7 -0
  147. teradataml/data/calls.csv +10 -0
  148. teradataml/data/cars_hist.csv +33 -0
  149. teradataml/data/cat_table.csv +25 -0
  150. teradataml/data/ccm_example.json +32 -0
  151. teradataml/data/ccm_input.csv +91 -0
  152. teradataml/data/ccm_input2.csv +13 -0
  153. teradataml/data/ccmexample.csv +101 -0
  154. teradataml/data/ccmprepare_example.json +9 -0
  155. teradataml/data/ccmprepare_input.csv +91 -0
  156. teradataml/data/cfilter_example.json +12 -0
  157. teradataml/data/changepointdetection_example.json +18 -0
  158. teradataml/data/changepointdetectionrt_example.json +8 -0
  159. teradataml/data/chi_sq.csv +3 -0
  160. teradataml/data/churn_data.csv +14 -0
  161. teradataml/data/churn_emission.csv +35 -0
  162. teradataml/data/churn_initial.csv +3 -0
  163. teradataml/data/churn_state_transition.csv +5 -0
  164. teradataml/data/citedges_2.csv +745 -0
  165. teradataml/data/citvertices_2.csv +1210 -0
  166. teradataml/data/clicks2.csv +16 -0
  167. teradataml/data/clickstream.csv +13 -0
  168. teradataml/data/clickstream1.csv +11 -0
  169. teradataml/data/closeness_example.json +16 -0
  170. teradataml/data/complaints.csv +21 -0
  171. teradataml/data/complaints_mini.csv +3 -0
  172. teradataml/data/complaints_test_tokenized.csv +353 -0
  173. teradataml/data/complaints_testtoken.csv +224 -0
  174. teradataml/data/complaints_tokens_model.csv +348 -0
  175. teradataml/data/complaints_tokens_test.csv +353 -0
  176. teradataml/data/complaints_traintoken.csv +472 -0
  177. teradataml/data/computers_category.csv +1001 -0
  178. teradataml/data/computers_test1.csv +1252 -0
  179. teradataml/data/computers_train1.csv +5009 -0
  180. teradataml/data/computers_train1_clustered.csv +5009 -0
  181. teradataml/data/confusionmatrix_example.json +9 -0
  182. teradataml/data/conversion_event_table.csv +3 -0
  183. teradataml/data/corr_input.csv +17 -0
  184. teradataml/data/correlation_example.json +11 -0
  185. teradataml/data/covid_confirm_sd.csv +83 -0
  186. teradataml/data/coxhazardratio_example.json +39 -0
  187. teradataml/data/coxph_example.json +15 -0
  188. teradataml/data/coxsurvival_example.json +28 -0
  189. teradataml/data/cpt.csv +41 -0
  190. teradataml/data/credit_ex_merged.csv +45 -0
  191. teradataml/data/creditcard_data.csv +1001 -0
  192. teradataml/data/customer_loyalty.csv +301 -0
  193. teradataml/data/customer_loyalty_newseq.csv +31 -0
  194. teradataml/data/customer_segmentation_test.csv +2628 -0
  195. teradataml/data/customer_segmentation_train.csv +8069 -0
  196. teradataml/data/dataframe_example.json +173 -0
  197. teradataml/data/decisionforest_example.json +37 -0
  198. teradataml/data/decisionforestpredict_example.json +38 -0
  199. teradataml/data/decisiontree_example.json +21 -0
  200. teradataml/data/decisiontreepredict_example.json +45 -0
  201. teradataml/data/dfft2_size4_real.csv +17 -0
  202. teradataml/data/dfft2_test_matrix16.csv +17 -0
  203. teradataml/data/dfft2conv_real_4_4.csv +65 -0
  204. teradataml/data/diabetes.csv +443 -0
  205. teradataml/data/diabetes_test.csv +89 -0
  206. teradataml/data/dict_table.csv +5 -0
  207. teradataml/data/docperterm_table.csv +4 -0
  208. teradataml/data/docs/__init__.py +1 -0
  209. teradataml/data/docs/byom/__init__.py +0 -0
  210. teradataml/data/docs/byom/docs/DataRobotPredict.py +180 -0
  211. teradataml/data/docs/byom/docs/DataikuPredict.py +217 -0
  212. teradataml/data/docs/byom/docs/H2OPredict.py +325 -0
  213. teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
  214. teradataml/data/docs/byom/docs/ONNXPredict.py +283 -0
  215. teradataml/data/docs/byom/docs/ONNXSeq2Seq.py +255 -0
  216. teradataml/data/docs/byom/docs/PMMLPredict.py +278 -0
  217. teradataml/data/docs/byom/docs/__init__.py +0 -0
  218. teradataml/data/docs/sqle/__init__.py +0 -0
  219. teradataml/data/docs/sqle/docs_17_10/Antiselect.py +83 -0
  220. teradataml/data/docs/sqle/docs_17_10/Attribution.py +200 -0
  221. teradataml/data/docs/sqle/docs_17_10/BincodeFit.py +172 -0
  222. teradataml/data/docs/sqle/docs_17_10/BincodeTransform.py +131 -0
  223. teradataml/data/docs/sqle/docs_17_10/CategoricalSummary.py +86 -0
  224. teradataml/data/docs/sqle/docs_17_10/ChiSq.py +90 -0
  225. teradataml/data/docs/sqle/docs_17_10/ColumnSummary.py +86 -0
  226. teradataml/data/docs/sqle/docs_17_10/ConvertTo.py +96 -0
  227. teradataml/data/docs/sqle/docs_17_10/DecisionForestPredict.py +139 -0
  228. teradataml/data/docs/sqle/docs_17_10/DecisionTreePredict.py +152 -0
  229. teradataml/data/docs/sqle/docs_17_10/FTest.py +161 -0
  230. teradataml/data/docs/sqle/docs_17_10/FillRowId.py +83 -0
  231. teradataml/data/docs/sqle/docs_17_10/Fit.py +88 -0
  232. teradataml/data/docs/sqle/docs_17_10/GLMPredict.py +144 -0
  233. teradataml/data/docs/sqle/docs_17_10/GetRowsWithMissingValues.py +85 -0
  234. teradataml/data/docs/sqle/docs_17_10/GetRowsWithoutMissingValues.py +82 -0
  235. teradataml/data/docs/sqle/docs_17_10/Histogram.py +165 -0
  236. teradataml/data/docs/sqle/docs_17_10/MovingAverage.py +134 -0
  237. teradataml/data/docs/sqle/docs_17_10/NGramSplitter.py +209 -0
  238. teradataml/data/docs/sqle/docs_17_10/NPath.py +266 -0
  239. teradataml/data/docs/sqle/docs_17_10/NaiveBayesPredict.py +116 -0
  240. teradataml/data/docs/sqle/docs_17_10/NaiveBayesTextClassifierPredict.py +176 -0
  241. teradataml/data/docs/sqle/docs_17_10/NumApply.py +147 -0
  242. teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +135 -0
  243. teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +109 -0
  244. teradataml/data/docs/sqle/docs_17_10/OutlierFilterFit.py +166 -0
  245. teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +105 -0
  246. teradataml/data/docs/sqle/docs_17_10/Pack.py +128 -0
  247. teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesFit.py +112 -0
  248. teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesTransform.py +102 -0
  249. teradataml/data/docs/sqle/docs_17_10/QQNorm.py +105 -0
  250. teradataml/data/docs/sqle/docs_17_10/RoundColumns.py +110 -0
  251. teradataml/data/docs/sqle/docs_17_10/RowNormalizeFit.py +118 -0
  252. teradataml/data/docs/sqle/docs_17_10/RowNormalizeTransform.py +99 -0
  253. teradataml/data/docs/sqle/docs_17_10/SVMSparsePredict.py +153 -0
  254. teradataml/data/docs/sqle/docs_17_10/ScaleFit.py +197 -0
  255. teradataml/data/docs/sqle/docs_17_10/ScaleTransform.py +99 -0
  256. teradataml/data/docs/sqle/docs_17_10/Sessionize.py +114 -0
  257. teradataml/data/docs/sqle/docs_17_10/SimpleImputeFit.py +116 -0
  258. teradataml/data/docs/sqle/docs_17_10/SimpleImputeTransform.py +98 -0
  259. teradataml/data/docs/sqle/docs_17_10/StrApply.py +187 -0
  260. teradataml/data/docs/sqle/docs_17_10/StringSimilarity.py +146 -0
  261. teradataml/data/docs/sqle/docs_17_10/Transform.py +105 -0
  262. teradataml/data/docs/sqle/docs_17_10/UnivariateStatistics.py +142 -0
  263. teradataml/data/docs/sqle/docs_17_10/Unpack.py +214 -0
  264. teradataml/data/docs/sqle/docs_17_10/WhichMax.py +83 -0
  265. teradataml/data/docs/sqle/docs_17_10/WhichMin.py +83 -0
  266. teradataml/data/docs/sqle/docs_17_10/ZTest.py +155 -0
  267. teradataml/data/docs/sqle/docs_17_10/__init__.py +0 -0
  268. teradataml/data/docs/sqle/docs_17_20/ANOVA.py +186 -0
  269. teradataml/data/docs/sqle/docs_17_20/Antiselect.py +83 -0
  270. teradataml/data/docs/sqle/docs_17_20/Apriori.py +138 -0
  271. teradataml/data/docs/sqle/docs_17_20/Attribution.py +201 -0
  272. teradataml/data/docs/sqle/docs_17_20/BincodeFit.py +172 -0
  273. teradataml/data/docs/sqle/docs_17_20/BincodeTransform.py +139 -0
  274. teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
  275. teradataml/data/docs/sqle/docs_17_20/CategoricalSummary.py +86 -0
  276. teradataml/data/docs/sqle/docs_17_20/ChiSq.py +90 -0
  277. teradataml/data/docs/sqle/docs_17_20/ClassificationEvaluator.py +166 -0
  278. teradataml/data/docs/sqle/docs_17_20/ColumnSummary.py +86 -0
  279. teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +246 -0
  280. teradataml/data/docs/sqle/docs_17_20/ConvertTo.py +113 -0
  281. teradataml/data/docs/sqle/docs_17_20/DecisionForest.py +280 -0
  282. teradataml/data/docs/sqle/docs_17_20/DecisionForestPredict.py +144 -0
  283. teradataml/data/docs/sqle/docs_17_20/DecisionTreePredict.py +136 -0
  284. teradataml/data/docs/sqle/docs_17_20/FTest.py +240 -0
  285. teradataml/data/docs/sqle/docs_17_20/FillRowId.py +83 -0
  286. teradataml/data/docs/sqle/docs_17_20/Fit.py +88 -0
  287. teradataml/data/docs/sqle/docs_17_20/GLM.py +541 -0
  288. teradataml/data/docs/sqle/docs_17_20/GLMPerSegment.py +415 -0
  289. teradataml/data/docs/sqle/docs_17_20/GLMPredict.py +144 -0
  290. teradataml/data/docs/sqle/docs_17_20/GLMPredictPerSegment.py +233 -0
  291. teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +125 -0
  292. teradataml/data/docs/sqle/docs_17_20/GetRowsWithMissingValues.py +109 -0
  293. teradataml/data/docs/sqle/docs_17_20/GetRowsWithoutMissingValues.py +106 -0
  294. teradataml/data/docs/sqle/docs_17_20/Histogram.py +224 -0
  295. teradataml/data/docs/sqle/docs_17_20/KMeans.py +251 -0
  296. teradataml/data/docs/sqle/docs_17_20/KMeansPredict.py +144 -0
  297. teradataml/data/docs/sqle/docs_17_20/KNN.py +215 -0
  298. teradataml/data/docs/sqle/docs_17_20/MovingAverage.py +134 -0
  299. teradataml/data/docs/sqle/docs_17_20/NERExtractor.py +121 -0
  300. teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +209 -0
  301. teradataml/data/docs/sqle/docs_17_20/NPath.py +266 -0
  302. teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
  303. teradataml/data/docs/sqle/docs_17_20/NaiveBayesPredict.py +116 -0
  304. teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierPredict.py +177 -0
  305. teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierTrainer.py +127 -0
  306. teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +119 -0
  307. teradataml/data/docs/sqle/docs_17_20/NonLinearCombineTransform.py +112 -0
  308. teradataml/data/docs/sqle/docs_17_20/NumApply.py +147 -0
  309. teradataml/data/docs/sqle/docs_17_20/OneClassSVM.py +307 -0
  310. teradataml/data/docs/sqle/docs_17_20/OneClassSVMPredict.py +185 -0
  311. teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +231 -0
  312. teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +121 -0
  313. teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingFit.py +220 -0
  314. teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingTransform.py +127 -0
  315. teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +191 -0
  316. teradataml/data/docs/sqle/docs_17_20/OutlierFilterTransform.py +117 -0
  317. teradataml/data/docs/sqle/docs_17_20/Pack.py +128 -0
  318. teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
  319. teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesFit.py +112 -0
  320. teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesTransform.py +112 -0
  321. teradataml/data/docs/sqle/docs_17_20/QQNorm.py +105 -0
  322. teradataml/data/docs/sqle/docs_17_20/ROC.py +164 -0
  323. teradataml/data/docs/sqle/docs_17_20/RandomProjectionFit.py +155 -0
  324. teradataml/data/docs/sqle/docs_17_20/RandomProjectionMinComponents.py +106 -0
  325. teradataml/data/docs/sqle/docs_17_20/RandomProjectionTransform.py +120 -0
  326. teradataml/data/docs/sqle/docs_17_20/RegressionEvaluator.py +211 -0
  327. teradataml/data/docs/sqle/docs_17_20/RoundColumns.py +109 -0
  328. teradataml/data/docs/sqle/docs_17_20/RowNormalizeFit.py +118 -0
  329. teradataml/data/docs/sqle/docs_17_20/RowNormalizeTransform.py +111 -0
  330. teradataml/data/docs/sqle/docs_17_20/SMOTE.py +212 -0
  331. teradataml/data/docs/sqle/docs_17_20/SVM.py +414 -0
  332. teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +213 -0
  333. teradataml/data/docs/sqle/docs_17_20/SVMSparsePredict.py +153 -0
  334. teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +315 -0
  335. teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +202 -0
  336. teradataml/data/docs/sqle/docs_17_20/SentimentExtractor.py +206 -0
  337. teradataml/data/docs/sqle/docs_17_20/Sessionize.py +114 -0
  338. teradataml/data/docs/sqle/docs_17_20/Shap.py +225 -0
  339. teradataml/data/docs/sqle/docs_17_20/Silhouette.py +153 -0
  340. teradataml/data/docs/sqle/docs_17_20/SimpleImputeFit.py +116 -0
  341. teradataml/data/docs/sqle/docs_17_20/SimpleImputeTransform.py +109 -0
  342. teradataml/data/docs/sqle/docs_17_20/StrApply.py +187 -0
  343. teradataml/data/docs/sqle/docs_17_20/StringSimilarity.py +146 -0
  344. teradataml/data/docs/sqle/docs_17_20/TDDecisionForestPredict.py +207 -0
  345. teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +333 -0
  346. teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
  347. teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
  348. teradataml/data/docs/sqle/docs_17_20/TargetEncodingFit.py +267 -0
  349. teradataml/data/docs/sqle/docs_17_20/TargetEncodingTransform.py +141 -0
  350. teradataml/data/docs/sqle/docs_17_20/TextMorph.py +119 -0
  351. teradataml/data/docs/sqle/docs_17_20/TextParser.py +224 -0
  352. teradataml/data/docs/sqle/docs_17_20/TrainTestSplit.py +160 -0
  353. teradataml/data/docs/sqle/docs_17_20/Transform.py +123 -0
  354. teradataml/data/docs/sqle/docs_17_20/UnivariateStatistics.py +142 -0
  355. teradataml/data/docs/sqle/docs_17_20/Unpack.py +214 -0
  356. teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
  357. teradataml/data/docs/sqle/docs_17_20/VectorDistance.py +169 -0
  358. teradataml/data/docs/sqle/docs_17_20/WhichMax.py +83 -0
  359. teradataml/data/docs/sqle/docs_17_20/WhichMin.py +83 -0
  360. teradataml/data/docs/sqle/docs_17_20/WordEmbeddings.py +237 -0
  361. teradataml/data/docs/sqle/docs_17_20/XGBoost.py +362 -0
  362. teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +281 -0
  363. teradataml/data/docs/sqle/docs_17_20/ZTest.py +220 -0
  364. teradataml/data/docs/sqle/docs_17_20/__init__.py +0 -0
  365. teradataml/data/docs/tableoperator/__init__.py +0 -0
  366. teradataml/data/docs/tableoperator/docs_17_00/ReadNOS.py +430 -0
  367. teradataml/data/docs/tableoperator/docs_17_00/__init__.py +0 -0
  368. teradataml/data/docs/tableoperator/docs_17_05/ReadNOS.py +430 -0
  369. teradataml/data/docs/tableoperator/docs_17_05/WriteNOS.py +348 -0
  370. teradataml/data/docs/tableoperator/docs_17_05/__init__.py +0 -0
  371. teradataml/data/docs/tableoperator/docs_17_10/ReadNOS.py +429 -0
  372. teradataml/data/docs/tableoperator/docs_17_10/WriteNOS.py +348 -0
  373. teradataml/data/docs/tableoperator/docs_17_10/__init__.py +0 -0
  374. teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
  375. teradataml/data/docs/tableoperator/docs_17_20/ReadNOS.py +440 -0
  376. teradataml/data/docs/tableoperator/docs_17_20/WriteNOS.py +387 -0
  377. teradataml/data/docs/tableoperator/docs_17_20/__init__.py +0 -0
  378. teradataml/data/docs/uaf/__init__.py +0 -0
  379. teradataml/data/docs/uaf/docs_17_20/ACF.py +186 -0
  380. teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +370 -0
  381. teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +172 -0
  382. teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +161 -0
  383. teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
  384. teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
  385. teradataml/data/docs/uaf/docs_17_20/BinaryMatrixOp.py +248 -0
  386. teradataml/data/docs/uaf/docs_17_20/BinarySeriesOp.py +252 -0
  387. teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +178 -0
  388. teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +175 -0
  389. teradataml/data/docs/uaf/docs_17_20/Convolve.py +230 -0
  390. teradataml/data/docs/uaf/docs_17_20/Convolve2.py +218 -0
  391. teradataml/data/docs/uaf/docs_17_20/CopyArt.py +145 -0
  392. teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +185 -0
  393. teradataml/data/docs/uaf/docs_17_20/DFFT.py +204 -0
  394. teradataml/data/docs/uaf/docs_17_20/DFFT2.py +216 -0
  395. teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +216 -0
  396. teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +192 -0
  397. teradataml/data/docs/uaf/docs_17_20/DIFF.py +175 -0
  398. teradataml/data/docs/uaf/docs_17_20/DTW.py +180 -0
  399. teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
  400. teradataml/data/docs/uaf/docs_17_20/DWT2D.py +217 -0
  401. teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +142 -0
  402. teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +184 -0
  403. teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +185 -0
  404. teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
  405. teradataml/data/docs/uaf/docs_17_20/FitMetrics.py +172 -0
  406. teradataml/data/docs/uaf/docs_17_20/GenseriesFormula.py +206 -0
  407. teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +143 -0
  408. teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +198 -0
  409. teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +260 -0
  410. teradataml/data/docs/uaf/docs_17_20/IDFFT.py +165 -0
  411. teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +191 -0
  412. teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
  413. teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
  414. teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
  415. teradataml/data/docs/uaf/docs_17_20/InputValidator.py +121 -0
  416. teradataml/data/docs/uaf/docs_17_20/LineSpec.py +156 -0
  417. teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +215 -0
  418. teradataml/data/docs/uaf/docs_17_20/MAMean.py +174 -0
  419. teradataml/data/docs/uaf/docs_17_20/MInfo.py +134 -0
  420. teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
  421. teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +145 -0
  422. teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +191 -0
  423. teradataml/data/docs/uaf/docs_17_20/PACF.py +157 -0
  424. teradataml/data/docs/uaf/docs_17_20/Portman.py +217 -0
  425. teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +203 -0
  426. teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +155 -0
  427. teradataml/data/docs/uaf/docs_17_20/Resample.py +237 -0
  428. teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
  429. teradataml/data/docs/uaf/docs_17_20/SInfo.py +123 -0
  430. teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +173 -0
  431. teradataml/data/docs/uaf/docs_17_20/SelectionCriteria.py +174 -0
  432. teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +171 -0
  433. teradataml/data/docs/uaf/docs_17_20/SignifResidmean.py +164 -0
  434. teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +180 -0
  435. teradataml/data/docs/uaf/docs_17_20/Smoothma.py +208 -0
  436. teradataml/data/docs/uaf/docs_17_20/TrackingOp.py +151 -0
  437. teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +171 -0
  438. teradataml/data/docs/uaf/docs_17_20/Unnormalize.py +202 -0
  439. teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +171 -0
  440. teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
  441. teradataml/data/docs/uaf/docs_17_20/__init__.py +0 -0
  442. teradataml/data/dtw_example.json +18 -0
  443. teradataml/data/dtw_t1.csv +11 -0
  444. teradataml/data/dtw_t2.csv +4 -0
  445. teradataml/data/dwt2d_dataTable.csv +65 -0
  446. teradataml/data/dwt2d_example.json +16 -0
  447. teradataml/data/dwt_dataTable.csv +8 -0
  448. teradataml/data/dwt_example.json +15 -0
  449. teradataml/data/dwt_filterTable.csv +3 -0
  450. teradataml/data/dwt_filter_dim.csv +5 -0
  451. teradataml/data/emission.csv +9 -0
  452. teradataml/data/emp_table_by_dept.csv +19 -0
  453. teradataml/data/employee_info.csv +4 -0
  454. teradataml/data/employee_table.csv +6 -0
  455. teradataml/data/excluding_event_table.csv +2 -0
  456. teradataml/data/finance_data.csv +6 -0
  457. teradataml/data/finance_data2.csv +61 -0
  458. teradataml/data/finance_data3.csv +93 -0
  459. teradataml/data/finance_data4.csv +13 -0
  460. teradataml/data/fish.csv +160 -0
  461. teradataml/data/fm_blood2ageandweight.csv +26 -0
  462. teradataml/data/fmeasure_example.json +12 -0
  463. teradataml/data/followers_leaders.csv +10 -0
  464. teradataml/data/fpgrowth_example.json +12 -0
  465. teradataml/data/frequentpaths_example.json +29 -0
  466. teradataml/data/friends.csv +9 -0
  467. teradataml/data/fs_input.csv +33 -0
  468. teradataml/data/fs_input1.csv +33 -0
  469. teradataml/data/genData.csv +513 -0
  470. teradataml/data/geodataframe_example.json +40 -0
  471. teradataml/data/glass_types.csv +215 -0
  472. teradataml/data/glm_admissions_model.csv +12 -0
  473. teradataml/data/glm_example.json +56 -0
  474. teradataml/data/glml1l2_example.json +28 -0
  475. teradataml/data/glml1l2predict_example.json +54 -0
  476. teradataml/data/glmpredict_example.json +54 -0
  477. teradataml/data/gq_t1.csv +21 -0
  478. teradataml/data/grocery_transaction.csv +19 -0
  479. teradataml/data/hconvolve_complex_right.csv +5 -0
  480. teradataml/data/hconvolve_complex_rightmulti.csv +5 -0
  481. teradataml/data/histogram_example.json +12 -0
  482. teradataml/data/hmmdecoder_example.json +79 -0
  483. teradataml/data/hmmevaluator_example.json +25 -0
  484. teradataml/data/hmmsupervised_example.json +10 -0
  485. teradataml/data/hmmunsupervised_example.json +8 -0
  486. teradataml/data/hnsw_alter_data.csv +5 -0
  487. teradataml/data/hnsw_data.csv +10 -0
  488. teradataml/data/house_values.csv +12 -0
  489. teradataml/data/house_values2.csv +13 -0
  490. teradataml/data/housing_cat.csv +7 -0
  491. teradataml/data/housing_data.csv +9 -0
  492. teradataml/data/housing_test.csv +47 -0
  493. teradataml/data/housing_test_binary.csv +47 -0
  494. teradataml/data/housing_train.csv +493 -0
  495. teradataml/data/housing_train_attribute.csv +5 -0
  496. teradataml/data/housing_train_binary.csv +437 -0
  497. teradataml/data/housing_train_parameter.csv +2 -0
  498. teradataml/data/housing_train_response.csv +493 -0
  499. teradataml/data/housing_train_segment.csv +201 -0
  500. teradataml/data/ibm_stock.csv +370 -0
  501. teradataml/data/ibm_stock1.csv +370 -0
  502. teradataml/data/identitymatch_example.json +22 -0
  503. teradataml/data/idf_table.csv +4 -0
  504. teradataml/data/idwt2d_dataTable.csv +5 -0
  505. teradataml/data/idwt_dataTable.csv +8 -0
  506. teradataml/data/idwt_filterTable.csv +3 -0
  507. teradataml/data/impressions.csv +101 -0
  508. teradataml/data/inflation.csv +21 -0
  509. teradataml/data/initial.csv +3 -0
  510. teradataml/data/insect2Cols.csv +61 -0
  511. teradataml/data/insect_sprays.csv +13 -0
  512. teradataml/data/insurance.csv +1339 -0
  513. teradataml/data/interpolator_example.json +13 -0
  514. teradataml/data/interval_data.csv +5 -0
  515. teradataml/data/iris_altinput.csv +481 -0
  516. teradataml/data/iris_attribute_output.csv +8 -0
  517. teradataml/data/iris_attribute_test.csv +121 -0
  518. teradataml/data/iris_attribute_train.csv +481 -0
  519. teradataml/data/iris_category_expect_predict.csv +31 -0
  520. teradataml/data/iris_data.csv +151 -0
  521. teradataml/data/iris_input.csv +151 -0
  522. teradataml/data/iris_response_train.csv +121 -0
  523. teradataml/data/iris_test.csv +31 -0
  524. teradataml/data/iris_train.csv +121 -0
  525. teradataml/data/join_table1.csv +4 -0
  526. teradataml/data/join_table2.csv +4 -0
  527. teradataml/data/jsons/anly_function_name.json +7 -0
  528. teradataml/data/jsons/byom/ONNXSeq2Seq.json +287 -0
  529. teradataml/data/jsons/byom/dataikupredict.json +148 -0
  530. teradataml/data/jsons/byom/datarobotpredict.json +147 -0
  531. teradataml/data/jsons/byom/h2opredict.json +195 -0
  532. teradataml/data/jsons/byom/onnxembeddings.json +267 -0
  533. teradataml/data/jsons/byom/onnxpredict.json +187 -0
  534. teradataml/data/jsons/byom/pmmlpredict.json +147 -0
  535. teradataml/data/jsons/paired_functions.json +450 -0
  536. teradataml/data/jsons/sqle/16.20/Antiselect.json +56 -0
  537. teradataml/data/jsons/sqle/16.20/Attribution.json +249 -0
  538. teradataml/data/jsons/sqle/16.20/DecisionForestPredict.json +156 -0
  539. teradataml/data/jsons/sqle/16.20/DecisionTreePredict.json +170 -0
  540. teradataml/data/jsons/sqle/16.20/GLMPredict.json +122 -0
  541. teradataml/data/jsons/sqle/16.20/MovingAverage.json +367 -0
  542. teradataml/data/jsons/sqle/16.20/NGramSplitter.json +239 -0
  543. teradataml/data/jsons/sqle/16.20/NaiveBayesPredict.json +136 -0
  544. teradataml/data/jsons/sqle/16.20/NaiveBayesTextClassifierPredict.json +235 -0
  545. teradataml/data/jsons/sqle/16.20/Pack.json +98 -0
  546. teradataml/data/jsons/sqle/16.20/SVMSparsePredict.json +162 -0
  547. teradataml/data/jsons/sqle/16.20/Sessionize.json +105 -0
  548. teradataml/data/jsons/sqle/16.20/StringSimilarity.json +86 -0
  549. teradataml/data/jsons/sqle/16.20/Unpack.json +166 -0
  550. teradataml/data/jsons/sqle/16.20/nPath.json +269 -0
  551. teradataml/data/jsons/sqle/17.00/Antiselect.json +56 -0
  552. teradataml/data/jsons/sqle/17.00/Attribution.json +249 -0
  553. teradataml/data/jsons/sqle/17.00/DecisionForestPredict.json +156 -0
  554. teradataml/data/jsons/sqle/17.00/DecisionTreePredict.json +170 -0
  555. teradataml/data/jsons/sqle/17.00/GLMPredict.json +122 -0
  556. teradataml/data/jsons/sqle/17.00/MovingAverage.json +367 -0
  557. teradataml/data/jsons/sqle/17.00/NGramSplitter.json +239 -0
  558. teradataml/data/jsons/sqle/17.00/NaiveBayesPredict.json +136 -0
  559. teradataml/data/jsons/sqle/17.00/NaiveBayesTextClassifierPredict.json +235 -0
  560. teradataml/data/jsons/sqle/17.00/Pack.json +98 -0
  561. teradataml/data/jsons/sqle/17.00/SVMSparsePredict.json +162 -0
  562. teradataml/data/jsons/sqle/17.00/Sessionize.json +105 -0
  563. teradataml/data/jsons/sqle/17.00/StringSimilarity.json +86 -0
  564. teradataml/data/jsons/sqle/17.00/Unpack.json +166 -0
  565. teradataml/data/jsons/sqle/17.00/nPath.json +269 -0
  566. teradataml/data/jsons/sqle/17.05/Antiselect.json +56 -0
  567. teradataml/data/jsons/sqle/17.05/Attribution.json +249 -0
  568. teradataml/data/jsons/sqle/17.05/DecisionForestPredict.json +156 -0
  569. teradataml/data/jsons/sqle/17.05/DecisionTreePredict.json +170 -0
  570. teradataml/data/jsons/sqle/17.05/GLMPredict.json +122 -0
  571. teradataml/data/jsons/sqle/17.05/MovingAverage.json +367 -0
  572. teradataml/data/jsons/sqle/17.05/NGramSplitter.json +239 -0
  573. teradataml/data/jsons/sqle/17.05/NaiveBayesPredict.json +136 -0
  574. teradataml/data/jsons/sqle/17.05/NaiveBayesTextClassifierPredict.json +235 -0
  575. teradataml/data/jsons/sqle/17.05/Pack.json +98 -0
  576. teradataml/data/jsons/sqle/17.05/SVMSparsePredict.json +162 -0
  577. teradataml/data/jsons/sqle/17.05/Sessionize.json +105 -0
  578. teradataml/data/jsons/sqle/17.05/StringSimilarity.json +86 -0
  579. teradataml/data/jsons/sqle/17.05/Unpack.json +166 -0
  580. teradataml/data/jsons/sqle/17.05/nPath.json +269 -0
  581. teradataml/data/jsons/sqle/17.10/Antiselect.json +56 -0
  582. teradataml/data/jsons/sqle/17.10/Attribution.json +249 -0
  583. teradataml/data/jsons/sqle/17.10/DecisionForestPredict.json +185 -0
  584. teradataml/data/jsons/sqle/17.10/DecisionTreePredict.json +172 -0
  585. teradataml/data/jsons/sqle/17.10/GLMPredict.json +151 -0
  586. teradataml/data/jsons/sqle/17.10/MovingAverage.json +368 -0
  587. teradataml/data/jsons/sqle/17.10/NGramSplitter.json +239 -0
  588. teradataml/data/jsons/sqle/17.10/NaiveBayesPredict.json +149 -0
  589. teradataml/data/jsons/sqle/17.10/NaiveBayesTextClassifierPredict.json +288 -0
  590. teradataml/data/jsons/sqle/17.10/Pack.json +133 -0
  591. teradataml/data/jsons/sqle/17.10/SVMSparsePredict.json +193 -0
  592. teradataml/data/jsons/sqle/17.10/Sessionize.json +105 -0
  593. teradataml/data/jsons/sqle/17.10/StringSimilarity.json +86 -0
  594. teradataml/data/jsons/sqle/17.10/TD_BinCodeFit.json +239 -0
  595. teradataml/data/jsons/sqle/17.10/TD_BinCodeTransform.json +70 -0
  596. teradataml/data/jsons/sqle/17.10/TD_CategoricalSummary.json +54 -0
  597. teradataml/data/jsons/sqle/17.10/TD_Chisq.json +68 -0
  598. teradataml/data/jsons/sqle/17.10/TD_ColumnSummary.json +54 -0
  599. teradataml/data/jsons/sqle/17.10/TD_ConvertTo.json +69 -0
  600. teradataml/data/jsons/sqle/17.10/TD_FTest.json +187 -0
  601. teradataml/data/jsons/sqle/17.10/TD_FillRowID.json +52 -0
  602. teradataml/data/jsons/sqle/17.10/TD_FunctionFit.json +46 -0
  603. teradataml/data/jsons/sqle/17.10/TD_FunctionTransform.json +72 -0
  604. teradataml/data/jsons/sqle/17.10/TD_GetRowsWithMissingValues.json +53 -0
  605. teradataml/data/jsons/sqle/17.10/TD_GetRowsWithoutMissingValues.json +53 -0
  606. teradataml/data/jsons/sqle/17.10/TD_Histogram.json +133 -0
  607. teradataml/data/jsons/sqle/17.10/TD_NumApply.json +147 -0
  608. teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingFit.json +183 -0
  609. teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingTransform.json +66 -0
  610. teradataml/data/jsons/sqle/17.10/TD_OutlierFilterFit.json +197 -0
  611. teradataml/data/jsons/sqle/17.10/TD_OutlierFilterTransform.json +48 -0
  612. teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesFit.json +114 -0
  613. teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesTransform.json +72 -0
  614. teradataml/data/jsons/sqle/17.10/TD_QQNorm.json +112 -0
  615. teradataml/data/jsons/sqle/17.10/TD_RoundColumns.json +93 -0
  616. teradataml/data/jsons/sqle/17.10/TD_RowNormalizeFit.json +128 -0
  617. teradataml/data/jsons/sqle/17.10/TD_RowNormalizeTransform.json +71 -0
  618. teradataml/data/jsons/sqle/17.10/TD_ScaleFit.json +157 -0
  619. teradataml/data/jsons/sqle/17.10/TD_ScaleTransform.json +71 -0
  620. teradataml/data/jsons/sqle/17.10/TD_SimpleImputeFit.json +148 -0
  621. teradataml/data/jsons/sqle/17.10/TD_SimpleImputeTransform.json +48 -0
  622. teradataml/data/jsons/sqle/17.10/TD_StrApply.json +240 -0
  623. teradataml/data/jsons/sqle/17.10/TD_UnivariateStatistics.json +119 -0
  624. teradataml/data/jsons/sqle/17.10/TD_WhichMax.json +53 -0
  625. teradataml/data/jsons/sqle/17.10/TD_WhichMin.json +53 -0
  626. teradataml/data/jsons/sqle/17.10/TD_ZTest.json +171 -0
  627. teradataml/data/jsons/sqle/17.10/Unpack.json +188 -0
  628. teradataml/data/jsons/sqle/17.10/nPath.json +269 -0
  629. teradataml/data/jsons/sqle/17.20/Antiselect.json +56 -0
  630. teradataml/data/jsons/sqle/17.20/Attribution.json +249 -0
  631. teradataml/data/jsons/sqle/17.20/DecisionForestPredict.json +185 -0
  632. teradataml/data/jsons/sqle/17.20/DecisionTreePredict.json +172 -0
  633. teradataml/data/jsons/sqle/17.20/GLMPredict.json +151 -0
  634. teradataml/data/jsons/sqle/17.20/MovingAverage.json +367 -0
  635. teradataml/data/jsons/sqle/17.20/NGramSplitter.json +239 -0
  636. teradataml/data/jsons/sqle/17.20/NaiveBayesPredict.json +149 -0
  637. teradataml/data/jsons/sqle/17.20/NaiveBayesTextClassifierPredict.json +287 -0
  638. teradataml/data/jsons/sqle/17.20/Pack.json +133 -0
  639. teradataml/data/jsons/sqle/17.20/SVMSparsePredict.json +192 -0
  640. teradataml/data/jsons/sqle/17.20/Sessionize.json +105 -0
  641. teradataml/data/jsons/sqle/17.20/StringSimilarity.json +86 -0
  642. teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +149 -0
  643. teradataml/data/jsons/sqle/17.20/TD_Apriori.json +181 -0
  644. teradataml/data/jsons/sqle/17.20/TD_BinCodeFit.json +239 -0
  645. teradataml/data/jsons/sqle/17.20/TD_BinCodeTransform.json +71 -0
  646. teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
  647. teradataml/data/jsons/sqle/17.20/TD_CategoricalSummary.json +53 -0
  648. teradataml/data/jsons/sqle/17.20/TD_Chisq.json +68 -0
  649. teradataml/data/jsons/sqle/17.20/TD_ClassificationEvaluator.json +146 -0
  650. teradataml/data/jsons/sqle/17.20/TD_ColumnSummary.json +53 -0
  651. teradataml/data/jsons/sqle/17.20/TD_ColumnTransformer.json +218 -0
  652. teradataml/data/jsons/sqle/17.20/TD_ConvertTo.json +92 -0
  653. teradataml/data/jsons/sqle/17.20/TD_DecisionForest.json +260 -0
  654. teradataml/data/jsons/sqle/17.20/TD_DecisionForestPredict.json +139 -0
  655. teradataml/data/jsons/sqle/17.20/TD_FTest.json +269 -0
  656. teradataml/data/jsons/sqle/17.20/TD_FillRowID.json +52 -0
  657. teradataml/data/jsons/sqle/17.20/TD_FunctionFit.json +46 -0
  658. teradataml/data/jsons/sqle/17.20/TD_FunctionTransform.json +72 -0
  659. teradataml/data/jsons/sqle/17.20/TD_GLM.json +507 -0
  660. teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +168 -0
  661. teradataml/data/jsons/sqle/17.20/TD_GLMPerSegment.json +411 -0
  662. teradataml/data/jsons/sqle/17.20/TD_GLMPredictPerSegment.json +146 -0
  663. teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +93 -0
  664. teradataml/data/jsons/sqle/17.20/TD_GetRowsWithMissingValues.json +76 -0
  665. teradataml/data/jsons/sqle/17.20/TD_GetRowsWithoutMissingValues.json +76 -0
  666. teradataml/data/jsons/sqle/17.20/TD_Histogram.json +152 -0
  667. teradataml/data/jsons/sqle/17.20/TD_KMeans.json +232 -0
  668. teradataml/data/jsons/sqle/17.20/TD_KMeansPredict.json +87 -0
  669. teradataml/data/jsons/sqle/17.20/TD_KNN.json +262 -0
  670. teradataml/data/jsons/sqle/17.20/TD_NERExtractor.json +145 -0
  671. teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
  672. teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
  673. teradataml/data/jsons/sqle/17.20/TD_NaiveBayesTextClassifierTrainer.json +137 -0
  674. teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +102 -0
  675. teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineTransform.json +71 -0
  676. teradataml/data/jsons/sqle/17.20/TD_NumApply.json +147 -0
  677. teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +316 -0
  678. teradataml/data/jsons/sqle/17.20/TD_OneClassSVMPredict.json +124 -0
  679. teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingFit.json +271 -0
  680. teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingTransform.json +65 -0
  681. teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingFit.json +229 -0
  682. teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingTransform.json +75 -0
  683. teradataml/data/jsons/sqle/17.20/TD_OutlierFilterFit.json +217 -0
  684. teradataml/data/jsons/sqle/17.20/TD_OutlierFilterTransform.json +48 -0
  685. teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
  686. teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesFit.json +114 -0
  687. teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesTransform.json +72 -0
  688. teradataml/data/jsons/sqle/17.20/TD_QQNorm.json +111 -0
  689. teradataml/data/jsons/sqle/17.20/TD_ROC.json +179 -0
  690. teradataml/data/jsons/sqle/17.20/TD_RandomProjectionFit.json +179 -0
  691. teradataml/data/jsons/sqle/17.20/TD_RandomProjectionMinComponents.json +74 -0
  692. teradataml/data/jsons/sqle/17.20/TD_RandomProjectionTransform.json +74 -0
  693. teradataml/data/jsons/sqle/17.20/TD_RegressionEvaluator.json +138 -0
  694. teradataml/data/jsons/sqle/17.20/TD_RoundColumns.json +93 -0
  695. teradataml/data/jsons/sqle/17.20/TD_RowNormalizeFit.json +128 -0
  696. teradataml/data/jsons/sqle/17.20/TD_RowNormalizeTransform.json +71 -0
  697. teradataml/data/jsons/sqle/17.20/TD_SMOTE.json +267 -0
  698. teradataml/data/jsons/sqle/17.20/TD_SVM.json +389 -0
  699. teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +142 -0
  700. teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +310 -0
  701. teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +120 -0
  702. teradataml/data/jsons/sqle/17.20/TD_SentimentExtractor.json +194 -0
  703. teradataml/data/jsons/sqle/17.20/TD_Shap.json +221 -0
  704. teradataml/data/jsons/sqle/17.20/TD_Silhouette.json +143 -0
  705. teradataml/data/jsons/sqle/17.20/TD_SimpleImputeFit.json +147 -0
  706. teradataml/data/jsons/sqle/17.20/TD_SimpleImputeTransform.json +48 -0
  707. teradataml/data/jsons/sqle/17.20/TD_StrApply.json +240 -0
  708. teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
  709. teradataml/data/jsons/sqle/17.20/TD_TargetEncodingFit.json +248 -0
  710. teradataml/data/jsons/sqle/17.20/TD_TargetEncodingTransform.json +75 -0
  711. teradataml/data/jsons/sqle/17.20/TD_TextMorph.json +134 -0
  712. teradataml/data/jsons/sqle/17.20/TD_TextParser.json +297 -0
  713. teradataml/data/jsons/sqle/17.20/TD_TrainTestSplit.json +142 -0
  714. teradataml/data/jsons/sqle/17.20/TD_UnivariateStatistics.json +117 -0
  715. teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
  716. teradataml/data/jsons/sqle/17.20/TD_VectorDistance.json +183 -0
  717. teradataml/data/jsons/sqle/17.20/TD_WhichMax.json +53 -0
  718. teradataml/data/jsons/sqle/17.20/TD_WhichMin.json +53 -0
  719. teradataml/data/jsons/sqle/17.20/TD_WordEmbeddings.json +241 -0
  720. teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +330 -0
  721. teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +195 -0
  722. teradataml/data/jsons/sqle/17.20/TD_ZTest.json +247 -0
  723. teradataml/data/jsons/sqle/17.20/Unpack.json +188 -0
  724. teradataml/data/jsons/sqle/17.20/nPath.json +269 -0
  725. teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +370 -0
  726. teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +460 -0
  727. teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +385 -0
  728. teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +369 -0
  729. teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +369 -0
  730. teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +369 -0
  731. teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +369 -0
  732. teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +400 -0
  733. teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +401 -0
  734. teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +384 -0
  735. teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +384 -0
  736. teradataml/data/jsons/sqle/20.00/TD_API_AzureML.json +151 -0
  737. teradataml/data/jsons/sqle/20.00/TD_API_Sagemaker.json +182 -0
  738. teradataml/data/jsons/sqle/20.00/TD_API_VertexAI.json +183 -0
  739. teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
  740. teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
  741. teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
  742. teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
  743. teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
  744. teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
  745. teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
  746. teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
  747. teradataml/data/jsons/tableoperator/17.00/read_nos.json +198 -0
  748. teradataml/data/jsons/tableoperator/17.05/read_nos.json +198 -0
  749. teradataml/data/jsons/tableoperator/17.05/write_nos.json +195 -0
  750. teradataml/data/jsons/tableoperator/17.10/read_nos.json +184 -0
  751. teradataml/data/jsons/tableoperator/17.10/write_nos.json +195 -0
  752. teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -0
  753. teradataml/data/jsons/tableoperator/17.20/read_nos.json +183 -0
  754. teradataml/data/jsons/tableoperator/17.20/write_nos.json +224 -0
  755. teradataml/data/jsons/uaf/17.20/TD_ACF.json +132 -0
  756. teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +396 -0
  757. teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +77 -0
  758. teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +153 -0
  759. teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
  760. teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
  761. teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +107 -0
  762. teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +106 -0
  763. teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +89 -0
  764. teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +104 -0
  765. teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +78 -0
  766. teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +66 -0
  767. teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +87 -0
  768. teradataml/data/jsons/uaf/17.20/TD_DFFT.json +134 -0
  769. teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +144 -0
  770. teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +108 -0
  771. teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +108 -0
  772. teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +78 -0
  773. teradataml/data/jsons/uaf/17.20/TD_DIFF.json +92 -0
  774. teradataml/data/jsons/uaf/17.20/TD_DTW.json +114 -0
  775. teradataml/data/jsons/uaf/17.20/TD_DURBIN_WATSON.json +101 -0
  776. teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
  777. teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
  778. teradataml/data/jsons/uaf/17.20/TD_EXTRACT_RESULTS.json +39 -0
  779. teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +101 -0
  780. teradataml/data/jsons/uaf/17.20/TD_GENSERIES4FORMULA.json +85 -0
  781. teradataml/data/jsons/uaf/17.20/TD_GENSERIES4SINUSOIDS.json +71 -0
  782. teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +139 -0
  783. teradataml/data/jsons/uaf/17.20/TD_HOLT_WINTERS_FORECASTER.json +313 -0
  784. teradataml/data/jsons/uaf/17.20/TD_IDFFT.json +58 -0
  785. teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +81 -0
  786. teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
  787. teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
  788. teradataml/data/jsons/uaf/17.20/TD_INPUTVALIDATOR.json +64 -0
  789. teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
  790. teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +182 -0
  791. teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +103 -0
  792. teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +181 -0
  793. teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
  794. teradataml/data/jsons/uaf/17.20/TD_MATRIXMULTIPLY.json +68 -0
  795. teradataml/data/jsons/uaf/17.20/TD_MINFO.json +67 -0
  796. teradataml/data/jsons/uaf/17.20/TD_MULTIVAR_REGR.json +179 -0
  797. teradataml/data/jsons/uaf/17.20/TD_PACF.json +114 -0
  798. teradataml/data/jsons/uaf/17.20/TD_PORTMAN.json +119 -0
  799. teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +175 -0
  800. teradataml/data/jsons/uaf/17.20/TD_POWERTRANSFORM.json +98 -0
  801. teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +194 -0
  802. teradataml/data/jsons/uaf/17.20/TD_SAX.json +210 -0
  803. teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +143 -0
  804. teradataml/data/jsons/uaf/17.20/TD_SELECTION_CRITERIA.json +90 -0
  805. teradataml/data/jsons/uaf/17.20/TD_SIGNIF_PERIODICITIES.json +80 -0
  806. teradataml/data/jsons/uaf/17.20/TD_SIGNIF_RESIDMEAN.json +68 -0
  807. teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +184 -0
  808. teradataml/data/jsons/uaf/17.20/TD_SINFO.json +58 -0
  809. teradataml/data/jsons/uaf/17.20/TD_SMOOTHMA.json +163 -0
  810. teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +101 -0
  811. teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +112 -0
  812. teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +95 -0
  813. teradataml/data/jsons/uaf/17.20/TD_WHITES_GENERAL.json +78 -0
  814. teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +410 -0
  815. teradataml/data/kmeans_example.json +23 -0
  816. teradataml/data/kmeans_table.csv +10 -0
  817. teradataml/data/kmeans_us_arrests_data.csv +51 -0
  818. teradataml/data/knn_example.json +19 -0
  819. teradataml/data/knnrecommender_example.json +7 -0
  820. teradataml/data/knnrecommenderpredict_example.json +12 -0
  821. teradataml/data/lar_example.json +17 -0
  822. teradataml/data/larpredict_example.json +30 -0
  823. teradataml/data/lc_new_predictors.csv +5 -0
  824. teradataml/data/lc_new_reference.csv +9 -0
  825. teradataml/data/lda_example.json +9 -0
  826. teradataml/data/ldainference_example.json +15 -0
  827. teradataml/data/ldatopicsummary_example.json +9 -0
  828. teradataml/data/levendist_input.csv +13 -0
  829. teradataml/data/levenshteindistance_example.json +10 -0
  830. teradataml/data/linreg_example.json +10 -0
  831. teradataml/data/load_example_data.py +350 -0
  832. teradataml/data/loan_prediction.csv +295 -0
  833. teradataml/data/lungcancer.csv +138 -0
  834. teradataml/data/mappingdata.csv +12 -0
  835. teradataml/data/medical_readings.csv +101 -0
  836. teradataml/data/milk_timeseries.csv +157 -0
  837. teradataml/data/min_max_titanic.csv +4 -0
  838. teradataml/data/minhash_example.json +6 -0
  839. teradataml/data/ml_ratings.csv +7547 -0
  840. teradataml/data/ml_ratings_10.csv +2445 -0
  841. teradataml/data/mobile_data.csv +13 -0
  842. teradataml/data/model1_table.csv +5 -0
  843. teradataml/data/model2_table.csv +5 -0
  844. teradataml/data/models/License_file.txt +1 -0
  845. teradataml/data/models/License_file_empty.txt +0 -0
  846. teradataml/data/models/dataiku_iris_data_ann_thin +0 -0
  847. teradataml/data/models/dr_iris_rf +0 -0
  848. teradataml/data/models/iris_db_dt_model_sklearn.onnx +0 -0
  849. teradataml/data/models/iris_db_dt_model_sklearn_floattensor.onnx +0 -0
  850. teradataml/data/models/iris_db_glm_model.pmml +57 -0
  851. teradataml/data/models/iris_db_xgb_model.pmml +4471 -0
  852. teradataml/data/models/iris_kmeans_model +0 -0
  853. teradataml/data/models/iris_mojo_glm_h2o_model +0 -0
  854. teradataml/data/models/iris_mojo_xgb_h2o_model +0 -0
  855. teradataml/data/modularity_example.json +12 -0
  856. teradataml/data/movavg_example.json +8 -0
  857. teradataml/data/mtx1.csv +7 -0
  858. teradataml/data/mtx2.csv +13 -0
  859. teradataml/data/multi_model_classification.csv +401 -0
  860. teradataml/data/multi_model_regression.csv +401 -0
  861. teradataml/data/mvdfft8.csv +9 -0
  862. teradataml/data/naivebayes_example.json +10 -0
  863. teradataml/data/naivebayespredict_example.json +19 -0
  864. teradataml/data/naivebayestextclassifier2_example.json +7 -0
  865. teradataml/data/naivebayestextclassifier_example.json +8 -0
  866. teradataml/data/naivebayestextclassifierpredict_example.json +32 -0
  867. teradataml/data/name_Find_configure.csv +10 -0
  868. teradataml/data/namedentityfinder_example.json +14 -0
  869. teradataml/data/namedentityfinderevaluator_example.json +10 -0
  870. teradataml/data/namedentityfindertrainer_example.json +6 -0
  871. teradataml/data/nb_iris_input_test.csv +31 -0
  872. teradataml/data/nb_iris_input_train.csv +121 -0
  873. teradataml/data/nbp_iris_model.csv +13 -0
  874. teradataml/data/ner_dict.csv +8 -0
  875. teradataml/data/ner_extractor_text.csv +2 -0
  876. teradataml/data/ner_input_eng.csv +7 -0
  877. teradataml/data/ner_rule.csv +5 -0
  878. teradataml/data/ner_sports_test2.csv +29 -0
  879. teradataml/data/ner_sports_train.csv +501 -0
  880. teradataml/data/nerevaluator_example.json +6 -0
  881. teradataml/data/nerextractor_example.json +18 -0
  882. teradataml/data/nermem_sports_test.csv +18 -0
  883. teradataml/data/nermem_sports_train.csv +51 -0
  884. teradataml/data/nertrainer_example.json +7 -0
  885. teradataml/data/ngrams_example.json +7 -0
  886. teradataml/data/notebooks/__init__.py +0 -0
  887. teradataml/data/notebooks/sqlalchemy/Teradata Vantage Aggregate Functions using SQLAlchemy.ipynb +1455 -0
  888. teradataml/data/notebooks/sqlalchemy/Teradata Vantage Arithmetic Functions Using SQLAlchemy.ipynb +1993 -0
  889. teradataml/data/notebooks/sqlalchemy/Teradata Vantage Bit-Byte Manipulation Functions using SQLAlchemy.ipynb +1492 -0
  890. teradataml/data/notebooks/sqlalchemy/Teradata Vantage Built-in functions using SQLAlchemy.ipynb +536 -0
  891. teradataml/data/notebooks/sqlalchemy/Teradata Vantage Regular Expressions Using SQLAlchemy.ipynb +570 -0
  892. teradataml/data/notebooks/sqlalchemy/Teradata Vantage String Functions Using SQLAlchemy.ipynb +2559 -0
  893. teradataml/data/notebooks/sqlalchemy/Teradata Vantage Window Aggregate Functions using SQLAlchemy.ipynb +2911 -0
  894. teradataml/data/notebooks/sqlalchemy/Using Generic SQLAlchemy ClauseElements teradataml DataFrame assign method.ipynb +698 -0
  895. teradataml/data/notebooks/sqlalchemy/__init__.py +0 -0
  896. teradataml/data/notebooks/sqlalchemy/teradataml filtering using SQLAlchemy ClauseElements.ipynb +784 -0
  897. teradataml/data/npath_example.json +23 -0
  898. teradataml/data/ntree_example.json +14 -0
  899. teradataml/data/numeric_strings.csv +5 -0
  900. teradataml/data/numerics.csv +4 -0
  901. teradataml/data/ocean_buoy.csv +17 -0
  902. teradataml/data/ocean_buoy2.csv +17 -0
  903. teradataml/data/ocean_buoys.csv +28 -0
  904. teradataml/data/ocean_buoys2.csv +10 -0
  905. teradataml/data/ocean_buoys_nonpti.csv +28 -0
  906. teradataml/data/ocean_buoys_seq.csv +29 -0
  907. teradataml/data/onehot_encoder_train.csv +4 -0
  908. teradataml/data/openml_example.json +92 -0
  909. teradataml/data/optional_event_table.csv +4 -0
  910. teradataml/data/orders1.csv +11 -0
  911. teradataml/data/orders1_12.csv +13 -0
  912. teradataml/data/orders_ex.csv +4 -0
  913. teradataml/data/pack_example.json +9 -0
  914. teradataml/data/package_tracking.csv +19 -0
  915. teradataml/data/package_tracking_pti.csv +19 -0
  916. teradataml/data/pagerank_example.json +13 -0
  917. teradataml/data/paragraphs_input.csv +6 -0
  918. teradataml/data/pathanalyzer_example.json +8 -0
  919. teradataml/data/pathgenerator_example.json +8 -0
  920. teradataml/data/patient_profile.csv +101 -0
  921. teradataml/data/pattern_matching_data.csv +11 -0
  922. teradataml/data/payment_fraud_dataset.csv +10001 -0
  923. teradataml/data/peppers.png +0 -0
  924. teradataml/data/phrases.csv +7 -0
  925. teradataml/data/pivot_example.json +9 -0
  926. teradataml/data/pivot_input.csv +22 -0
  927. teradataml/data/playerRating.csv +31 -0
  928. teradataml/data/pos_input.csv +40 -0
  929. teradataml/data/postagger_example.json +7 -0
  930. teradataml/data/posttagger_output.csv +44 -0
  931. teradataml/data/production_data.csv +17 -0
  932. teradataml/data/production_data2.csv +7 -0
  933. teradataml/data/randomsample_example.json +32 -0
  934. teradataml/data/randomwalksample_example.json +9 -0
  935. teradataml/data/rank_table.csv +6 -0
  936. teradataml/data/real_values.csv +14 -0
  937. teradataml/data/ref_mobile_data.csv +4 -0
  938. teradataml/data/ref_mobile_data_dense.csv +2 -0
  939. teradataml/data/ref_url.csv +17 -0
  940. teradataml/data/restaurant_reviews.csv +7 -0
  941. teradataml/data/retail_churn_table.csv +27772 -0
  942. teradataml/data/river_data.csv +145 -0
  943. teradataml/data/roc_example.json +8 -0
  944. teradataml/data/roc_input.csv +101 -0
  945. teradataml/data/rule_inputs.csv +6 -0
  946. teradataml/data/rule_table.csv +2 -0
  947. teradataml/data/sales.csv +7 -0
  948. teradataml/data/sales_transaction.csv +501 -0
  949. teradataml/data/salesdata.csv +342 -0
  950. teradataml/data/sample_cities.csv +3 -0
  951. teradataml/data/sample_shapes.csv +11 -0
  952. teradataml/data/sample_streets.csv +3 -0
  953. teradataml/data/sampling_example.json +16 -0
  954. teradataml/data/sax_example.json +17 -0
  955. teradataml/data/scale_attributes.csv +3 -0
  956. teradataml/data/scale_example.json +74 -0
  957. teradataml/data/scale_housing.csv +11 -0
  958. teradataml/data/scale_housing_test.csv +6 -0
  959. teradataml/data/scale_input_part_sparse.csv +31 -0
  960. teradataml/data/scale_input_partitioned.csv +16 -0
  961. teradataml/data/scale_input_sparse.csv +11 -0
  962. teradataml/data/scale_parameters.csv +3 -0
  963. teradataml/data/scale_stat.csv +11 -0
  964. teradataml/data/scalebypartition_example.json +13 -0
  965. teradataml/data/scalemap_example.json +13 -0
  966. teradataml/data/scalesummary_example.json +12 -0
  967. teradataml/data/score_category.csv +101 -0
  968. teradataml/data/score_summary.csv +4 -0
  969. teradataml/data/script_example.json +10 -0
  970. teradataml/data/scripts/deploy_script.py +84 -0
  971. teradataml/data/scripts/lightgbm/dataset.template +175 -0
  972. teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +264 -0
  973. teradataml/data/scripts/lightgbm/lightgbm_function.template +234 -0
  974. teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +177 -0
  975. teradataml/data/scripts/mapper.R +20 -0
  976. teradataml/data/scripts/mapper.py +16 -0
  977. teradataml/data/scripts/mapper_replace.py +16 -0
  978. teradataml/data/scripts/sklearn/__init__.py +0 -0
  979. teradataml/data/scripts/sklearn/sklearn_fit.py +205 -0
  980. teradataml/data/scripts/sklearn/sklearn_fit_predict.py +148 -0
  981. teradataml/data/scripts/sklearn/sklearn_function.template +144 -0
  982. teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +166 -0
  983. teradataml/data/scripts/sklearn/sklearn_neighbors.py +161 -0
  984. teradataml/data/scripts/sklearn/sklearn_score.py +145 -0
  985. teradataml/data/scripts/sklearn/sklearn_transform.py +327 -0
  986. teradataml/data/sdk/modelops/modelops_spec.json +101737 -0
  987. teradataml/data/seeds.csv +10 -0
  988. teradataml/data/sentenceextractor_example.json +7 -0
  989. teradataml/data/sentiment_extract_input.csv +11 -0
  990. teradataml/data/sentiment_train.csv +16 -0
  991. teradataml/data/sentiment_word.csv +20 -0
  992. teradataml/data/sentiment_word_input.csv +20 -0
  993. teradataml/data/sentimentextractor_example.json +24 -0
  994. teradataml/data/sentimenttrainer_example.json +8 -0
  995. teradataml/data/sequence_table.csv +10 -0
  996. teradataml/data/seriessplitter_example.json +8 -0
  997. teradataml/data/sessionize_example.json +17 -0
  998. teradataml/data/sessionize_table.csv +116 -0
  999. teradataml/data/setop_test1.csv +24 -0
  1000. teradataml/data/setop_test2.csv +22 -0
  1001. teradataml/data/soc_nw_edges.csv +11 -0
  1002. teradataml/data/soc_nw_vertices.csv +8 -0
  1003. teradataml/data/souvenir_timeseries.csv +168 -0
  1004. teradataml/data/sparse_iris_attribute.csv +5 -0
  1005. teradataml/data/sparse_iris_test.csv +121 -0
  1006. teradataml/data/sparse_iris_train.csv +601 -0
  1007. teradataml/data/star1.csv +6 -0
  1008. teradataml/data/star_pivot.csv +8 -0
  1009. teradataml/data/state_transition.csv +5 -0
  1010. teradataml/data/stock_data.csv +53 -0
  1011. teradataml/data/stock_movement.csv +11 -0
  1012. teradataml/data/stock_vol.csv +76 -0
  1013. teradataml/data/stop_words.csv +8 -0
  1014. teradataml/data/store_sales.csv +37 -0
  1015. teradataml/data/stringsimilarity_example.json +8 -0
  1016. teradataml/data/strsimilarity_input.csv +13 -0
  1017. teradataml/data/students.csv +101 -0
  1018. teradataml/data/svm_iris_input_test.csv +121 -0
  1019. teradataml/data/svm_iris_input_train.csv +481 -0
  1020. teradataml/data/svm_iris_model.csv +7 -0
  1021. teradataml/data/svmdense_example.json +10 -0
  1022. teradataml/data/svmdensepredict_example.json +19 -0
  1023. teradataml/data/svmsparse_example.json +8 -0
  1024. teradataml/data/svmsparsepredict_example.json +14 -0
  1025. teradataml/data/svmsparsesummary_example.json +8 -0
  1026. teradataml/data/target_mobile_data.csv +13 -0
  1027. teradataml/data/target_mobile_data_dense.csv +5 -0
  1028. teradataml/data/target_udt_data.csv +8 -0
  1029. teradataml/data/tdnerextractor_example.json +14 -0
  1030. teradataml/data/templatedata.csv +1201 -0
  1031. teradataml/data/templates/open_source_ml.json +11 -0
  1032. teradataml/data/teradata_icon.ico +0 -0
  1033. teradataml/data/teradataml_example.json +1473 -0
  1034. teradataml/data/test_classification.csv +101 -0
  1035. teradataml/data/test_loan_prediction.csv +53 -0
  1036. teradataml/data/test_pacf_12.csv +37 -0
  1037. teradataml/data/test_prediction.csv +101 -0
  1038. teradataml/data/test_regression.csv +101 -0
  1039. teradataml/data/test_river2.csv +109 -0
  1040. teradataml/data/text_inputs.csv +6 -0
  1041. teradataml/data/textchunker_example.json +8 -0
  1042. teradataml/data/textclassifier_example.json +7 -0
  1043. teradataml/data/textclassifier_input.csv +7 -0
  1044. teradataml/data/textclassifiertrainer_example.json +7 -0
  1045. teradataml/data/textmorph_example.json +11 -0
  1046. teradataml/data/textparser_example.json +15 -0
  1047. teradataml/data/texttagger_example.json +12 -0
  1048. teradataml/data/texttokenizer_example.json +7 -0
  1049. teradataml/data/texttrainer_input.csv +11 -0
  1050. teradataml/data/tf_example.json +7 -0
  1051. teradataml/data/tfidf_example.json +14 -0
  1052. teradataml/data/tfidf_input1.csv +201 -0
  1053. teradataml/data/tfidf_train.csv +6 -0
  1054. teradataml/data/time_table1.csv +535 -0
  1055. teradataml/data/time_table2.csv +14 -0
  1056. teradataml/data/timeseriesdata.csv +1601 -0
  1057. teradataml/data/timeseriesdatasetsd4.csv +105 -0
  1058. teradataml/data/timestamp_data.csv +4 -0
  1059. teradataml/data/titanic.csv +892 -0
  1060. teradataml/data/titanic_dataset_unpivoted.csv +19 -0
  1061. teradataml/data/to_num_data.csv +4 -0
  1062. teradataml/data/tochar_data.csv +5 -0
  1063. teradataml/data/token_table.csv +696 -0
  1064. teradataml/data/train_multiclass.csv +101 -0
  1065. teradataml/data/train_regression.csv +101 -0
  1066. teradataml/data/train_regression_multiple_labels.csv +101 -0
  1067. teradataml/data/train_tracking.csv +28 -0
  1068. teradataml/data/trans_dense.csv +16 -0
  1069. teradataml/data/trans_sparse.csv +55 -0
  1070. teradataml/data/transformation_table.csv +6 -0
  1071. teradataml/data/transformation_table_new.csv +2 -0
  1072. teradataml/data/tv_spots.csv +16 -0
  1073. teradataml/data/twod_climate_data.csv +117 -0
  1074. teradataml/data/uaf_example.json +529 -0
  1075. teradataml/data/univariatestatistics_example.json +9 -0
  1076. teradataml/data/unpack_example.json +10 -0
  1077. teradataml/data/unpivot_example.json +25 -0
  1078. teradataml/data/unpivot_input.csv +8 -0
  1079. teradataml/data/url_data.csv +10 -0
  1080. teradataml/data/us_air_pass.csv +37 -0
  1081. teradataml/data/us_population.csv +624 -0
  1082. teradataml/data/us_states_shapes.csv +52 -0
  1083. teradataml/data/varmax_example.json +18 -0
  1084. teradataml/data/vectordistance_example.json +30 -0
  1085. teradataml/data/ville_climatedata.csv +121 -0
  1086. teradataml/data/ville_tempdata.csv +12 -0
  1087. teradataml/data/ville_tempdata1.csv +12 -0
  1088. teradataml/data/ville_temperature.csv +11 -0
  1089. teradataml/data/waveletTable.csv +1605 -0
  1090. teradataml/data/waveletTable2.csv +1605 -0
  1091. teradataml/data/weightedmovavg_example.json +9 -0
  1092. teradataml/data/wft_testing.csv +5 -0
  1093. teradataml/data/windowdfft.csv +16 -0
  1094. teradataml/data/wine_data.csv +1600 -0
  1095. teradataml/data/word_embed_input_table1.csv +6 -0
  1096. teradataml/data/word_embed_input_table2.csv +5 -0
  1097. teradataml/data/word_embed_model.csv +23 -0
  1098. teradataml/data/words_input.csv +13 -0
  1099. teradataml/data/xconvolve_complex_left.csv +6 -0
  1100. teradataml/data/xconvolve_complex_leftmulti.csv +6 -0
  1101. teradataml/data/xgboost_example.json +36 -0
  1102. teradataml/data/xgboostpredict_example.json +32 -0
  1103. teradataml/data/ztest_example.json +16 -0
  1104. teradataml/dataframe/__init__.py +0 -0
  1105. teradataml/dataframe/copy_to.py +2446 -0
  1106. teradataml/dataframe/data_transfer.py +2840 -0
  1107. teradataml/dataframe/dataframe.py +20908 -0
  1108. teradataml/dataframe/dataframe_utils.py +2114 -0
  1109. teradataml/dataframe/fastload.py +794 -0
  1110. teradataml/dataframe/functions.py +2110 -0
  1111. teradataml/dataframe/indexer.py +424 -0
  1112. teradataml/dataframe/row.py +160 -0
  1113. teradataml/dataframe/setop.py +1171 -0
  1114. teradataml/dataframe/sql.py +10904 -0
  1115. teradataml/dataframe/sql_function_parameters.py +440 -0
  1116. teradataml/dataframe/sql_functions.py +652 -0
  1117. teradataml/dataframe/sql_interfaces.py +220 -0
  1118. teradataml/dataframe/vantage_function_types.py +675 -0
  1119. teradataml/dataframe/window.py +694 -0
  1120. teradataml/dbutils/__init__.py +3 -0
  1121. teradataml/dbutils/dbutils.py +2871 -0
  1122. teradataml/dbutils/filemgr.py +318 -0
  1123. teradataml/gen_ai/__init__.py +2 -0
  1124. teradataml/gen_ai/convAI.py +473 -0
  1125. teradataml/geospatial/__init__.py +4 -0
  1126. teradataml/geospatial/geodataframe.py +1105 -0
  1127. teradataml/geospatial/geodataframecolumn.py +392 -0
  1128. teradataml/geospatial/geometry_types.py +926 -0
  1129. teradataml/hyperparameter_tuner/__init__.py +1 -0
  1130. teradataml/hyperparameter_tuner/optimizer.py +4115 -0
  1131. teradataml/hyperparameter_tuner/utils.py +303 -0
  1132. teradataml/lib/__init__.py +0 -0
  1133. teradataml/lib/aed_0_1.dll +0 -0
  1134. teradataml/lib/libaed_0_1.dylib +0 -0
  1135. teradataml/lib/libaed_0_1.so +0 -0
  1136. teradataml/lib/libaed_0_1_aarch64.so +0 -0
  1137. teradataml/lib/libaed_0_1_ppc64le.so +0 -0
  1138. teradataml/opensource/__init__.py +1 -0
  1139. teradataml/opensource/_base.py +1321 -0
  1140. teradataml/opensource/_class.py +464 -0
  1141. teradataml/opensource/_constants.py +61 -0
  1142. teradataml/opensource/_lightgbm.py +949 -0
  1143. teradataml/opensource/_sklearn.py +1008 -0
  1144. teradataml/opensource/_wrapper_utils.py +267 -0
  1145. teradataml/options/__init__.py +148 -0
  1146. teradataml/options/configure.py +489 -0
  1147. teradataml/options/display.py +187 -0
  1148. teradataml/plot/__init__.py +3 -0
  1149. teradataml/plot/axis.py +1427 -0
  1150. teradataml/plot/constants.py +15 -0
  1151. teradataml/plot/figure.py +431 -0
  1152. teradataml/plot/plot.py +810 -0
  1153. teradataml/plot/query_generator.py +83 -0
  1154. teradataml/plot/subplot.py +216 -0
  1155. teradataml/scriptmgmt/UserEnv.py +4273 -0
  1156. teradataml/scriptmgmt/__init__.py +3 -0
  1157. teradataml/scriptmgmt/lls_utils.py +2157 -0
  1158. teradataml/sdk/README.md +79 -0
  1159. teradataml/sdk/__init__.py +4 -0
  1160. teradataml/sdk/_auth_modes.py +422 -0
  1161. teradataml/sdk/_func_params.py +487 -0
  1162. teradataml/sdk/_json_parser.py +453 -0
  1163. teradataml/sdk/_openapi_spec_constants.py +249 -0
  1164. teradataml/sdk/_utils.py +236 -0
  1165. teradataml/sdk/api_client.py +900 -0
  1166. teradataml/sdk/constants.py +62 -0
  1167. teradataml/sdk/modelops/__init__.py +98 -0
  1168. teradataml/sdk/modelops/_client.py +409 -0
  1169. teradataml/sdk/modelops/_constants.py +304 -0
  1170. teradataml/sdk/modelops/models.py +2308 -0
  1171. teradataml/sdk/spinner.py +107 -0
  1172. teradataml/series/__init__.py +0 -0
  1173. teradataml/series/series.py +537 -0
  1174. teradataml/series/series_utils.py +71 -0
  1175. teradataml/store/__init__.py +12 -0
  1176. teradataml/store/feature_store/__init__.py +0 -0
  1177. teradataml/store/feature_store/constants.py +658 -0
  1178. teradataml/store/feature_store/feature_store.py +4814 -0
  1179. teradataml/store/feature_store/mind_map.py +639 -0
  1180. teradataml/store/feature_store/models.py +7330 -0
  1181. teradataml/store/feature_store/utils.py +390 -0
  1182. teradataml/table_operators/Apply.py +979 -0
  1183. teradataml/table_operators/Script.py +1739 -0
  1184. teradataml/table_operators/TableOperator.py +1343 -0
  1185. teradataml/table_operators/__init__.py +2 -0
  1186. teradataml/table_operators/apply_query_generator.py +262 -0
  1187. teradataml/table_operators/query_generator.py +493 -0
  1188. teradataml/table_operators/table_operator_query_generator.py +462 -0
  1189. teradataml/table_operators/table_operator_util.py +726 -0
  1190. teradataml/table_operators/templates/dataframe_apply.template +184 -0
  1191. teradataml/table_operators/templates/dataframe_map.template +176 -0
  1192. teradataml/table_operators/templates/dataframe_register.template +73 -0
  1193. teradataml/table_operators/templates/dataframe_udf.template +67 -0
  1194. teradataml/table_operators/templates/script_executor.template +170 -0
  1195. teradataml/telemetry_utils/__init__.py +0 -0
  1196. teradataml/telemetry_utils/queryband.py +53 -0
  1197. teradataml/utils/__init__.py +0 -0
  1198. teradataml/utils/docstring.py +527 -0
  1199. teradataml/utils/dtypes.py +943 -0
  1200. teradataml/utils/internal_buffer.py +122 -0
  1201. teradataml/utils/print_versions.py +206 -0
  1202. teradataml/utils/utils.py +451 -0
  1203. teradataml/utils/validators.py +3305 -0
  1204. teradataml-20.0.0.8.dist-info/METADATA +2804 -0
  1205. teradataml-20.0.0.8.dist-info/RECORD +1208 -0
  1206. teradataml-20.0.0.8.dist-info/WHEEL +5 -0
  1207. teradataml-20.0.0.8.dist-info/top_level.txt +1 -0
  1208. teradataml-20.0.0.8.dist-info/zip-safe +1 -0
@@ -0,0 +1,3305 @@
1
+ import datetime
2
+ import enum
3
+ import numbers
4
+ import os
5
+ import pandas as pd
6
+ from pathlib import Path
7
+ import re
8
+ from sqlalchemy import func
9
+ from teradataml.common.constants import TeradataConstants, PTITableConstants, PythonTypes, DataFrameTypes
10
+ from teradataml.common.exceptions import TeradataMlException
11
+ from teradataml.common.messages import MessageCodes, Messages
12
+ from teradataml.utils.dtypes import _Dtypes, _DtypesMappers, _ListOf, _TupleOf
13
+ from teradataml.options.configure import configure
14
+ from teradataml.dataframe.sql_interfaces import ColumnExpression
15
+ from functools import wraps, reduce
16
+ from teradatasqlalchemy import (PERIOD_DATE, PERIOD_TIMESTAMP)
17
+
18
+ from teradataml.utils.internal_buffer import _InternalBuffer
19
+
20
+
21
+ def skip_validation():
22
+ """
23
+ DESCRIPTION:
24
+ Define for skipping the validation.
25
+
26
+ PARAMETERS:
27
+ None
28
+
29
+ EXAMPLES:
30
+ @skip_validation(skip_all=True)
31
+ def validation_func(): ...
32
+
33
+ """
34
+
35
+ def decorator(func):
36
+ def wrapper(*args, **kwargs):
37
+ # If "skip_all" flag is set to False,
38
+ # skip all validation execution.
39
+ if not _Validators.skip_all:
40
+ return func(*args, **kwargs)
41
+
42
+ return wraps(func)(wrapper)
43
+
44
+ return decorator
45
+
46
+
47
+ class _Validators:
48
+ """
49
+ A class containing set of utilities that can be used for validations of various kinds.
50
+ Currently, this facilitates the validations done for:
51
+ 1. Analytic function execution engine: (_validate_engine)
52
+ 2. Validation for the vantage_version: (_validate_vantage_version)
53
+ 3. Validate whether argument has passed with empty string or not: (_validate_input_columns_not_empty)
54
+ 4. Validate for permitted values of the argument: (_validate_permitted_values)
55
+ 5. Validate function arguments. (_validate_function_arguments) This specifically validates for
56
+ 1. Argument types check.
57
+ 2. Argument is empty or not.
58
+ 3. Permitted values check.
59
+ 6. Validate for missing required arguments.
60
+ 7. Validate column exists in a DataFrame or not. (_validate_column_exists_in_dataframe)
61
+ 8. Validate required arguments are missing or not. (_validate_missing_required_arguments)
62
+ 9. Validate whether function install location is set.
63
+ 10. Validate whether the table exist in the schema or not
64
+ 11. Validate whether the given file is not empty, given absolute file path.
65
+ 12. Validate whether "arg1" and "arg2" are mutually inclusive.
66
+ """
67
+
68
+ # "skip_all" specifies to skip all the executions.
69
+ skip_all = False
70
+
71
+ @staticmethod
72
+ @skip_validation()
73
+ def __getTypeAsStr(type_list):
74
+ """
75
+ Function to convert type to string.
76
+
77
+ PARAMETERS:
78
+ type_list
79
+ Required Argument.
80
+ A tuple of types or a type to be converted to string.
81
+
82
+ RAISES:
83
+ None
84
+
85
+ RETURNS:
86
+ A list of strings representing types in type_list.
87
+
88
+ EXAMPLES:
89
+ _Validators.__getTypeAsStr(type_list)
90
+ """
91
+ type_as_str = []
92
+ if isinstance(type_list, tuple):
93
+ for typ in type_list:
94
+ if isinstance(typ, tuple):
95
+ for typ1 in typ:
96
+ type_as_str.append(typ1.__name__)
97
+ elif isinstance(typ, (_ListOf, _TupleOf)):
98
+ type_as_str.append(str(typ))
99
+ elif typ is pd.DataFrame:
100
+ type_as_str.append("pandas DataFrame")
101
+ elif typ.__name__ == "DataFrame":
102
+ type_as_str.append("teradataml DataFrame")
103
+ else:
104
+ type_as_str.append(typ.__name__)
105
+
106
+ if isinstance(type_list, type):
107
+ if type_list is pd.DataFrame:
108
+ type_as_str.append("pandas DataFrame")
109
+ elif type_list.__name__ == "DataFrame":
110
+ type_as_str.append("teradataml DataFrame")
111
+ else:
112
+ type_as_str.append(type_list.__name__)
113
+
114
+ if isinstance(type_list, (_ListOf, _TupleOf)):
115
+ type_as_str.append(str(type_list))
116
+
117
+ return type_as_str
118
+
119
+ @staticmethod
120
+ @skip_validation()
121
+ def _check_isinstance(obj, class_or_tuple):
122
+ """
123
+ Function checks whether an object is an instance of a class.
124
+
125
+ PARAMETER
126
+ obj:
127
+ Required Argument.
128
+ Specifies the object to check instance of.
129
+
130
+ class_or_tuple:
131
+ Required Argument.
132
+ Specifies the type or tuple of types to check instance against.
133
+
134
+ RAISES:
135
+ None.
136
+
137
+ RETURNS:
138
+ True, if obj is instance of class_or_tuple
139
+
140
+ EXAMPLES:
141
+ _Validators._check_isinstance(obj, (int, list, str))
142
+ """
143
+ # If obj is of type bool and type to check against contains int, then we must
144
+ # check/validate the instance as type(obj) == class_or_tuple.
145
+ # bool is subclass of int, hence isinstance(True, int) will always return true.
146
+ # And we would like to return false, as bool is not a int.
147
+ if not isinstance(obj, bool):
148
+ # If obj of any type other than bool, then we shall use "isinstance()"
149
+ # to perform type checks.
150
+ return isinstance(obj, class_or_tuple)
151
+
152
+ else:
153
+ # 'obj' is of type bool.
154
+ if isinstance(class_or_tuple, tuple):
155
+ if int not in class_or_tuple:
156
+ # If class_or_tuple is instance of tuple and int is not in class_or_tuple
157
+ # use "isinstance()" to validate type check for obj.
158
+ return isinstance(obj, class_or_tuple)
159
+ else:
160
+ return type(obj) in class_or_tuple
161
+
162
+ else: # isinstance(class_or_tuple, type):
163
+ if int != class_or_tuple:
164
+ # If class_or_tuple is instance of type and class_or_tuple is not an int
165
+ # use "isinstance()" to validate type check for obj.
166
+ return isinstance(obj, class_or_tuple)
167
+ else:
168
+ return type(obj) == class_or_tuple
169
+
170
+ @staticmethod
171
+ @skip_validation()
172
+ def _validate_columnexpression_dataframe_has_columns(columns,
173
+ arg_name,
174
+ column_expression):
175
+ """
176
+ DESCRIPTION:
177
+ Function to check whether column name(s) available in dataframe
178
+ or not from a given column. This function is used currently
179
+ only for Window Aggregates.
180
+
181
+ PARAMETERS:
182
+ columns:
183
+ Required Argument.
184
+ Specifies the name or list of names of columns to be validated
185
+ for existence.
186
+ Types: str or List of strings or ColumnExpression or list of ColumnExpression
187
+
188
+ arg_name:
189
+ Required Argument.
190
+ Specifies the name of the argument.
191
+ Types: str
192
+
193
+ column_expression:
194
+ Required Argument.
195
+ Specifies teradataml DataFrame Column to check against for
196
+ column existence.
197
+ Types: ColumnExpression
198
+
199
+ RAISES:
200
+ ValueError
201
+
202
+ RETURNS:
203
+ bool
204
+
205
+ EXAMPLES:
206
+ _Validators._validate_dataframe_has_argument_columns_from_column(self.data_sequence_column,
207
+ "data_sequence_column",
208
+ self.data.col)
209
+ """
210
+ if not columns:
211
+ return True
212
+ from teradataml.common.utils import UtilFuncs
213
+ # Converting columns to a list if string is passed.
214
+ if not isinstance(columns, list):
215
+ columns = [columns]
216
+
217
+ df_columns = UtilFuncs._all_df_columns(column_expression)
218
+
219
+ # Let's validate existence of each column one by one.
220
+ columns_ = []
221
+ for column in columns:
222
+ if isinstance(column, str):
223
+ columns_.append(column)
224
+ else:
225
+ columns_ = columns_ + UtilFuncs._all_df_columns(column)
226
+
227
+ # Let's validate existence of each column one by one.
228
+ for column_name in columns_:
229
+ # If column name does not exist in DataFrame of a column, raise the exception.
230
+ if column_name not in df_columns:
231
+ message = "{}. Check the argument '{}'".format(sorted(df_columns), arg_name)
232
+ raise ValueError(Messages.get_message(MessageCodes.TDMLDF_DROP_INVALID_COL,
233
+ column_name,
234
+ message
235
+ ))
236
+ return True
237
+
238
+ @staticmethod
239
+ @skip_validation()
240
+ def _validate_invalid_column_types(all_columns, column_arg, columns_to_check, invalid_types):
241
+ """
242
+ DESCRIPTION:
243
+ Function to validate the invalid types for "columns_to_check" from "all_columns".
244
+
245
+ PARAMETERS:
246
+ all_columns:
247
+ Required Argument.
248
+ Specifies the ColumnExpressions.
249
+ Types: List of ColumnExpression
250
+
251
+ column_arg:
252
+ Required Argument.
253
+ Specifies the name of the argument.
254
+ Types: str
255
+
256
+ columns_to_check:
257
+ Required Argument.
258
+ Specifies columns to check for invalid types.
259
+ Types: str OR list of str OR ColumnExpression OR list of ColumnExpression
260
+
261
+ invalid_types:
262
+ Required Argument.
263
+ Specifies list of invalid teradata types to check against "columns".
264
+ Types: list
265
+
266
+ RAISES:
267
+ ValueError
268
+
269
+ RETURNS:
270
+ bool
271
+
272
+ EXAMPLES:
273
+ _Validators._validate_invalid_column_types(columns, column_arg, invalid_types)
274
+ """
275
+ columns_and_types = {c.name.lower(): type(c.type) for c in all_columns}
276
+ get_col_type = lambda column: columns_and_types[column.lower()].__name__ if isinstance(
277
+ column, str) else column.type.__class__.__name__
278
+
279
+ invalid_types = ["{}({})".format(column if isinstance(column, str) else column.name, get_col_type(column))
280
+ for column in columns_to_check if get_col_type(column)
281
+ in [t.__name__ for t in _Dtypes._get_sort_unsupported_data_types()]
282
+ ]
283
+
284
+ if invalid_types:
285
+ invalid_column_types = (col_type.__name__ for col_type in
286
+ _Dtypes._get_sort_unsupported_data_types())
287
+ error_message = Messages.get_message(MessageCodes.INVALID_COLUMN_DATATYPE,
288
+ ", ".join(invalid_types),
289
+ column_arg,
290
+ "Unsupported",
291
+ ", ".join(invalid_column_types))
292
+
293
+ raise ValueError(error_message)
294
+
295
+ return True
296
+
297
+ @staticmethod
298
+ @skip_validation()
299
+ def _validate_dataframe_has_argument_columns(columns, column_arg, data, data_arg, is_partition_arg=False,
300
+ case_insensitive=False):
301
+ """
302
+ Function to check whether column names in columns are present in given dataframe or not.
303
+ This function is used currently only for Analytics wrappers.
304
+
305
+ PARAMETERS:
306
+ columns:
307
+ Required Argument.
308
+ Specifies name or list of names of columns to be validated for existence.
309
+ Types: str or List of strings
310
+
311
+ column_arg:
312
+ Required Argument.
313
+ Specifies the name of the argument.
314
+ Types: str
315
+
316
+ data:
317
+ Required Argument.
318
+ Specifies teradataml DataFrame to check against for column existence.
319
+ Types: teradataml DataFrame
320
+
321
+ data_arg:
322
+ Required Argument.
323
+ Specifies the name of the dataframe argument.
324
+ Types: str
325
+
326
+ is_partition_arg:
327
+ Optional Argument.
328
+ Specifies a bool argument notifying, whether argument being validate is
329
+ Partition argument or not.
330
+ Types: bool
331
+
332
+ case_insensitive:
333
+ Optional Argument.
334
+ Specifies a bool argument notifying, whether to check column names
335
+ in case-insensitive manner or not.
336
+ Default Value: False
337
+ Types: bool
338
+
339
+ RAISES:
340
+ TeradataMlException - TDMLDF_COLUMN_IN_ARG_NOT_FOUND column(s) does not exist in a dataframe.
341
+
342
+ EXAMPLES:
343
+ _Validators._validate_dataframe_has_argument_columns(self.data_sequence_column, "data_sequence_column", self.data, "data")
344
+ _Validators._validate_dataframe_has_argument_columns(self.data_partition_column, "data_sequence_column", self.data, "data", true)
345
+ """
346
+ if is_partition_arg and columns is None:
347
+ return True
348
+
349
+ if columns is None:
350
+ return True
351
+
352
+ _Validators._validate_dependent_argument(column_arg, columns, data_arg, data)
353
+
354
+ # Converting columns to a list if string is passed.
355
+ if not isinstance(columns, list) and columns is not None:
356
+ columns = [columns]
357
+
358
+ total_columns = []
359
+
360
+ for column in columns:
361
+ for separator in TeradataConstants.RANGE_SEPARATORS.value:
362
+ if column is None:
363
+ total_columns.append(column)
364
+ elif column[0] == "-":
365
+ # If column has exclude operator "-".
366
+ # For example incase of "-[50]", let database handle validation.
367
+ if re.match(r'-\[\d+\]', column) is not None:
368
+ continue
369
+ total_columns.append(column[1:])
370
+ elif column.count(separator) == 1:
371
+ # Following cases can occur:
372
+ # '3:5' or 'colA:colE'
373
+ # ':4' or ':columnD' specifies all columns up to and including the column with index 4(or columnD).
374
+ # '4:' or 'columnD:' specifies the column with index 4(or columnD) and all columns after it.
375
+ # ':' specifies all columns in the table.
376
+
377
+ try:
378
+ # Check if it's a single column with one separator. For e.g. column:A.
379
+ # If yes, just continue.
380
+ _Validators._validate_column_exists_in_dataframe(column, data._metaexpr,
381
+ case_insensitive=case_insensitive)
382
+ continue
383
+ except:
384
+ # User has provided range value.
385
+ column_names = column.split(separator)
386
+ if (len(column_names) == 2 and
387
+ any([column_names[0].isdigit(), column_names[1].isdigit()]) and
388
+ not all([column_names[0].isdigit(), column_names[1].isdigit()]) and
389
+ not "" in column_names):
390
+ # Raises Exception if column range has mixed types. For e.g. "4:XYZ".
391
+ err_msg = Messages.get_message(MessageCodes.MIXED_TYPES_IN_COLUMN_RANGE)
392
+ raise ValueError(err_msg.format(column_arg))
393
+
394
+ for col in column_names:
395
+ if not col.isdigit() and col != "":
396
+ total_columns.append(col)
397
+
398
+ elif column.count(separator) > 1:
399
+ continue
400
+ else:
401
+ total_columns.append(column)
402
+
403
+ return _Validators._validate_column_exists_in_dataframe(total_columns, data._metaexpr, column_arg=column_arg,
404
+ data_arg=data_arg, case_insensitive=case_insensitive)
405
+
406
+ @staticmethod
407
+ @skip_validation()
408
+ def _validate_column_exists_in_dataframe(columns, metaexpr, case_insensitive=False, column_arg=None,
409
+ data_arg=None, for_table=False):
410
+ """
411
+ Method to check whether column or list of columns exists in a teradataml DataFrame or not.
412
+
413
+ PARAMETERS:
414
+ columns:
415
+ Required Argument.
416
+ Specifies name or list of names of columns to be validated for existence.
417
+ Types: str or List of strings
418
+
419
+ metaexpr:
420
+ Required Argument.
421
+ Specifies a teradataml DataFrame metaexpr to be validated against.
422
+ Types: MetaExpression
423
+
424
+ case_insensitive:
425
+ Optional Argument.
426
+ Specifies a flag, that determines whether to check for column existence in
427
+ case_insensitive manner or not.
428
+ Default Value: False (Case-Sensitive lookup)
429
+ Types: bool
430
+
431
+ column_arg:
432
+ Optional Argument.
433
+ Specifies the name of the argument.
434
+ Types: str
435
+
436
+ data_arg:
437
+ Optional Argument.
438
+ Specifies the name of the dataframe argument or name of the table.
439
+ Types: str
440
+
441
+ for_table:
442
+ Optional Argument.
443
+ Specifies whether error should be raised against table or DataFrame, i.e.,
444
+ when columns are not available and "for_table" is set to False, then
445
+ exception message mentions column(s) not available in DataFrame. When
446
+ columns are not available and "for_table" is set to true, then exception
447
+ message mentions column(s) not available in Table.
448
+ Types: str
449
+
450
+ RAISES:
451
+ ValueError
452
+ TDMLDF_DROP_INVALID_COL - If columns not found in metaexpr.
453
+
454
+ RETURNS:
455
+ None
456
+
457
+ EXAMPLES:
458
+ _Validators._validate_column_exists_in_dataframe(["col1", "col2"], self.metaexpr)
459
+
460
+ """
461
+ if columns is None:
462
+ return True
463
+
464
+ # If just a column name is passed, convert it to a list.
465
+ if isinstance(columns, str):
466
+ columns = [columns]
467
+
468
+ # Constructing New unquoted column names for selected columns ONLY using Parent _metaexpr
469
+ if case_insensitive:
470
+ # If lookup has to be a case-insensitive then convert the
471
+ # metaexpr columns name to lower case.
472
+ unquoted_df_columns = [c.name.replace('"', "").lower() for c in metaexpr.c]
473
+ else:
474
+ unquoted_df_columns = [c.name.replace('"', "") for c in metaexpr.c]
475
+
476
+ # Let's validate existence of each column one by one.
477
+ for column_name in columns:
478
+ if column_name is None:
479
+ column_name = str(column_name)
480
+
481
+ case_based_column_name = column_name.lower() if case_insensitive else column_name
482
+
483
+ # If column name does not exist in metaexpr, raise the exception
484
+ if not case_based_column_name.replace('"', "") in unquoted_df_columns:
485
+ if column_arg and data_arg:
486
+ raise ValueError(Messages.get_message(MessageCodes.TDMLDF_COLUMN_IN_ARG_NOT_FOUND,
487
+ column_name,
488
+ column_arg,
489
+ data_arg,
490
+ "Table" if for_table else "DataFrame"))
491
+ else:
492
+ raise ValueError(Messages.get_message(MessageCodes.TDMLDF_DROP_INVALID_COL,
493
+ column_name,
494
+ sorted([c.name.replace('"', "") for c in metaexpr.c])))
495
+
496
+ return True
497
+
498
+ @staticmethod
499
+ @skip_validation()
500
+ def _validate_engine(engine):
501
+ """
502
+ Function to validate whether the argument engine is supported or not.
503
+
504
+ PARAMETERS:
505
+ engine:
506
+ Required Argument.
507
+ Specifies the type of the engine.
508
+
509
+ RETURNS:
510
+ True, if engine is supported.
511
+
512
+ RAISES:
513
+ TeradataMLException
514
+
515
+ EXAMPLES:
516
+ _Validators._validate_engine("ENGINE_SQL")
517
+ """
518
+ supported_engines = TeradataConstants.SUPPORTED_ENGINES.value
519
+ if engine not in supported_engines.keys():
520
+ raise TeradataMlException(Messages.get_message(
521
+ MessageCodes.CONFIG_ALIAS_ENGINE_NOT_SUPPORTED).format(engine,
522
+ ", ".join(supported_engines.keys())),
523
+ MessageCodes.CONFIG_ALIAS_ENGINE_NOT_SUPPORTED)
524
+
525
+ return True
526
+
527
+ @staticmethod
528
+ @skip_validation()
529
+ def _validate_function_arguments(arg_list, skip_empty_check=None):
530
+ """
531
+ Method to verify that the input arguments are of valid data type except for
532
+ argument of DataFrameType.
533
+
534
+ PARAMETERS:
535
+ arg_list:
536
+ Required Argument.
537
+ Specifies a list of arguments, expected types are mentioned as type or tuple.
538
+ argInfoMatrix = []
539
+ argInfoMatrix.append(["data", data, False, (DataFrame)])
540
+ argInfoMatrix.append(["centers", centers, True, (int, list)])
541
+ argInfoMatrix.append(["threshold", threshold, True, (float)])
542
+ Types: List of Lists
543
+ skip_empty_check:
544
+ Optional Argument.
545
+ Specifies column name and values for which to skip check.
546
+ Types: Dictionary specifying column name to values mapping.
547
+
548
+ RAISES:
549
+ Error if arguments are not of valid datatype
550
+
551
+ EXAMPLES:
552
+ _Validators._validate_function_arguments(arg_list)
553
+ """
554
+ # Below arg_list matrix is list of list, where each inner list can have maximum 6 elements
555
+ # and must have minimum (first) 4 elements:
556
+ # Consider following inner list.
557
+ # [element1, element2, element3, element4, element5, element6]
558
+ # Corresponds to:
559
+ # [<1_arg_name>, <2_arg_value>, <3_is_optional>, <4_tuple_of_accepted_types>,
560
+ # <5_empty_not_allowed>, <6_list_of_permitted_values>]
561
+ # e.g.
562
+ # arg_list = [["join", join, True, (str), True, concat_join_permitted_values]]
563
+ # 1. element1 --> Argument Name, a string. ["join" in above example.]
564
+ # 2. element2 --> Argument itself. [join]
565
+ # 3. element3 --> Specifies a flag that mentions if argument is optional or not.
566
+ # False means required argument and True means optional argument.
567
+ # 4. element4 --> Tuple of accepted types. (str) in above example.
568
+ # 5. element5 --> True, means validate for empty value. Error will be raised, if empty values are passed.
569
+ # If not specified, argument value will not be validated for empty value.
570
+ # 6. element6 --> A list of permitted values, an argument can accept.
571
+ # If not specified, argument value will not be validated against any permitted values.
572
+ # If a list is passed, validation will be performed for permitted values.
573
+ invalid_arg_names = []
574
+ invalid_arg_types = []
575
+
576
+ type_check_failed = False
577
+
578
+ for args in arg_list:
579
+ num_args = len(args)
580
+ if not isinstance(args[0], str):
581
+ raise TypeError("First element in argument information matrix should be str.")
582
+
583
+ if not isinstance(args[2], bool):
584
+ raise TypeError("Third element in argument information matrix should be bool.")
585
+
586
+ if not (isinstance(args[3], tuple) or isinstance(args[3], type) or
587
+ isinstance(args[3], (_ListOf, _TupleOf)) or isinstance(args[3], enum.EnumMeta)):
588
+ err_msg = "Fourth element in argument information matrix should be a 'tuple of types' or 'type' type."
589
+ raise TypeError(err_msg)
590
+
591
+ if num_args >= 5:
592
+ if not isinstance(args[4], bool):
593
+ raise TypeError("Fifth element in argument information matrix should be bool.")
594
+
595
+ #
596
+ # Let's validate argument types.
597
+ #
598
+ # Verify datatypes for arguments which are required or the optional arguments are not None
599
+ if (args[2] == True and args[1] is not None) or (args[2] == False):
600
+ # Validate the types of argument, if expected types are instance of tuple or type
601
+ dtype_list = _Validators.__getTypeAsStr(args[3])
602
+
603
+ if isinstance(args[3], tuple) and list in args[3]:
604
+ # If list of data types contain 'list', which means argument can accept list of values.
605
+ dtype_list.remove('list')
606
+ valid_types_str = ", ".join(dtype_list) + " or list of values of type(s): " + ", ".join(
607
+ dtype_list)
608
+
609
+ if isinstance(args[1], list):
610
+ # If argument contains list of values, check each value.
611
+ for value in args[1]:
612
+ # If not valid datatype add invalid_arg to dictionary and break
613
+ if not _Validators._check_isinstance(value, args[3]):
614
+ invalid_arg_names.append(args[0])
615
+ invalid_arg_types.append(valid_types_str)
616
+ type_check_failed = True
617
+ break
618
+ elif not _Validators._check_isinstance(args[1], args[3]):
619
+ # Argument is not of type list.
620
+ invalid_arg_names.append(args[0])
621
+ invalid_arg_types.append(valid_types_str)
622
+ type_check_failed = True
623
+
624
+ elif isinstance(args[3], tuple):
625
+ # Argument can accept values of multiple types, but not list.
626
+ valid_types_str = " or ".join(dtype_list)
627
+ if not _Validators._check_isinstance(args[1], args[3]):
628
+ invalid_arg_names.append(args[0])
629
+ invalid_arg_types.append(valid_types_str)
630
+ type_check_failed = True
631
+ else:
632
+ # Argument can accept values of single type.
633
+ valid_types_str = " or ".join(dtype_list)
634
+ if not _Validators._check_isinstance(args[1], args[3]):
635
+ invalid_arg_names.append(args[0])
636
+ invalid_arg_types.append(valid_types_str)
637
+ type_check_failed = True
638
+
639
+ #
640
+ # Validate the arguments for empty value
641
+ #
642
+ if not type_check_failed and len(args) >= 5:
643
+ if args[4]:
644
+ _Validators._validate_input_columns_not_empty(args[1], args[0], skip_empty_check)
645
+
646
+ #
647
+ # Validate the arguments for permitted values
648
+ #
649
+ if not type_check_failed and len(args) >= 6:
650
+ if args[5] is not None:
651
+ _Validators._validate_permitted_values(args[1], args[5], args[0], supported_types=args[3])
652
+
653
+ if type_check_failed:
654
+ if len(invalid_arg_names) != 0:
655
+ raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE,
656
+ invalid_arg_names, invalid_arg_types))
657
+
658
+ return True
659
+
660
+ @staticmethod
661
+ @skip_validation()
662
+ def _validate_input_columns_not_empty(arg, arg_name, skip_empty_check=None):
663
+ """
664
+ Function to check whether argument is empty string or not.
665
+
666
+ PARAMETERS:
667
+ arg:
668
+ Required Argument.
669
+ Argument value (string) to be checked whether it is empty or not.
670
+ skip_empty_check:
671
+ Optional Argument.
672
+ Specifies column name and values for which to skip check.
673
+ Types: Dictionary specifying column name to values mapping.
674
+ Example: When '\n', '\t' are valid values for argument 'arg_name', this check should be skipped.
675
+
676
+ RAISES:
677
+ Error if argument contains empty string
678
+
679
+ EXAMPLES:
680
+ _Validators._validate_input_columns_not_empty(arg)
681
+ """
682
+ if isinstance(arg, str):
683
+ if not (skip_empty_check and arg_name in skip_empty_check.keys() and arg in skip_empty_check[arg_name]):
684
+ if ((len(arg.strip()) == 0)):
685
+ raise ValueError(Messages.get_message(MessageCodes.ARG_EMPTY, arg_name))
686
+
687
+ if isinstance(arg, list):
688
+ if len(arg) == 0:
689
+ raise ValueError(Messages.get_message(MessageCodes.ARG_EMPTY, arg_name).replace("empty string", "an empty list"))
690
+
691
+ for col in arg:
692
+ if not (skip_empty_check and arg_name in skip_empty_check.keys() and col in skip_empty_check[arg_name]):
693
+ if isinstance(col, str):
694
+ if (not (col is None)) and (len(col.strip()) == 0):
695
+ raise ValueError(Messages.get_message(MessageCodes.ARG_EMPTY, arg_name))
696
+ return True
697
+
698
+ @staticmethod
699
+ @skip_validation()
700
+ def _validate_missing_required_arguments(arg_list):
701
+ """
702
+ Method to check whether the required arguments passed to the function are missing
703
+ or not. Only wrapper's use this function.
704
+
705
+ PARAMETERS:
706
+ arg_list - A list
707
+ The argument is expected to be a list of arguments
708
+
709
+ RAISES:
710
+ If any arguments are missing exception raised with missing arguments which are
711
+ required.
712
+
713
+ EXAMPLES:
714
+ An example input matrix will be:
715
+ arg_info_matrix = []
716
+ arg_info_matrix.append(["data", data, False, DataFrame])
717
+ arg_info_matrix.append(["centers", centers, True, int])
718
+ arg_info_matrix.append(["threshold", threshold, True, "float"])
719
+ awu = AnalyticsWrapperUtils()
720
+ awu._validate_missing_required_arguments(arg_info_matrix)
721
+ """
722
+ miss_args = []
723
+ for args in arg_list:
724
+ '''
725
+ Check for missing arguments which are required. If args[2] is false
726
+ the argument is required.
727
+ The following conditions are true :
728
+ 1. The argument should not be None and an empty string.
729
+ then argument is required which is missing and Raises exception.
730
+ '''
731
+ if args[2] == False and args[1] is None:
732
+ miss_args.append(args[0])
733
+
734
+ if len(miss_args) > 0:
735
+ raise TeradataMlException(Messages.get_message(MessageCodes.MISSING_ARGS, miss_args),
736
+ MessageCodes.MISSING_ARGS)
737
+ return True
738
+
739
+ @staticmethod
740
+ @skip_validation()
741
+ def _validate_permitted_values(arg, permitted_values, arg_name, case_insensitive=True, includeNone=True, supported_types=None):
742
+ """
743
+ Function to check the permitted values for the argument.
744
+
745
+ PARAMETERS:
746
+ arg:
747
+ Required Argument.
748
+ Argument value to be checked against permitted values from the list.
749
+ Types: string
750
+
751
+ permitted_values:
752
+ Required Argument.
753
+ A list of strings/ints/floats containing permitted values for the argument.
754
+ Types: string
755
+
756
+ arg_name:
757
+ Required Argument.
758
+ Name of the argument to be printed in the error message.
759
+ Types: string
760
+
761
+ case_insensitive:
762
+ Optional Argument.
763
+ Specifies whether values in permitted_values could be case sensitive.
764
+ Types: bool
765
+
766
+ includeNone:
767
+ Optional Argument.
768
+ Specifies whether 'None' can be included as valid value.
769
+ Types: bool
770
+
771
+ supported_types:
772
+ Optional Argument.
773
+ Specifies the supported datatypes for the argument.
774
+ Types: str
775
+
776
+ RAISES:
777
+ Error if argument is not present in the list
778
+
779
+ EXAMPLES:
780
+ permitted_values = ["LOGISTIC", "BINOMIAL", "POISSON", "GAUSSIAN", "GAMMA", "INVERSE_GAUSSIAN", "NEGATIVE_BINOMIAL"]
781
+ arg = "LOGISTIC"
782
+ _Validators._validate_permitted_values(arg, permitted_values, argument_name)
783
+ """
784
+ # validating permitted_values type which has to be a list.
785
+ _Validators._validate_function_arguments([["permitted_values", permitted_values, False, (list)]])
786
+
787
+ if case_insensitive:
788
+ permitted_values = [item.upper() if isinstance(item, str) else item for item in permitted_values]
789
+
790
+ # Validate whether argument has value from permitted values list or not.
791
+ if not isinstance(arg, list) and arg is not None:
792
+ arg = [arg]
793
+
794
+ if arg is not None:
795
+ # Getting arguments in uppercase to compare with 'permitted_values'
796
+ arg_upper = []
797
+ for element in arg:
798
+ if element is None:
799
+ # If element is None, then we shall add a string "None"
800
+ if includeNone:
801
+ continue
802
+ arg_upper.append(str(element))
803
+ elif isinstance(element, str):
804
+ # If element is of type str, then we will convert it to upper case.
805
+ if case_insensitive:
806
+ arg_upper.append(element.upper())
807
+ else:
808
+ arg_upper.append(element)
809
+ else:
810
+ # For any other type of element, we will keep it as is.
811
+ arg_upper.append(element)
812
+
813
+ # Form the list of datatypes not present in the datatypes of permitted_values.
814
+ add_types = ()
815
+ if supported_types is not None:
816
+ # Convert type and tuple to list.
817
+ supported_types = [supported_types] if isinstance(supported_types, type) else supported_types
818
+ # Form a list for types which are not there in type of permitted_values.
819
+ add_types = tuple(set(list(supported_types)) - set(list(map(type, permitted_values))) - set([list]))
820
+ # Remove the arguments from arg_upper which are an instance of the add_types.
821
+ if len(add_types) > 0:
822
+ [arg_upper.remove(arg) for arg in arg_upper if isinstance(arg, add_types)]
823
+
824
+ # If any of the arguments in 'arg_upper' not in 'permitted_values',
825
+ # then, raise exception
826
+ upper_invalid_values = list(set(arg_upper).difference(set(permitted_values)))
827
+
828
+ if len(upper_invalid_values) > 0:
829
+ # Getting actual invalid arguments (non-upper)
830
+ invalid_values = []
831
+ for element in arg:
832
+ if element is None:
833
+ if includeNone:
834
+ continue
835
+ invalid_values.append(str(element))
836
+ elif isinstance(element, str) and element.upper() in upper_invalid_values:
837
+ invalid_values.append(element)
838
+ elif element in upper_invalid_values:
839
+ invalid_values.append(element)
840
+ invalid_values.sort()
841
+
842
+ # Concatenate the message for datatypes not present in datatypes of permitted_values.
843
+ if len(add_types) > 0:
844
+ add_types = _Validators.__getTypeAsStr(add_types)
845
+ add_types = " or ".join(add_types)
846
+ permitted_values = "{} {}".format(permitted_values, "or any values of type {}".format(add_types))
847
+
848
+ raise ValueError(
849
+ Messages.get_message(MessageCodes.INVALID_ARG_VALUE,
850
+ ', '.join([str(item) if not isinstance(item, str) else item for item in invalid_values]),
851
+ arg_name, permitted_values))
852
+ # If any of the arguments doesn't want to include None as valid value
853
+ # then, raise exception.
854
+ else:
855
+ if not includeNone:
856
+ raise ValueError(
857
+ Messages.get_message(MessageCodes.INVALID_ARG_VALUE, None,
858
+ arg_name, permitted_values), MessageCodes.INVALID_ARG_VALUE)
859
+ # Returns True when arg is None or there is no Exception
860
+ return True
861
+
862
+ @staticmethod
863
+ @skip_validation()
864
+ def _validate_positive_int(arg, arg_name, lbound=0, ubound=None, lbound_inclusive=False):
865
+ """
866
+ Validation to check arg values is a positive int.
867
+
868
+ PARAMETERS:
869
+ arg:
870
+ Required Argument.
871
+ Specifies the number to be validated for positive INT.
872
+ Types: int
873
+
874
+ arg_name:
875
+ Required Argument.
876
+ Specifies the name of the argument to be printed in error message.
877
+ Types: str
878
+
879
+ lbound:
880
+ Optional Argument.
881
+ Specifies the lower bound value for arg.
882
+ Note: Value provided to this argument is exclusive, i.e., if value provided
883
+ to this argument 10, then error will be raised for any value of arg <= 10.
884
+ It can be made inclusive, if lbound_inclusive is set to 'True'.
885
+ Types: int
886
+
887
+ ubound:
888
+ Optional Argument.
889
+ Specifies the upper bound value for arg.
890
+ Note: Value provided to this argument is inclusive, i.e., if value provided
891
+ to this argument 10, then error will be raised for any value of arg > 10.
892
+ Types: int
893
+
894
+ lbound_inclusive:
895
+ Optional Argument.
896
+ Specifies a boolean flag telling API whether to lbound value is inclusive or not.
897
+ Types: bool
898
+
899
+ RAISES:
900
+ ValueError - If arg is not a positive int.
901
+
902
+ RETURNS:
903
+ True - If success
904
+
905
+ EXAMPLES:
906
+ # Validate n for value > 0
907
+ _Validators._validate_positive_int(n, "n")
908
+ # Validate n for value > 0 and value <= 32767
909
+ _Validators._validate_positive_int(n, "n", ubound="32767")
910
+ """
911
+ if arg is None:
912
+ return True
913
+
914
+ if ubound is None:
915
+ if lbound_inclusive:
916
+ if not isinstance(arg, numbers.Integral) or arg < lbound:
917
+ raise ValueError(Messages.get_message(MessageCodes.TDMLDF_POSITIVE_INT).format(arg_name, "greater than or equal to"))
918
+ else:
919
+ if not isinstance(arg, numbers.Integral) or arg <= lbound:
920
+ raise ValueError(Messages.get_message(MessageCodes.TDMLDF_POSITIVE_INT).format(arg_name, "greater than"))
921
+ else:
922
+ if not isinstance(arg, numbers.Integral) or arg <= lbound or arg > ubound:
923
+ raise ValueError(Messages.get_message(MessageCodes.TDMLDF_LBOUND_UBOUND).format(
924
+ arg_name, "greater than {}".format(lbound),
925
+ " and less than or equal to {}".format(ubound)))
926
+
927
+ return True
928
+
929
+ @staticmethod
930
+ @skip_validation()
931
+ def _validate_argument_range(arg,
932
+ arg_name,
933
+ lbound=None,
934
+ ubound=None,
935
+ lbound_inclusive=False,
936
+ ubound_inclusive=False):
937
+ """
938
+ DESCRIPTION:
939
+ Validation to check arg is in specified range.
940
+
941
+ PARAMETERS:
942
+ arg:
943
+ Required Argument.
944
+ Specifies the number to be validated for range check.
945
+ Types: int
946
+
947
+ arg_name:
948
+ Required Argument.
949
+ Specifies the name of the argument to be printed in error message.
950
+ Types: str
951
+
952
+ lbound:
953
+ Optional Argument.
954
+ Specifies the lower bound value for arg.
955
+ Note:
956
+ Value provided to this argument is exclusive, i.e., if
957
+ value provided to this argument 10, then error will be
958
+ raised for any value of arg < 10. It can be made inclusive,
959
+ if lbound_inclusive is set to 'True'.
960
+ Types: int OR float
961
+
962
+ ubound:
963
+ Optional Argument.
964
+ Specifies the upper bound value for arg.
965
+ Note:
966
+ Value provided to this argument is exclusive, i.e., if
967
+ value provided to this argument 10, then error will be
968
+ raised for any value of arg > 10. It can be made inclusive,
969
+ if ubound_inclusive is set to 'True'.
970
+ Types: int OR float
971
+
972
+ lbound_inclusive:
973
+ Optional Argument.
974
+ Specifies whether lbound value is inclusive or not. When set to True,
975
+ value is inclusive, otherwise exclusive.
976
+ Default Value: False
977
+ Types: bool
978
+
979
+ ubound_inclusive:
980
+ Optional Argument.
981
+ Specifies whether ubound value is inclusive or not. When set to True,
982
+ value is inclusive, otherwise exclusive.
983
+ Default Value: False
984
+ Types: bool
985
+
986
+ RAISES:
987
+ ValueError - If arg is not in the specified range.
988
+
989
+ RETURNS:
990
+ True - If success
991
+
992
+ EXAMPLES:
993
+ # Validate n for value in between of 10 and 20.
994
+ _Validators._validate_argument_range(n, 10, 20)
995
+ """
996
+ if lbound is None and ubound is None:
997
+ return True
998
+
999
+ # Raise error if lower bound is greater than upper bound.
1000
+ if lbound is not None and ubound is not None and (lbound > ubound):
1001
+ raise ValueError("Lowerbound value '{}' must be less than upperbound value '{}'.".format(lbound, ubound))
1002
+
1003
+ # If argument is None, do not validate the argument.
1004
+ if arg is None:
1005
+ return True
1006
+
1007
+ is_arg_in_lower_bound, is_arg_in_upper_bound = True, True
1008
+ lbound_msg, ubound_msg = "", ""
1009
+
1010
+ # Check for lower bound.
1011
+ if lbound is not None:
1012
+ if lbound_inclusive:
1013
+ is_arg_in_lower_bound = arg >= lbound
1014
+ lbound_msg = "greater than or equal to {}".format(lbound)
1015
+ else:
1016
+ is_arg_in_lower_bound = arg > lbound
1017
+ lbound_msg = "greater than {}".format(lbound)
1018
+
1019
+ # Check for upper bound.
1020
+ if ubound is not None:
1021
+ if ubound_inclusive:
1022
+ is_arg_in_upper_bound = arg <= ubound
1023
+ ubound_msg = "less than or equal to {}".format(ubound)
1024
+ else:
1025
+ is_arg_in_upper_bound = arg < ubound
1026
+ ubound_msg = "less than {}".format(ubound)
1027
+
1028
+ if not (is_arg_in_lower_bound and is_arg_in_upper_bound):
1029
+ # If both lower bound and upper bound error messages available, append 'and' to
1030
+ # upper bound message.
1031
+ if lbound_msg and ubound_msg:
1032
+ ubound_msg = " and {}".format(ubound_msg)
1033
+ raise ValueError(
1034
+ Messages.get_message(MessageCodes.TDMLDF_LBOUND_UBOUND).format(arg_name, lbound_msg, ubound_msg))
1035
+
1036
+ return True
1037
+
1038
+ @staticmethod
1039
+ @skip_validation()
1040
+ def _validate_vantage_version(vantage_version):
1041
+ """
1042
+ Function to verify whether the given vantage_version is
1043
+ supported or not.
1044
+
1045
+ PARAMETERS:
1046
+ vantage_version:
1047
+ Required Argument.
1048
+ Specifies the vantage version.
1049
+
1050
+ RETURNS:
1051
+ True, if the current vantage version is supported or not.
1052
+
1053
+ RAISES:
1054
+ TeradataMLException
1055
+
1056
+ EXAMPLES:
1057
+ _Validators._validate_vantage_version("vantage1.0")
1058
+ """
1059
+ supported_vantage_versions = TeradataConstants.SUPPORTED_VANTAGE_VERSIONS.value
1060
+
1061
+ # Raise exception if the vantage version is not supported.
1062
+ if vantage_version not in supported_vantage_versions.keys():
1063
+ err_ = Messages.get_message(MessageCodes.CONFIG_ALIAS_VANTAGE_VERSION_NOT_SUPPORTED). \
1064
+ format(vantage_version, ", ".join(supported_vantage_versions.keys()))
1065
+ raise TeradataMlException(err_,
1066
+ MessageCodes.CONFIG_ALIAS_VANTAGE_VERSION_NOT_SUPPORTED)
1067
+
1068
+ return True
1069
+
1070
+ @staticmethod
1071
+ @skip_validation()
1072
+ def _validate_timebucket_duration(timebucket_duration, timebucket_duration_arg_name='timebucket_duration'):
1073
+ """
1074
+ Internal function to validate timeduration_bucket specified when creating a
1075
+ Primary Time Index (PTI) table.
1076
+
1077
+ PARAMETERS:
1078
+ timebucket_duration:
1079
+ Specifies the timebucket_duration passed to a function().
1080
+ Types: str
1081
+
1082
+ timebucket_duration_arg_name:
1083
+ Specifies the name of the argument to be displayed in the error message.
1084
+ Types: str
1085
+
1086
+ RETURNS:
1087
+ True if the value is valid.
1088
+
1089
+ RAISES:
1090
+ ValueError or TeradataMlException when the value is invalid.
1091
+
1092
+ EXAMPLES:
1093
+ _Validators._validate_timebucket_duration('HOURS(2)')
1094
+ _Validators._validate_timebucket_duration('2hours')
1095
+ _Validators._validate_timebucket_duration('ayear') # Invalid
1096
+ """
1097
+ # Return True is it is not specified or is None since it is optional
1098
+ if timebucket_duration is None:
1099
+ return True
1100
+
1101
+ # Check if notation is formal or shorthand (beginning with a digit)
1102
+ if timebucket_duration[0].isdigit():
1103
+ valid_timebucket_durations = PTITableConstants.VALID_TIMEBUCKET_DURATIONS_SHORTHAND.value
1104
+ pattern_to_use = PTITableConstants.PATTERN_TIMEBUCKET_DURATION_SHORT.value
1105
+ normalized_timebucket_duration = timebucket_duration.lower()
1106
+ else:
1107
+ valid_timebucket_durations = PTITableConstants.VALID_TIMEBUCKET_DURATIONS_FORMAL.value
1108
+ pattern_to_use = PTITableConstants.PATTERN_TIMEBUCKET_DURATION_FORMAL.value
1109
+ normalized_timebucket_duration = timebucket_duration.upper()
1110
+
1111
+ for timebucket_duration_notation in valid_timebucket_durations:
1112
+ pattern = re.compile(pattern_to_use.format(timebucket_duration_notation))
1113
+ match = pattern.match(normalized_timebucket_duration)
1114
+ if match is not None:
1115
+ n = int(match.group(1))
1116
+ _Validators._validate_positive_int(n, "n", ubound=32767)
1117
+
1118
+ # Looks like the value is valid
1119
+ return True
1120
+
1121
+ # Match not found
1122
+ raise ValueError(Messages.get_message(
1123
+ MessageCodes.INVALID_ARG_VALUE).format(timebucket_duration, timebucket_duration_arg_name,
1124
+ 'a valid time unit of format time_unit(n) or it\'s short hand '
1125
+ 'equivalent notation'))
1126
+
1127
+ @staticmethod
1128
+ @skip_validation()
1129
+ def _validate_column_type(df, col, col_arg, expected_types, raiseError=True):
1130
+ """
1131
+ Internal function to validate the type of an input DataFrame column against
1132
+ a list of expected types.
1133
+
1134
+ PARAMETERS
1135
+ df:
1136
+ Required Argument.
1137
+ Specifies the input teradataml DataFrame which has the column to be tested
1138
+ for type.
1139
+ Types: teradataml DataFrame
1140
+
1141
+ col:
1142
+ Required Argument.
1143
+ Specifies the column in the input DataFrame to be tested for type.
1144
+ Types: str
1145
+
1146
+ col_arg:
1147
+ Required Argument.
1148
+ Specifies the name of the argument used to pass the column name.
1149
+ Types: str
1150
+
1151
+ expected_types:
1152
+ Required Argument.
1153
+ Specifies a list of teradatasqlalchemy datatypes that the column is
1154
+ expected to be of type.
1155
+ Types: list of teradatasqlalchemy types
1156
+
1157
+ raiseError:
1158
+ Optional Argument.
1159
+ Specifies a boolean flag that decides whether to raise error or just return True or False.
1160
+ Default Values: True, raise exception if column is not of desired type.
1161
+ Types: bool
1162
+
1163
+ RETURNS:
1164
+ True, when the column is of an expected type.
1165
+
1166
+ RAISES:
1167
+ TeradataMlException, when the column is not one of the expected types.
1168
+
1169
+ EXAMPLES:
1170
+ _Validators._validate_column_type(df, timecode_column, 'timecode_column', PTITableConstants.VALID_TIMECODE_DATATYPES)
1171
+ """
1172
+ if not any(isinstance(df[col].type, t) for t in expected_types):
1173
+ if raiseError:
1174
+ raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_COLUMN_TYPE).
1175
+ format(col_arg, df[col].type, ' or '.join(expected_type.__visit_name__
1176
+ for expected_type in expected_types)),
1177
+ MessageCodes.INVALID_COLUMN_TYPE)
1178
+ else:
1179
+ return False
1180
+
1181
+ return True
1182
+
1183
+ @staticmethod
1184
+ @skip_validation()
1185
+ def _validate_aggr_operation_unsupported_datatype(operation, columns, td_column_names_and_types):
1186
+ """
1187
+ Internal function to validate the for unsupported data types of an input DataFrame column for
1188
+ an aggreagate function.
1189
+
1190
+ PARAMETERS
1191
+ operation:
1192
+ Required Argument.
1193
+ Specifies the name of the aggregate operation.
1194
+ Types: str
1195
+
1196
+ columns:
1197
+ Required Argument.
1198
+ Specifies the column names to be validated for datatype check.
1199
+ Types: str
1200
+
1201
+ td_column_names_and_types:
1202
+ Required Argument.
1203
+ Specifies the input teradataml DataFrames column name to SQLAlchemy type mapper.
1204
+ Types: str
1205
+
1206
+ RETURNS:
1207
+ None
1208
+
1209
+ RAISES:
1210
+ TeradataMlException, when the columns is not one of the expected types.
1211
+
1212
+ EXAMPLES:
1213
+ _Validators._validate_aggr_operation_unsupported_datatype(operation, columns, td_column_names_and_types):
1214
+ """
1215
+ # Check if the user provided columns has unsupported datatype for aggregate operation or not.
1216
+ # Get the list of unsupported types for aggregate function.
1217
+ unsupported_types = _Dtypes._get_unsupported_data_types_for_aggregate_operations(operation)
1218
+ invalid_columns = []
1219
+
1220
+ for column in columns:
1221
+ if isinstance(td_column_names_and_types[column.lower()], tuple(unsupported_types)):
1222
+ invalid_columns.append(
1223
+ "({0} - {1})".format(column, td_column_names_and_types[column.lower()]))
1224
+
1225
+ if len(invalid_columns) > 0:
1226
+ invalid_columns.sort() # helps in catching the columns in
1227
+ # lexicographic order
1228
+ error = MessageCodes.TDMLDF_AGGREGATE_UNSUPPORTED.value.format(
1229
+ ", ".join(invalid_columns), operation)
1230
+ msg = Messages.get_message(MessageCodes.TDMLDF_AGGREGATE_COMBINED_ERR). \
1231
+ format(error)
1232
+ raise TeradataMlException(msg, MessageCodes.TDMLDF_AGGREGATE_COMBINED_ERR)
1233
+
1234
+ @staticmethod
1235
+ @skip_validation()
1236
+ def _validate_str_arg_length(arg_name, arg_value, op, length):
1237
+ """
1238
+ Internal function to validate the length of a string passed as an argument.
1239
+
1240
+ PARAMETERS
1241
+ arg_name:
1242
+ Required Argument.
1243
+ Specifies the name of the argument for which we need to validate the value length.
1244
+ Types: str
1245
+
1246
+ arg_value:
1247
+ Required Argument.
1248
+ Specifies the value passed to the argument.
1249
+ Types: str
1250
+
1251
+ op:
1252
+ Required Argument.
1253
+ Specifies the type of check, and can be one of:
1254
+ * LT - Less than
1255
+ * LE - less than or equal to
1256
+ * GT - greater than
1257
+ * GE - greater than or equal to
1258
+ * EQ - equal to
1259
+ * NE - not equal to
1260
+ Types: str
1261
+ Permitted Values: ['LT', 'LE', 'GT', 'GE', 'EQ', 'NE']
1262
+
1263
+ length:
1264
+ Required Argument.
1265
+ Specifies the length against which the 'op' check for the argument value length will be made.
1266
+ Types: int
1267
+
1268
+ RETURNS:
1269
+ None
1270
+
1271
+ RAISES:
1272
+ ValueError.
1273
+
1274
+ EXAMPLES:
1275
+ _Validators._validate_str_arg_length("name", "The value", 10):
1276
+ """
1277
+ return _Validators._validate_arg_length(arg_name=arg_name, arg_value=arg_value, op=op, length=length)
1278
+
1279
+ @staticmethod
1280
+ @skip_validation()
1281
+ def _validate_arg_length(arg_name, arg_value, op, length):
1282
+ """
1283
+ Internal function to validate the length of an argument.
1284
+
1285
+ PARAMETERS
1286
+ arg_name:
1287
+ Required Argument.
1288
+ Specifies the name of the argument for which we need to validate the value length.
1289
+ Types: str
1290
+
1291
+ arg_value:
1292
+ Required Argument.
1293
+ Specifies the value passed to the argument.
1294
+ Types: str or list or tuple or set or dict
1295
+
1296
+ op:
1297
+ Required Argument.
1298
+ Specifies the type of check, and can be one of:
1299
+ * LT - Less than
1300
+ * LE - less than or equal to
1301
+ * GT - greater than
1302
+ * GE - greater than or equal to
1303
+ * EQ - equal to
1304
+ * NE - not equal to
1305
+ Types: str
1306
+ Permitted Values: ['LT', 'LE', 'GT', 'GE', 'EQ', 'NE']
1307
+
1308
+ length:
1309
+ Required Argument.
1310
+ Specifies the length against which the 'op' check for the argument value length will be made.
1311
+ Types: int
1312
+
1313
+ RETURNS:
1314
+ None
1315
+
1316
+ RAISES:
1317
+ ValueError.
1318
+
1319
+ EXAMPLES:
1320
+ _Validators._validate_arg_length("name", [1, 2, 3], 3):
1321
+ """
1322
+ # Check if the length of the string value for the argument is acceptable.
1323
+ # First, check if op is an acceptable operation.
1324
+ acceptable_op = {'LT': int.__lt__,
1325
+ 'LE': int.__le__,
1326
+ 'GT': int.__gt__,
1327
+ 'GE': int.__ge__,
1328
+ 'EQ': int.__eq__,
1329
+ 'NE': int.__ne__
1330
+ }
1331
+ if op not in acceptable_op:
1332
+ raise ValueError(Messages.get_message(MessageCodes.INVALID_ARG_VALUE,
1333
+ op, "op", acceptable_op))
1334
+
1335
+ # Format the error message with the substring based on the op type.
1336
+ errors = {'LT': "less than {}",
1337
+ 'LE': "less than or equal to {}",
1338
+ 'GT': "greater than {}",
1339
+ 'GE': "greater than or equal to {}",
1340
+ 'EQ': "equal to {}",
1341
+ 'NE': "not equal to {}"
1342
+ }
1343
+ if not acceptable_op[op](len(arg_value), length):
1344
+ if isinstance(arg_value, str):
1345
+ raise ValueError(Messages.get_message(MessageCodes.INVALID_LENGTH_STRING_ARG,
1346
+ arg_name, errors[op].format(length)))
1347
+ raise ValueError(Messages.get_message(MessageCodes.INVALID_LENGTH_ARG, type(arg_value).__name__,
1348
+ arg_name, errors[op].format(length)))
1349
+ return True
1350
+
1351
+ @staticmethod
1352
+ @skip_validation()
1353
+ def _validate_file_exists(file_path):
1354
+ """
1355
+ DESCRIPTION:
1356
+ Function to validate whether the path specified is a file and if it exists.
1357
+ Supports both single file path (str) and list of file paths.
1358
+ PARAMETERS:
1359
+ file_path:
1360
+ Required Argument.
1361
+ Specifies the path of the file or list of file paths.
1362
+ Types: str or list of str
1363
+ RETURNS:
1364
+ True, if all paths are files and exist.
1365
+ RAISES:
1366
+ TeradataMLException
1367
+ EXAMPLES:
1368
+ Example 1: When a single file path is specified.
1369
+ >>> _Validators._validate_file_exists("/data/mapper.py")
1370
+ Example 2: When a list of file paths is specified.
1371
+ >>> _Validators._validate_file_exists(["/data/mapper.py", "/data/other.py"])
1372
+ """
1373
+ file_paths = [file_path] if isinstance(file_path, str) else file_path
1374
+ invalid_paths = []
1375
+
1376
+ # Validate if each file path exists and is a file.
1377
+ for fp in file_paths:
1378
+ if not Path(fp).exists() or not os.path.isfile(fp):
1379
+ invalid_paths.append(fp)
1380
+
1381
+ # If any of the file paths is invalid, raise an exception.
1382
+ if invalid_paths:
1383
+ raise TeradataMlException(
1384
+ Messages.get_message(MessageCodes.INPUT_FILE_NOT_FOUND).format(", ".join(invalid_paths)),
1385
+ MessageCodes.INPUT_FILE_NOT_FOUND)
1386
+
1387
+ return True
1388
+
1389
+ @staticmethod
1390
+ @skip_validation()
1391
+ def _validate_mutually_exclusive_arguments(arg1, err_disp_arg1_name, arg2,
1392
+ err_disp_arg2_name, skip_all_none_check=False):
1393
+ """
1394
+ DESCRIPTION:
1395
+ Function to validate whether "arg1" and "arg2" are mutually exclusive.
1396
+
1397
+ PARAMETERS:
1398
+ arg1:
1399
+ Required Argument.
1400
+ Specifies the value of argument1.
1401
+ Types: Any
1402
+
1403
+ err_disp_arg1_name:
1404
+ Required Argument.
1405
+ Specifies the name of argument1.
1406
+ Types: str
1407
+
1408
+ arg2:
1409
+ Required Argument.
1410
+ Specifies the value of argument2.
1411
+ Types: Any
1412
+
1413
+ err_disp_arg2_name:
1414
+ Required Argument.
1415
+ Specifies the name of argument2.
1416
+ Types: str
1417
+
1418
+ skip_all_none_check:
1419
+ Optional Argument.
1420
+ Specifies whether to skip check when arg1 and arg2 both are None.
1421
+ Default Value: False
1422
+ Types: bool
1423
+
1424
+ RETURNS:
1425
+ True, if either arg1 or arg2 is None or both are None.
1426
+
1427
+ RAISES:
1428
+ TeradataMLException
1429
+
1430
+ EXAMPLES:
1431
+ _Validators._validate_mutually_exclusive_arguments(arg1, "arg1", arg2, "arg2")
1432
+ """
1433
+ both_args_none = arg1 is None and arg2 is None
1434
+ if skip_all_none_check:
1435
+ both_args_none = False
1436
+
1437
+ # Either both the arguments are specified or both are None.
1438
+ if all([arg1, arg2]) or both_args_none:
1439
+ raise TeradataMlException(Messages.get_message(
1440
+ MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT, err_disp_arg1_name,
1441
+ err_disp_arg2_name), MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT)
1442
+ return True
1443
+
1444
+ @staticmethod
1445
+ @skip_validation()
1446
+ def _validate_mutually_exclusive_argument_groups(*arg_groups, all_falsy_check=False,
1447
+ empty_check=False,
1448
+ return_all_falsy_status=False):
1449
+ """
1450
+ DESCRIPTION:
1451
+ Function to validate mutual exclusiveness of group of arguments.
1452
+
1453
+ PARAMETERS:
1454
+ *arg_groups:
1455
+ Specifies variable length argument list where each argument in list is a dictionary
1456
+ representing one group of arguments which should be mutually exclusive from
1457
+ other groups of arguments. Each dictionary contains key-value pairs for argument
1458
+ name and its value.
1459
+
1460
+ all_falsy_check:
1461
+ Optional Argument.
1462
+ Specifies whether to throw Teradataml Exception when all arguments in all argument
1463
+ groups hold Falsy/null values.
1464
+ Default Value: False
1465
+ Types: bool
1466
+
1467
+ empty_check:
1468
+ Optional Argument.
1469
+ Specifies whether to treat empty values like empty string and empty list as None or not.
1470
+ When set to True, empty string and empty list are treated as None.
1471
+ Default Value: False
1472
+ Types: bool
1473
+
1474
+ return_all_falsy_status:
1475
+ Optional Argument.
1476
+ Specifies whether to return the boolean flag which states if all arguments in all argument
1477
+ groups hold Falsy/null values.
1478
+ Default Value: False
1479
+ Types: bool
1480
+
1481
+ RETURNS:
1482
+ * When "return_all_falsy_status" is True:
1483
+ * True: If all arguments in all argument groups hold Falsy/null values.
1484
+ * False: If all arguments in all argument groups do not hold Falsy/null values.
1485
+ * When "return_all_falsy_status" is False:
1486
+ None
1487
+ RAISES:
1488
+ TeradataMLException
1489
+
1490
+ EXAMPLES:
1491
+ # Example 1: When groups of arguments are not mutually exclusive.
1492
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": "arg1"},
1493
+ ... {"arg2": "arg2"},
1494
+ ... {"arg3": "arg3", "arg4": "arg4"})
1495
+ [Teradata][teradataml](TDML_2061) Provide either '['arg1']' argument(s) or '['arg2']' argument(s) or '['arg3', 'arg4']' argument(s).
1496
+
1497
+ # Example 2: When groups of arguments are mutually exclusive.
1498
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": None},
1499
+ ... {"arg2": None},
1500
+ ... {"arg3": "arg3", "arg4": "arg4"})
1501
+
1502
+ # Example 3: When all groups of arguments hold falsy values
1503
+ # and "all_falsy_check" is set to True.
1504
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": None},
1505
+ ... {"arg2": None},
1506
+ ... {"arg3": None, "arg4": None},
1507
+ ... all_falsy_check=True)
1508
+ [Teradata][teradataml](TDML_2061) Provide either '['arg1']' argument(s) or '['arg2']' argument(s) or '['arg3', 'arg4']' argument(s).
1509
+
1510
+ # Example 4: When all groups of arguments hold falsy values
1511
+ # and "all_falsy_check" is set to False.
1512
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": None},
1513
+ ... {"arg2": None},
1514
+ ... {"arg3": None, "arg4": None})
1515
+
1516
+ # Example 5: When all groups of arguments hold falsy values
1517
+ # and "all_falsy_check" is set to False and
1518
+ # "return_all_falsy_status" is set to True.
1519
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": None},
1520
+ ... {"arg2": None},
1521
+ ... {"arg3": None, "arg4": None},
1522
+ ... return_all_falsy_status=True)
1523
+ True
1524
+
1525
+ # Example 6: When groups of arguments are mutually exclusive
1526
+ # considering empty list and empty string as falsy values.
1527
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": ""},
1528
+ ... {"arg2": []},
1529
+ ... {"arg3": "arg3", "arg4": "arg4"},
1530
+ ... empty_check=True)
1531
+
1532
+ # Example 7: When all groups of arguments hold falsy values
1533
+ # considering empty list and empty string as falsy values
1534
+ # and "all_falsy_check" is set to True.
1535
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": ""},
1536
+ ... {"arg2": []},
1537
+ ... {"arg3": [], "arg4": None},
1538
+ ... {"arg5": "", "arg6": None},
1539
+ ... empty_check=True,
1540
+ ... all_falsy_check=True)
1541
+ TeradataMlException: [Teradata][teradataml](TDML_2061) Provide either '['arg1']' argument(s) or '['arg2']' argument(s) or '['arg3', 'arg4']' argument(s) or '['arg5', 'arg6']' argument(s).
1542
+
1543
+ # Example 8: When groups of arguments are not mutually exclusive
1544
+ # considering empty list and empty string as valid values.
1545
+ >>> _Validators._validate_mutually_exclusive_argument_groups({"arg1": ""},
1546
+ ... {"arg2": []},
1547
+ ... {"arg3": "arg3", "arg4": "arg4"})
1548
+ TeradataMlException: [Teradata][teradataml](TDML_2061) Provide either '['arg1']' argument(s) or '['arg2']' argument(s) or '['arg3', 'arg4']' argument(s).
1549
+
1550
+ """
1551
+ all_groups_falsy = True
1552
+ mutually_exclusive_groups = True
1553
+ non_falsy_groups = []
1554
+ for arg_grp in arg_groups:
1555
+ if empty_check:
1556
+ # Treat empty string and empty list as falsy Value.
1557
+ is_group_falsy = not any(arg_grp.values())
1558
+ else:
1559
+ # Treat only None as falsy Value.
1560
+ is_group_falsy = not any(value is not None for value in arg_grp.values())
1561
+ if not is_group_falsy:
1562
+ non_falsy_groups.append(arg_grp)
1563
+
1564
+ # Current group is having non-falsy values and already traversed
1565
+ # group(s) also has(have) non-falsy values. So set "mutually_exclusive_groups" to False.
1566
+ if not all_groups_falsy:
1567
+ mutually_exclusive_groups = False
1568
+
1569
+ all_groups_falsy = all_groups_falsy and is_group_falsy
1570
+
1571
+ # Raise error if any one of the below-mentioned conditions is True:
1572
+ # More than one group has non-falsy values.
1573
+ # All groups have all falsy values and "all_falsy_check" is True.
1574
+ if not mutually_exclusive_groups or (all_falsy_check and all_groups_falsy):
1575
+ if not non_falsy_groups:
1576
+ non_falsy_groups = [str(list(arg_grp.keys())) for arg_grp in arg_groups]
1577
+ else:
1578
+ non_falsy_groups = [str(list(non_falsy_group.keys())) for non_falsy_group in non_falsy_groups]
1579
+ error_msg = Messages.get_message(
1580
+ MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT, str(non_falsy_groups[0]),
1581
+ "' argument(s) or \'".join(non_falsy_groups[1:]))
1582
+
1583
+ raise TeradataMlException(error_msg, MessageCodes.EITHER_THIS_OR_THAT_ARGUMENT)
1584
+
1585
+ if return_all_falsy_status:
1586
+ return all_groups_falsy
1587
+
1588
+ @staticmethod
1589
+ @skip_validation()
1590
+ def _validate_mutually_inclusive_n_arguments(**kwargs):
1591
+ """
1592
+ DESCRIPTION:
1593
+ Function to validate mutual inclusiveness of group of arguments.
1594
+
1595
+ PARAMETERS:
1596
+ **kwargs:
1597
+ Specifies variable number of keyword arguments which are to be
1598
+ validated for mutual inclusiveness.
1599
+
1600
+ RETURNS:
1601
+ True, if arguments are mutually inclusive.
1602
+
1603
+ RAISES:
1604
+ TeradataMLException
1605
+
1606
+ EXAMPLES:
1607
+ Example 1: When all arguments have non-None values.
1608
+ >>> _Validators._validate_mutually_inclusive_n_arguments(arg1="arg1", arg2="arg2",
1609
+ ... arg3="arg3", arg4="arg4")
1610
+ True
1611
+
1612
+ Example 2: When one of the arguments is empty string.
1613
+ >>> _Validators._validate_mutually_inclusive_n_arguments(arg1="arg1", arg2="arg2",
1614
+ ... arg3="arg3", arg4="")
1615
+ TeradataMlException
1616
+
1617
+ Example 3: When one of the arguments is None.
1618
+ >>> _Validators._validate_mutually_inclusive_n_arguments(arg1="arg1", arg2=None,
1619
+ ... arg3="arg3", arg4="arg4")
1620
+ TeradataMlException
1621
+ """
1622
+ # TODO: Handling of falsy values can be done in more appropriate way by
1623
+ # differentiating None/empty string/empty list.
1624
+ if all(arg_value for arg, arg_value in kwargs.items()):
1625
+ return True
1626
+ else:
1627
+ arg_list = list(kwargs.keys())
1628
+ message = Messages.get_message(MessageCodes.MUST_PASS_ARGUMENT,
1629
+ arg_list[0], " and ".join(arg_list[1:]))
1630
+ raise TeradataMlException(message, MessageCodes.MUST_PASS_ARGUMENT)
1631
+
1632
+ @staticmethod
1633
+ @skip_validation()
1634
+ def _validate_unexpected_column_type(df, col, col_arg, unexpected_types, check_exist=True, raise_error=True,
1635
+ case_insensitive=False):
1636
+ """
1637
+ Internal function to validate the column existence and type of an input DataFrame column against
1638
+ a list of unexpected types.
1639
+
1640
+ PARAMETERS
1641
+ df:
1642
+ Required Argument.
1643
+ Specifies the input teradataml DataFrame which has the column(s) to be tested
1644
+ for type.
1645
+ Types: teradataml DataFrame
1646
+
1647
+ col:
1648
+ Required Argument.
1649
+ Specifies the column(s) in the input DataFrame to be tested for type.
1650
+ Types: str (or) ColumnExpression (or) List of strings(str)
1651
+ or ColumnExpressions
1652
+
1653
+ col_arg:
1654
+ Required Argument.
1655
+ Specifies the name of the argument used to pass the column(s) name.
1656
+ Types: str
1657
+
1658
+ unexpected_types:
1659
+ Required Argument.
1660
+ Specifies unsupported teradatasqlalcehmy datatypes for the column is
1661
+ unexpected to be of type.
1662
+ Types: list of SQLAlchemy types
1663
+
1664
+ check_exist:
1665
+ Optional Argument.
1666
+ Specifies a boolean flag that decides whether to check for column is
1667
+ existed in DataFrame or not.
1668
+ Default Values: True, raise exception if column is not of desired type.
1669
+ Types: bool
1670
+
1671
+ raise_error:
1672
+ Optional Argument.
1673
+ Specifies a boolean flag that decides whether to raise error or just return True or False.
1674
+ Default Values: True, raise exception if column is not of desired type.
1675
+ Types: bool
1676
+
1677
+ RETURNS:
1678
+ True, when the columns is of an expected type.
1679
+
1680
+ RAISES:
1681
+ TeradataMlException, when the columns is not one of the expected types.
1682
+
1683
+ EXAMPLES:
1684
+ _Validators._validate_unexpected_column_type(
1685
+ df, timecode_column, 'timecode_column', PTITableConstants.VALID_TIMECODE_DATATYPES)
1686
+ """
1687
+
1688
+ columns = [col] if not isinstance(col, list) else col
1689
+
1690
+ # Converting "unexpected_types" to tuple as isinstance can accept Tuple
1691
+ # of types too.
1692
+ unexpected_types = tuple(unexpected_types)
1693
+
1694
+ for col in columns:
1695
+ # Get the name of the column if "col" is ColumnExpression.
1696
+ if not isinstance(col, str):
1697
+ col = col.name
1698
+
1699
+ # Check for column existence.
1700
+ if check_exist:
1701
+ _Validators._validate_column_exists_in_dataframe(col, df._metaexpr, case_insensitive=case_insensitive)
1702
+
1703
+ if isinstance(df[col].type, unexpected_types):
1704
+ if raise_error:
1705
+ invalid_column_types = (col_type.__name__ for col_type in
1706
+ unexpected_types)
1707
+ error_message = Messages.get_message(MessageCodes.INVALID_COLUMN_DATATYPE,
1708
+ col,
1709
+ col_arg,
1710
+ "Unsupported",
1711
+ ", ".join(invalid_column_types))
1712
+ raise TeradataMlException(error_message, MessageCodes.INVALID_COLUMN_DATATYPE)
1713
+
1714
+ else:
1715
+ return False
1716
+
1717
+ return True
1718
+
1719
+ @staticmethod
1720
+ @skip_validation()
1721
+ def _validate_dependent_argument(dependent_arg, dependent_arg_value, independent_arg, independent_arg_value,
1722
+ msg_arg_value=None):
1723
+ """
1724
+ DESCRIPTION:
1725
+ Function validates if an independent argument is specified or not when
1726
+ dependent argument is specified. Raises error, if independent argument
1727
+ is not specified and dependent argument is specified, otherwise returns True.
1728
+
1729
+ PARAMETERS:
1730
+ dependent_arg:
1731
+ Required Argument.
1732
+ Specifies the name of dependent argument.
1733
+ Types: String
1734
+
1735
+ dependent_arg_value:
1736
+ Required Argument.
1737
+ Specifies the value of dependent argument.
1738
+ Types: Any
1739
+
1740
+ independent_arg:
1741
+ Required Argument.
1742
+ Specifies the name of independent argument.
1743
+ Types: String
1744
+
1745
+ independent_arg_value:
1746
+ Required Argument.
1747
+ Specifies the value of independent argument.
1748
+ Types: Any
1749
+
1750
+ msg_arg_value:
1751
+ Optional Argument.
1752
+ Specifies the independent argument value to be printed in message
1753
+ instead of "(not None)".
1754
+ Types: String
1755
+
1756
+ RETURNS:
1757
+ True, when the independent argument is present for the dependent
1758
+ argument.
1759
+
1760
+ RAISES:
1761
+ TeradataMlException, when independent argument is not specified and
1762
+ dependent argument is specified.
1763
+
1764
+ EXAMPLES:
1765
+ _Validators._validate_dependent_argument("dependent_arg_name", admissions_train,
1766
+ "independent_arg_name", None)
1767
+ _Validators._validate_dependent_argument("dependent_arg_name", None,
1768
+ "independent_arg_name", admissions_train)
1769
+ _Validators._validate_dependent_argument("dependent_arg_name", admissions_train,
1770
+ "independent_arg_name", admissions_train)
1771
+ _Validators._validate_dependent_argument("dependent_arg_name", admissions_train,
1772
+ "independent_arg_name", admissions_train,
1773
+ "arg_val")
1774
+ """
1775
+ if dependent_arg_value is not None and independent_arg_value is None:
1776
+ error_code = MessageCodes.DEPENDENT_ARGUMENT
1777
+ error_msg = Messages.get_message(error_code, dependent_arg, independent_arg)
1778
+ if msg_arg_value is None:
1779
+ raise TeradataMlException(error_msg, error_code)
1780
+ else:
1781
+ raise TeradataMlException(error_msg.replace("(not None)", "as '{}'".format(msg_arg_value)),
1782
+ MessageCodes.DEPENDENT_ARGUMENT)
1783
+ return True
1784
+
1785
+ @staticmethod
1786
+ @skip_validation()
1787
+ def _validate_unsupported_argument(arg, arg_name):
1788
+ """
1789
+ DESCRIPTION:
1790
+ Validation to reject unsupported arguments.
1791
+
1792
+ PARAMETERS:
1793
+ arg:
1794
+ Required Argument.
1795
+ Specifies the value passed for the argument that is unsupported.
1796
+ Types: any
1797
+
1798
+ arg_name:
1799
+ Required Argument.
1800
+ Specifies the name of the argument to be printed in error message.
1801
+ Types: str
1802
+
1803
+ RAISES:
1804
+ ValueError, If arg is not None, indicating an unsupported argument was used.
1805
+
1806
+ RETURNS:
1807
+ True, If the argument is not provided (i.e., None), allowing execution to proceed.
1808
+
1809
+ EXAMPLES:
1810
+ _Validators._validate_unsupported_argument(kwargs.get("task_type", None), "task_type")
1811
+ _Validators._validate_unsupported_argument(kwargs.get("is_fraud", None), "is_fraud")
1812
+ _Validators._validate_unsupported_argument(kwargs.get("is_churn", None), "is_churn")
1813
+ """
1814
+ error_code = MessageCodes.UNSUPPORTED_ARGUMENT
1815
+ error_msg = Messages.get_message(error_code, arg_name, arg_name)
1816
+ if arg is not None:
1817
+ raise TeradataMlException(error_msg, error_code)
1818
+ return True
1819
+
1820
+ @staticmethod
1821
+ @skip_validation()
1822
+ def _validate_dependent_method(dependent_mtd, independent_mtd, independent_mtd_calls):
1823
+ """
1824
+ DESCRIPTION:
1825
+ Function validates if an independent method has been called before a dependent method.
1826
+ Raises an error if the independent method is not called before the dependent method is called,
1827
+ otherwise, returns True.
1828
+
1829
+ PARAMETERS:
1830
+ dependent_mtd:
1831
+ Required Argument.
1832
+ Specifies the name of dependent method.
1833
+ Types: String
1834
+
1835
+ independent_mtd:
1836
+ Required Argument.
1837
+ Specifies the name of independent method.
1838
+ Types: String or List of Strings
1839
+
1840
+ independent_mtd_calls:
1841
+ Required Argument.
1842
+ Specifies the flag to check whether independent method is called or not.
1843
+ Types: bool or List of bool
1844
+
1845
+ RETURNS:
1846
+ True, when the independent method is called before the dependent method.
1847
+
1848
+ RAISES:
1849
+ TeradataMlException, when independent method is not called before the
1850
+ dependent method.
1851
+
1852
+ EXAMPLES:
1853
+ _Validators._validate_dependent_method("dependent_method", "independent_method", False)
1854
+ _Validators._validate_dependent_method("dependent_method", "independent_method", True)
1855
+ _Validators._validate_dependent_method("dependent_method", ["independent_method1", "independent_method2"], [False, False])
1856
+ """
1857
+ # Check if all independent method calls are False
1858
+ independent_mtd_calls = [independent_mtd_calls] \
1859
+ if not isinstance(independent_mtd_calls, list) else independent_mtd_calls
1860
+ all_false = all(not value for value in independent_mtd_calls)
1861
+
1862
+ # Check if any of the independent method is called before dependent method
1863
+ if dependent_mtd and all_false:
1864
+ error_code = MessageCodes.DEPENDENT_METHOD
1865
+
1866
+ if isinstance(independent_mtd, str):
1867
+ independent_mtd = [independent_mtd]
1868
+ independent_mtd = ' or '.join(f"'{item}'" for item in independent_mtd)
1869
+
1870
+ error_msg = Messages.get_message(error_code, independent_mtd, dependent_mtd)
1871
+ raise TeradataMlException(error_msg, error_code)
1872
+ return True
1873
+
1874
+ @staticmethod
1875
+ @skip_validation()
1876
+ def _validate_py_type_for_td_type_conversion(py_type, py_type_arg_name):
1877
+ """
1878
+ DESCRIPTION:
1879
+ Function to validate python type, which needs to be converted to TD Type.
1880
+ This function checks whether the python type can be converted to a TD
1881
+ type or not. If PY type is not able to convert TD Type, it then raises
1882
+ an error.
1883
+
1884
+ PARAMETERS:
1885
+ py_type:
1886
+ Required Argument.
1887
+ Specifies the python type.
1888
+ Types: Any
1889
+
1890
+ py_type_arg_name:
1891
+ Required Argument.
1892
+ Specifies the name of argument which holds python variable.
1893
+ Types: str
1894
+
1895
+ RETURNS:
1896
+ None
1897
+
1898
+ RAISES:
1899
+ TeradataMLException
1900
+
1901
+ EXAMPLES:
1902
+ _Validators._validate_py_type_for_td_type_conversion(int, "arg1")
1903
+ """
1904
+ if py_type not in _DtypesMappers.PY_TD_MAPPER:
1905
+ error_code = MessageCodes.UNSUPPORTED_DATATYPE
1906
+ error_msg = Messages.get_message(
1907
+ error_code, py_type_arg_name, '[{}]'.format(", ".join((t.__name__ for t in _DtypesMappers.PY_TD_MAPPER))))
1908
+ raise TeradataMlException(error_msg, error_code)
1909
+
1910
+ @staticmethod
1911
+ @skip_validation()
1912
+ def _validate_function_install_location_is_set(option, function_type, option_name):
1913
+ """
1914
+ DESCRIPTION:
1915
+ Function to validate whether install location for functions is set.
1916
+
1917
+ PARAMETERS:
1918
+ option:
1919
+ Required Argument.
1920
+ Specifies the configuration option value to validate.
1921
+ Types: str
1922
+
1923
+ function_type:
1924
+ Required Argument.
1925
+ Specifies the type of function to check installed location for.
1926
+ Types: str
1927
+
1928
+ option_name:
1929
+ Required Argument.
1930
+ Specifies the configuration option name.
1931
+ Types: str
1932
+
1933
+ RETURNS:
1934
+ None
1935
+
1936
+ RAISES:
1937
+ TeradataMLException
1938
+
1939
+ EXAMPLES:
1940
+ _Validators._validate_function_install_location_is_set(
1941
+ configure.byom_install_location,
1942
+ "Bring Your Own Model",
1943
+ "configure.byom_install_location")
1944
+ """
1945
+ # Check whether an empty string is passed to "option".
1946
+ _Validators._validate_input_columns_not_empty(option, option_name)
1947
+
1948
+ if option is None:
1949
+ message = Messages.get_message(MessageCodes.UNKNOWN_INSTALL_LOCATION,
1950
+ "{} functions".format(function_type),
1951
+ "option '{}'".format(option_name))
1952
+ raise TeradataMlException(message, MessageCodes.MISSING_ARGS)
1953
+
1954
+ @staticmethod
1955
+ @skip_validation()
1956
+ def _check_table_exists(conn, table_name,
1957
+ schema_name,
1958
+ raise_error_if_does_not_exists=True,
1959
+ additional_error=''):
1960
+ """
1961
+ DESCRIPTION:
1962
+ Check whether table specified exists or not.
1963
+
1964
+ PARAMETERS:
1965
+ raise_error_if_does_not_exists:
1966
+ Optional Argument.
1967
+ Specifies the flag to decide whether to raise error when table name specified does not exist.
1968
+ Default Value: True (Raise exception)
1969
+ Types: bool
1970
+
1971
+ additional_error:
1972
+ Optional Argument.
1973
+ Specifies the additional error message to display along with standard message.
1974
+ Default Value: ''
1975
+ Types: String
1976
+
1977
+ RAISES:
1978
+ TeradataMlException.
1979
+
1980
+ RETURNS:
1981
+ True, if table exists, else False.
1982
+
1983
+ EXAMPLES:
1984
+ >>> _check_table_exists('model_table_name','model_schema_name')
1985
+ """
1986
+
1987
+ # Check whether table exists on the system or not.
1988
+ table_exists = conn.dialect.has_table(conn, table_name=table_name,
1989
+ schema=schema_name, table_only=True)
1990
+
1991
+ # If tables exists, return True.
1992
+ if table_exists:
1993
+ return True
1994
+
1995
+ # We are here means the specified table does not exist.
1996
+ # Let's raise error if 'raise_error_if_does_not_exists' set to True.
1997
+ if raise_error_if_does_not_exists:
1998
+ # Raise error, as the specified table_name does not exist.
1999
+ # TABLE_DOES_NOT_EXIST
2000
+ raise TeradataMlException(Messages.get_message(MessageCodes.TABLE_DOES_NOT_EXIST,
2001
+ schema_name, table_name, additional_error),
2002
+ MessageCodes.TABLE_DOES_NOT_EXIST)
2003
+ return False
2004
+
2005
+ @staticmethod
2006
+ @skip_validation()
2007
+ def _check_empty_file(file_path):
2008
+ """
2009
+ Description:
2010
+ Function to validate whether the given file is not empty,
2011
+ given absolute file path.
2012
+
2013
+ PARAMETERS:
2014
+ file_path:
2015
+ Required Argument.
2016
+ Specifies absolute file path of the file.
2017
+ Types: str
2018
+
2019
+ RETURNS:
2020
+ Boolean
2021
+
2022
+ RAISES:
2023
+ TeradataMlException
2024
+
2025
+ EXAMPLES:
2026
+ _check_empty_file("/abc/xyz.txt")
2027
+ """
2028
+
2029
+ if os.stat(file_path).st_size == 0:
2030
+ raise TeradataMlException(
2031
+ Messages.get_message(MessageCodes.EMPTY_FILE,
2032
+ "{}".format(file_path)),
2033
+ MessageCodes.EMPTY_FILE)
2034
+ return True
2035
+
2036
+ @staticmethod
2037
+ @skip_validation()
2038
+ def _validate_mutually_inclusive_arguments(arg1, err_disp_arg1_name, arg2,
2039
+ err_disp_arg2_name):
2040
+ """
2041
+ DESCRIPTION:
2042
+ Function to validate whether "arg1" and "arg2" are mutually inclusive.
2043
+
2044
+ PARAMETERS:
2045
+ arg1:
2046
+ Required Argument.
2047
+ Specifies the value of argument1.
2048
+ Types: Any
2049
+
2050
+ err_disp_arg1_name:
2051
+ Required Argument.
2052
+ Specifies the name of argument1.
2053
+ Types: str
2054
+
2055
+ arg2:
2056
+ Required Argument.
2057
+ Specifies the value of argument2.
2058
+ Types: Any
2059
+
2060
+ err_disp_arg2_name:
2061
+ Required Argument.
2062
+ Specifies the name of argument2.
2063
+ Types: str
2064
+
2065
+ RETURNS:
2066
+ True, if both arg1 and arg2 are present or both are None.
2067
+
2068
+ RAISES:
2069
+ TeradataMLException
2070
+
2071
+ EXAMPLES:
2072
+ _Validators._validate_mutually_inclusive_arguments(arg1, "arg1", arg2, "arg2")
2073
+ """
2074
+ both_args_none = arg1 is None and arg2 is None
2075
+ # If below handles 0 value.
2076
+ # 0 turns to False using bool(0) but 0 is a valid value and should return True.
2077
+ arg1 = True if arg1 == 0 else bool(arg1)
2078
+ arg2 = True if arg2 == 0 else bool(arg2)
2079
+
2080
+ # Either both the arguments are specified or both are None.
2081
+ if not (all([arg1, arg2]) or both_args_none):
2082
+ arg_order = [err_disp_arg1_name, err_disp_arg2_name] if arg1 \
2083
+ else [err_disp_arg2_name, err_disp_arg1_name]
2084
+ raise TeradataMlException(Messages.get_message(
2085
+ MessageCodes.DEPENDENT_ARGUMENT, arg_order[0],
2086
+ arg_order[1]), MessageCodes.DEPENDENT_ARGUMENT)
2087
+ return True
2088
+
2089
+ @staticmethod
2090
+ @skip_validation()
2091
+ def _validate_file_extension(file_path, extension):
2092
+ """
2093
+ DESCRIPTION:
2094
+ Function to validate whether the file has a specified extension.
2095
+
2096
+ PARAMETERS:
2097
+ file_path:
2098
+ Required Argument.
2099
+ Specifies the file path or file name.
2100
+ Types: str
2101
+
2102
+ extension:
2103
+ Required Argument.
2104
+ Specifies the extension of the file.
2105
+ Types: str OR list of Strings (str)
2106
+
2107
+ RETURNS:
2108
+ True, if the file has specified extension.
2109
+
2110
+ RAISES:
2111
+ TeradataMLException
2112
+
2113
+ EXAMPLES:
2114
+
2115
+ _Validators._validate_file_extension("/data/mapper.py",".py")
2116
+ _Validators._validate_file_extension("ml__demoenv_requirements_1605727131624097.txt",".txt")
2117
+ """
2118
+ extension = extension if isinstance(extension, list) else [extension]
2119
+ file_extension = file_path.lower().split('.')[-1]
2120
+ if file_extension not in extension:
2121
+ raise TeradataMlException(
2122
+ Messages.get_message(MessageCodes.UNSUPPORTED_FILE_EXTENSION).format("{}".format(extension)),
2123
+ MessageCodes.UNSUPPORTED_FILE_EXTENSION)
2124
+
2125
+ return True
2126
+
2127
+ @staticmethod
2128
+ @skip_validation()
2129
+ def _validate_argument_is_not_None(arg, arg_name, additional_error="", reverse=False):
2130
+ """
2131
+ DESCRIPTION:
2132
+ Check whether the argument provided is not None.
2133
+ If parameter reverse is set to True, the validation is reversed to
2134
+ check whether argument provided is None.
2135
+
2136
+ PARAMETERS:
2137
+ arg:
2138
+ Required Argument.
2139
+ Specifies the argument to be validated.
2140
+ Types: str
2141
+
2142
+ arg_name:
2143
+ Required Argument.
2144
+ Specifies the name of the argument to be printed in error message.
2145
+ Types: str
2146
+
2147
+ additional_error:
2148
+ Optional Argument.
2149
+ Specifies the additional error message to display along with standard message.
2150
+ Default value=""
2151
+ Types: str
2152
+
2153
+ reverse:
2154
+ Optional Argument.
2155
+ Specifies whether to reverse the validation.
2156
+ Returns True if arg is None, False if arg is not None.
2157
+ Default value=False
2158
+ Types: bool
2159
+
2160
+
2161
+ RAISES:
2162
+ ValueError.
2163
+
2164
+ RETURNS:
2165
+ True, if the argument is not None, else False.
2166
+
2167
+ EXAMPLES:
2168
+ >>> _validate_argument_is_not_None(table_name, "table_name", additional_error)
2169
+ """
2170
+ if not reverse:
2171
+ # Raise an error if the argument is None.
2172
+ if arg is None:
2173
+ raise ValueError(Messages.get_message(MessageCodes.ARG_NONE, arg_name, "None", additional_error))
2174
+ return True
2175
+ else:
2176
+ # Raise an error if the argument is not None.
2177
+ if arg is not None:
2178
+ raise ValueError(Messages.get_message(MessageCodes.ARG_NONE, arg_name,
2179
+ "provided {}".format(additional_error), ""))
2180
+ return True
2181
+
2182
+ @staticmethod
2183
+ @skip_validation()
2184
+ def _validate_dataframe(df, raise_error=True):
2185
+ """
2186
+ This is an internal function checks whether the dataframe is none
2187
+ or not. If not none then checks the dataframe type and length of columns.
2188
+
2189
+ PARAMETERS:
2190
+ df:
2191
+ Required Argument.
2192
+ Specifies the dataframe.
2193
+ Types: pandas.DataFrame or teradataml.dataframe.dataframe.DataFrame
2194
+
2195
+ raise_error:
2196
+ Optional Argument.
2197
+ Specifies whether to raise an exception or not.
2198
+ Default Values: True
2199
+ Types: bool
2200
+
2201
+ RETURNS:
2202
+ None
2203
+
2204
+ RAISES:
2205
+ TeradataMlException
2206
+
2207
+ EXAMPLES:
2208
+ _validate_dataframe(df)
2209
+
2210
+ """
2211
+ from teradataml.dataframe import dataframe as tdmldf
2212
+
2213
+ valid = False
2214
+ if df is not None:
2215
+ if isinstance(df, pd.DataFrame) and len(df.columns) > 0:
2216
+ valid = True
2217
+ elif isinstance(df, tdmldf.DataFrame) and len(df._metaexpr.c) > 0:
2218
+ valid = True
2219
+ else:
2220
+ valid = False
2221
+
2222
+ if raise_error and not valid:
2223
+ raise TeradataMlException(Messages.get_message(MessageCodes.IS_NOT_VALID_DF),
2224
+ MessageCodes.IS_NOT_VALID_DF)
2225
+
2226
+ @staticmethod
2227
+ @skip_validation()
2228
+ def _validate_column_value_length(argument_name, argument_value, allowed_length,
2229
+ operation='perform the operation'):
2230
+ """
2231
+ DESCRIPTION:
2232
+ Function to validate length of string against permitted value.
2233
+
2234
+ PARAMETERS:
2235
+ argument_name:
2236
+ Required Argument.
2237
+ Specifies the name of the argument whose value
2238
+ will be checked against permitted length.
2239
+ This is used while raising an error.
2240
+ Types: str.
2241
+
2242
+ argument_value:
2243
+ Required Argument.
2244
+ Specifies the string whose length will be checked against permitted length.
2245
+ Types: str.
2246
+
2247
+ allowed_length:
2248
+ Required Argument.
2249
+ Specifies the allowed length for argument value.
2250
+ Types: int.
2251
+
2252
+ operation:
2253
+ Optional Argument.
2254
+ Specifies the name of operation which will fail, if this check fails.
2255
+ Default value: 'perform the operation'.
2256
+ Types: str.
2257
+
2258
+ RETURNS:
2259
+ None.
2260
+
2261
+ RAISES:
2262
+ TeradataMlException - EXECUTION_FAILED, ValueError
2263
+
2264
+ EXAMPLES:
2265
+ >>> _validate_column_value_length("Description", "KMeans model", 150, "save the model")
2266
+ """
2267
+ try:
2268
+ _Validators._validate_str_arg_length(argument_name, argument_value, 'LE', allowed_length)
2269
+ except ValueError:
2270
+ error_code = MessageCodes.EXECUTION_FAILED
2271
+ error_msg = Messages.get_message(
2272
+ error_code, operation,
2273
+ 'Length of argument {0} ({1}) is more than the allowed length ({2}).'
2274
+ .format(argument_name, len(argument_value), allowed_length))
2275
+ raise TeradataMlException(error_msg, error_code)
2276
+ return True
2277
+
2278
+ @staticmethod
2279
+ @skip_validation()
2280
+ def _validate_list_lengths_equal(list1, arg_name1, list2, arg_name2):
2281
+ """
2282
+ DESCRIPTION:
2283
+ Check if length of the lists is same or not.
2284
+
2285
+ PARAMETERS:
2286
+ list1:
2287
+ Required Argument.
2288
+ Specifies the first list to check the length against "list2".
2289
+ Types: list
2290
+
2291
+ arg_name1:
2292
+ Required Argument.
2293
+ Specifies the name of the argument that accepts "list1" as input.
2294
+ This is used while raising an error.
2295
+ Types: str
2296
+
2297
+ list2:
2298
+ Required Argument.
2299
+ Specifies the second list to check the length against "list1".
2300
+ Types: list
2301
+
2302
+ arg_name2:
2303
+ Required Argument.
2304
+ Specifies the name of the argument that accepts "list2" as input.
2305
+ This is used while raising an error.
2306
+ Types: str
2307
+
2308
+ RETURNS:
2309
+ None.
2310
+
2311
+ RAISES:
2312
+ ValueError
2313
+
2314
+ EXAMPLES:
2315
+ _Validators._validate_list_lengths_equal(self.coordinates, "coordinates",
2316
+ self.timestamps, "timestamps")
2317
+ """
2318
+ if len(list1) != len(list2):
2319
+ # Raise error, if length of both lists is not same.
2320
+ err_ = Messages.get_message(MessageCodes.INVALID_LENGTH_ARGS,
2321
+ "'{}' and '{}'".format(arg_name1, arg_name2))
2322
+ raise ValueError(err_)
2323
+ return True
2324
+
2325
+ @staticmethod
2326
+ @skip_validation()
2327
+ def _validate_dict_argument_key_value(arg_name, arg_dict, key_types=None, value_types=None,
2328
+ key_permitted_values=None, value_permitted_values=None,
2329
+ value_empty_string=True):
2330
+ """
2331
+ DESCRIPTION:
2332
+ Internal function to validate type and permitted values
2333
+ for keys and values in a dictionary argument.
2334
+
2335
+ PARAMETERS:
2336
+ arg_name:
2337
+ Required Argument.
2338
+ Specifies the name of the dictionary argument.
2339
+ Types: str
2340
+
2341
+ arg_dict:
2342
+ Required Argument.
2343
+ Specifies the dictonary value of "arg_name".
2344
+ Types: dict
2345
+
2346
+ key_types:
2347
+ Optional Argument.
2348
+ Specifies the types, 'keys' of the "arg_dict" can take.
2349
+ Types: Any type or tuple of types
2350
+
2351
+ value_types:
2352
+ Optional Argument.
2353
+ Specifies the types, 'values' assigned to 'keys' of
2354
+ "arg_dict" can take.
2355
+ Types: Any type or tuple of types
2356
+
2357
+ key_permitted_values:
2358
+ Optional Argument.
2359
+ Specifies the permitted values for the 'keys' of "arg_dict".
2360
+ Types: list
2361
+
2362
+ value_permitted_values:
2363
+ Optional Argument.
2364
+ Specifies the permitted values for the 'values' assgined to 'keys'
2365
+ of "arg_dict".
2366
+ Types: list
2367
+
2368
+ value_empty_string:
2369
+ Optional Argument.
2370
+ Specifies the whether 'values' assigned to 'keys' of "arg_dict"
2371
+ can accept empty string.
2372
+ Set to True, dictionary value with empty string is accepted.
2373
+ Set to False, dictionary value with empty string is not accepted.
2374
+ Default Value: True
2375
+ Types: bool
2376
+
2377
+ RETURNS:
2378
+ bool
2379
+
2380
+ RAISES:
2381
+ TypeError, ValueError
2382
+
2383
+ EXAMPLES:
2384
+ _Validators._validate_dict_argument_key_value("name", {"a":3, "b":4}, (str), (int))
2385
+ _Validators._validate_dict_argument_key_value(arg_name="columns", arg_dict=columns,
2386
+ key_types=(ColumnExpression, _TupleOf(ColumnExpression)),
2387
+ value_types=(str, int, float, NoneType))
2388
+
2389
+ """
2390
+ info_matrix = []
2391
+ dict_keys_list = set()
2392
+ from teradataml.common.utils import UtilFuncs
2393
+
2394
+ try:
2395
+ for key, value in arg_dict.items():
2396
+ # Validate duplicate keys exists or not.
2397
+ # If keys are not of type tuple, convert it to tuple.
2398
+ keys_list = (key,) if not isinstance(key, tuple) else key
2399
+
2400
+ # If duplicate key exists raise exception. E.g.
2401
+ # di = {("key1", "key2"): "my_keys1",
2402
+ # ("key1", "key3"): "my_keys2",
2403
+ # "key2" : "my_keys3"}
2404
+ for k in keys_list:
2405
+ # If ColumnExpression, get the column name.
2406
+ if isinstance(k, ColumnExpression):
2407
+ k_name, name = k.name, "ColumnExpression(s)"
2408
+ else:
2409
+ k_name, name = k, "Key names"
2410
+
2411
+ # If duplicate key exists raise exception.
2412
+ if k_name in dict_keys_list:
2413
+ raise TeradataMlException(Messages.get_message(
2414
+ MessageCodes.DUPLICATE_DICT_KEYS_NAMES,
2415
+ name, arg_name),
2416
+ MessageCodes.DUPLICATE_PARAMETER)
2417
+ else:
2418
+ dict_keys_list.add(k_name)
2419
+
2420
+ # Append "keys" and "values" into arg info matrix for type validation.
2421
+ if key_types is not None:
2422
+ info_matrix.append(["<dict_key>", key, True, key_types, True])
2423
+
2424
+ if value_types is not None:
2425
+ info_matrix.append(
2426
+ ["<dict_value>", value, True, value_types, not value_empty_string])
2427
+
2428
+ # Validate permitted values for both "key" and "value" if permitted values
2429
+ # are provided.
2430
+ if key_permitted_values is not None:
2431
+ _Validators._validate_permitted_values(arg=key,
2432
+ permitted_values=key_permitted_values,
2433
+ arg_name="<dict_key>",
2434
+ case_insensitive=False,
2435
+ includeNone=True)
2436
+
2437
+ if value_permitted_values is not None:
2438
+ _Validators._validate_permitted_values(arg=value,
2439
+ permitted_values=value_permitted_values,
2440
+ arg_name="<dict_value>",
2441
+ case_insensitive=False,
2442
+ includeNone=True)
2443
+
2444
+ if key_types is not None or value_types is not None:
2445
+ # Validate types using already existing validator.
2446
+ _Validators._validate_function_arguments(info_matrix)
2447
+
2448
+ except ValueError as ve:
2449
+ # Catch ValueError raised by '_validate_permitted_values' to
2450
+ # raise proper error message for dictionary argument.
2451
+ if "TDML_2007" in str(ve):
2452
+ permitted_values = value_permitted_values
2453
+ err_str = "value"
2454
+ err_val = value
2455
+ if "<dict_key>" in str(ve):
2456
+ permitted_values = key_permitted_values
2457
+ err_str = "key"
2458
+ err_val = key
2459
+ raise ValueError(
2460
+ Messages.get_message(MessageCodes.INVALID_DICT_ARG_VALUE, err_val,
2461
+ err_str, arg_name, permitted_values))
2462
+
2463
+ # Catch ValueError raised by '_validate_function_arguments'
2464
+ # for empty string value.
2465
+ elif "TDML_2004" in str(ve):
2466
+ err_str = "Key" if "<dict_key>" in str(ve) else "Value"
2467
+ raise ValueError(
2468
+ Messages.get_message(MessageCodes.DICT_ARG_KEY_VALUE_EMPTY,
2469
+ err_str, arg_name))
2470
+
2471
+ except TypeError as te:
2472
+ # Catch TypeError raised by '_validate_function_arguments' to
2473
+ # raise proper error message for dictionary argument.
2474
+ permitted_types = value_types
2475
+ err_str = "value"
2476
+ if "<dict_key>" in str(te):
2477
+ permitted_types = key_types
2478
+ err_str = "key"
2479
+
2480
+ permitted_types = [''.join(_Validators.__getTypeAsStr(kv_type))
2481
+ if isinstance(kv_type, (_TupleOf, _ListOf)) else
2482
+ kv_type.__name__ for kv_type in permitted_types]
2483
+
2484
+ raise TypeError(
2485
+ Messages.get_message(MessageCodes.UNSUPPORTED_DICT_KEY_VALUE_DTYPE, err_str,
2486
+ arg_name, permitted_types))
2487
+
2488
+ return True
2489
+
2490
+ @staticmethod
2491
+ @skip_validation()
2492
+ def _validate_http_response(http_response, valid_status_code, error_msg):
2493
+ """
2494
+ DESCRIPTION:
2495
+ Internal function to validate the HTTP response.
2496
+
2497
+ PARAMETERS:
2498
+ http_response:
2499
+ Required Argument.
2500
+ Specifies the response object recieved from HTTP request.
2501
+ Types: requests.models.Response OR httpx.Response
2502
+
2503
+ valid_status_code:
2504
+ Required Argument.
2505
+ Specifies the HTTP response code of a request.
2506
+ Types: int
2507
+
2508
+ error_msg:
2509
+ Required Argument.
2510
+ Specifies the error message to be displayed when response code is
2511
+ not equal to "valid_status_code".
2512
+ Types: str
2513
+
2514
+ RETURNS:
2515
+ bool
2516
+
2517
+ RAISES:
2518
+ TeradatamlException
2519
+
2520
+ EXAMPLES:
2521
+ _Validators._validate_http_response(resp, 200, "test1")
2522
+ """
2523
+ if http_response.status_code != valid_status_code:
2524
+ err_ = Messages.get_message(MessageCodes.EXECUTION_FAILED,
2525
+ error_msg,
2526
+ "Error-details: ({}){}".format(http_response.status_code, http_response.text))
2527
+ raise TeradataMlException(err_, MessageCodes.EXECUTION_FAILED)
2528
+
2529
+ return True
2530
+
2531
+ @staticmethod
2532
+ @skip_validation()
2533
+ def _validate_module_presence(module_name, function_name):
2534
+ """
2535
+ DESCRIPTION:
2536
+ Check if module being imported is present.
2537
+
2538
+ PARAMETERS:
2539
+ module_name:
2540
+ Required Argument.
2541
+ Specifies the name of the module to import.
2542
+ Types: str
2543
+
2544
+ function_name:
2545
+ Required Argument.
2546
+ Specifies the name of the function from where module is imported.
2547
+ Types: str
2548
+
2549
+ RETURNS:
2550
+ None.
2551
+
2552
+ RAISES:
2553
+ TeradataMlException
2554
+
2555
+ EXAMPLES:
2556
+ _Validators._validate_module_presence("docker", "setup_sandbox_env")
2557
+ """
2558
+ import importlib
2559
+
2560
+ try:
2561
+ importlib.import_module(module_name, package=None)
2562
+ except Exception as err:
2563
+ message = \
2564
+ Messages.get_message(
2565
+ MessageCodes.IMPORT_PYTHON_PACKAGE,
2566
+ module_name, module_name, function_name)
2567
+ raise TeradataMlException(message,
2568
+ MessageCodes.IMPORT_PYTHON_PACKAGE)
2569
+ return True
2570
+
2571
+ @staticmethod
2572
+ @skip_validation()
2573
+ def _validate_ipaddress(ip_address):
2574
+ """
2575
+ DESCRIPTION:
2576
+ Check if ipaddress is valid.
2577
+ PARAMETERS:
2578
+ ip_address:
2579
+ Required Argument.
2580
+ Specifies the ip address to be validated.
2581
+ Types: str
2582
+ RETURNS:
2583
+ None.
2584
+ RAISES:
2585
+ TeradataMlException
2586
+ EXAMPLES:
2587
+ _Validators._validate_ipaddress("190.132.12.15")
2588
+ """
2589
+ import ipaddress
2590
+
2591
+ try:
2592
+ ipaddress.ip_address(ip_address)
2593
+ except Exception as err:
2594
+ raise ValueError(Messages.get_message(
2595
+ MessageCodes.INVALID_ARG_VALUE).format(ip_address, "ip_address",
2596
+ 'of four numbers (each between 0 and 255) separated by periods'))
2597
+
2598
+ return True
2599
+
2600
+ @staticmethod
2601
+ @skip_validation()
2602
+ def _check_auth_token(func_name):
2603
+ """
2604
+ DESCRIPTION:
2605
+ Check if the user has set the authentication token.
2606
+
2607
+ PARAMETERS:
2608
+ func_name:
2609
+ Required Argument.
2610
+ Specifies the function name where the authentication token is required.
2611
+ Types: str
2612
+
2613
+ RAISES:
2614
+ TeradataMLException
2615
+
2616
+ RETURNS:
2617
+ None.
2618
+
2619
+ EXAMPLES:
2620
+ >>> _Validators._check_auth_token("udf")
2621
+ """
2622
+ if _InternalBuffer.get("auth_token") is None:
2623
+ raise TeradataMlException(Messages.get_message(MessageCodes.SET_REQUIRED_PARAMS, \
2624
+ 'Auth Token', func_name,
2625
+ 'set_auth_token'),
2626
+ MessageCodes.SET_REQUIRED_PARAMS)
2627
+
2628
+ return True
2629
+
2630
+ @staticmethod
2631
+ def _check_required_params(arg_value, arg_name, caller_func_name, target_func_name):
2632
+ """
2633
+ DESCRIPTION:
2634
+ Check if the required argument is not None.
2635
+
2636
+ PARAMETERS:
2637
+ arg_value:
2638
+ Required Argument.
2639
+ Specifies the argument value to be
2640
+ checked for non None values.
2641
+ Types: str, float, int, bool
2642
+
2643
+ arg_name:
2644
+ Required Argument.
2645
+ Specifies the argument name.
2646
+ Types: str
2647
+
2648
+ caller_func_name:
2649
+ Required Argument.
2650
+ Specifies the function name which calls this function.
2651
+ This is required for the error message.
2652
+ Types: str
2653
+
2654
+ target_func_name:
2655
+ Required Argument.
2656
+ Specifies the function name which the user needs to call
2657
+ so that the error is fixed.
2658
+ This is required for the error message.
2659
+ Types: str
2660
+
2661
+ RAISES:
2662
+ TeradataMLException
2663
+
2664
+ RETURNS:
2665
+ True.
2666
+
2667
+ EXAMPLES:
2668
+ >>> _Validators._check_required_params("udf", "arg_name")
2669
+ """
2670
+ if arg_value is None:
2671
+ raise TeradataMlException(Messages.get_message(MessageCodes.SET_REQUIRED_PARAMS, \
2672
+ arg_name, caller_func_name,
2673
+ target_func_name),
2674
+ MessageCodes.SET_REQUIRED_PARAMS)
2675
+ return True
2676
+
2677
+ @staticmethod
2678
+ def _valid_list_length(arg_value, arg_name, required_length):
2679
+ """
2680
+ DESCRIPTION:
2681
+ Check if the argument has length matching the required length.
2682
+
2683
+ PARAMETERS:
2684
+ arg_value:
2685
+ Required Argument.
2686
+ Specifies the argument value.
2687
+ Types: _ListOf
2688
+
2689
+ arg_name:
2690
+ Required Argument.
2691
+ Specifies the argument name.
2692
+ Types: str
2693
+
2694
+ required_length:
2695
+ Required Argument.
2696
+ Specifies the required list length.
2697
+ Types: int
2698
+
2699
+ RAISES:
2700
+ TeradataMlException
2701
+
2702
+ RETURNS:
2703
+ True.
2704
+
2705
+ EXAMPLES:
2706
+ >>> _Validators._valid_list_length(["udf", "udf1"], "arg_name", 2)
2707
+ """
2708
+ if (isinstance(arg_value, list) and len(arg_value) != required_length) or \
2709
+ (not isinstance(arg_value, list)):
2710
+ raise TeradataMlException(Messages.get_message(
2711
+ MessageCodes.INVALID_LIST_LENGTH).format(arg_name,
2712
+ required_length),
2713
+ MessageCodes.INVALID_LIST_LENGTH)
2714
+ return True
2715
+
2716
+ @staticmethod
2717
+ @skip_validation()
2718
+ def _validate_non_empty_list_or_valid_selection(arg_list, arg_name):
2719
+ """
2720
+ DESCRIPTION:
2721
+ Validation to ensure that the given list-type argument is not empty or contains only invalid entries
2722
+ like None, '', 'None', etc.
2723
+
2724
+ PARAMETERS:
2725
+ arg_list:
2726
+ Required Argument.
2727
+ Specifies the list or iterable for validation.
2728
+ Types: list
2729
+
2730
+ arg_name:
2731
+ Required Argument.
2732
+ Specifies the argument name.
2733
+ Types: str
2734
+
2735
+ RAISES:
2736
+ ValueError - If the list is None, empty, or contains only invalid values.
2737
+
2738
+ RETURNS:
2739
+ True - If validation passes (non-empty and has valid entries).
2740
+
2741
+ EXAMPLES:
2742
+ >>> _Validators._validate_non_empty_list_or_valid_selection(self.model_list, "List of models")
2743
+ """
2744
+
2745
+ error_code = MessageCodes.LIST_SELECT_NONE_OR_EMPTY
2746
+ if not arg_list or all(x in [None, "None", ""] for x in arg_list):
2747
+ raise TeradataMlException(Messages.get_message(error_code).format(arg_name), error_code)
2748
+ return True
2749
+
2750
+ @staticmethod
2751
+ def _validate_temporal_table_type(df_type, api_type='method', api_name='as_of'):
2752
+ """
2753
+ DESCRIPTION:
2754
+ Function to validate temporal table type.
2755
+
2756
+ PARAMETERS:
2757
+ df_type:
2758
+ Required Argument.
2759
+ Specifies the type of temporal table.
2760
+ Types: str
2761
+
2762
+ api_type:
2763
+ Required Argument.
2764
+ Specifies the type of API.
2765
+ Types: str
2766
+
2767
+ api_name:
2768
+ Required Argument.
2769
+ Specifies the name of API.
2770
+ Types: str
2771
+
2772
+ RETURNS:
2773
+ None.
2774
+
2775
+ RAISES:
2776
+ TeradataMLException
2777
+
2778
+ EXAMPLES:
2779
+ >>> _Validators._validate_temporal_table_type('method', 'as_of')
2780
+ """
2781
+ if df_type not in (DataFrameTypes.VALID_TIME_VIEW.name,
2782
+ DataFrameTypes.TRANSACTION_TIME_VIEW.name,
2783
+ DataFrameTypes.BI_TEMPORAL_VIEW.name,
2784
+ DataFrameTypes.BI_TEMPORAL.name,
2785
+ DataFrameTypes.TRANSACTION_TIME.name,
2786
+ DataFrameTypes.VALID_TIME.name,
2787
+ DataFrameTypes.VALID_TIME_VOLATILE_TABLE.name,
2788
+ DataFrameTypes.TRANSACTION_TIME_VOLATILE_TABLE.name,
2789
+ DataFrameTypes.BI_TEMPORAL_VOLATILE_TABLE.name
2790
+ ):
2791
+ raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_USAGE,
2792
+ api_type,
2793
+ "'{}'".format(api_name),
2794
+ "when underlying table or view is temporal type"),
2795
+ MessageCodes.INVALID_USAGE)
2796
+
2797
+ @staticmethod
2798
+ def _validate_as_of_arguments(df_type, argument_name='valid_time'):
2799
+ """
2800
+ DESCRIPTION:
2801
+ Function to validate arguments passed for method as_of.
2802
+ One can not pass argument 'valid_time' for a transaction time table
2803
+ One can not pass argument 'transaction_time' for a valid time table.
2804
+ Both the validations are done in this validator.
2805
+
2806
+ PARAMETERS:
2807
+ df_type:
2808
+ Required Argument.
2809
+ Specifies the type of temporal table.
2810
+ Types: str
2811
+
2812
+ argument_name:
2813
+ Optional Argument.
2814
+ Specifies the name of the argument.
2815
+ Default Value: 'valid_time'
2816
+ Types: str
2817
+
2818
+ RETURNS:
2819
+ None.
2820
+
2821
+ RAISES:
2822
+ TeradataMLException
2823
+
2824
+ EXAMPLES:
2825
+ >>> _Validators._validate_temporal_table_type('method', 'as_of')
2826
+ """
2827
+ valid_types = (
2828
+ DataFrameTypes.TRANSACTION_TIME_VIEW.name,
2829
+ DataFrameTypes.TRANSACTION_TIME.name,
2830
+ DataFrameTypes.TRANSACTION_TIME_VOLATILE_TABLE.name
2831
+ )
2832
+ table_type = 'transaction time dimension'
2833
+
2834
+ if argument_name == 'valid_time':
2835
+ valid_types = (DataFrameTypes.VALID_TIME_VIEW.name,
2836
+ DataFrameTypes.VALID_TIME.name,
2837
+ DataFrameTypes.VALID_TIME_VOLATILE_TABLE.name
2838
+ )
2839
+ table_type = 'valid time dimension'
2840
+
2841
+ bi_temporal_types = (
2842
+ DataFrameTypes.BI_TEMPORAL_VIEW.name,
2843
+ DataFrameTypes.BI_TEMPORAL.name,
2844
+ DataFrameTypes.BI_TEMPORAL_VOLATILE_TABLE.name
2845
+ )
2846
+
2847
+ # Raise error only if it is not a bitemporal table.
2848
+ if (df_type not in bi_temporal_types) and (df_type not in valid_types):
2849
+ raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_USAGE,
2850
+ 'argument',
2851
+ "'{}'".format(argument_name),
2852
+ "when underlying table or view is in {}".format(table_type)),
2853
+ MessageCodes.INVALID_USAGE)
2854
+
2855
+ @staticmethod
2856
+ def _validate_period_column_type(column_type):
2857
+ """
2858
+ DESCRIPTION:
2859
+ Function to validate the type of a period column.
2860
+
2861
+ PARAMETERS:
2862
+ column_type:
2863
+ Required Argument.
2864
+ Specifies the type of the column to be validated.
2865
+ Types: Any
2866
+
2867
+ RETURNS:
2868
+ None
2869
+
2870
+ RAISES:
2871
+ TeradataMlException
2872
+
2873
+ EXAMPLES:
2874
+ _Validators._validate_period_column_type(PERIOD_DATE)
2875
+ """
2876
+ if not isinstance(column_type, (PERIOD_DATE, PERIOD_TIMESTAMP)):
2877
+ raise TeradataMlException(
2878
+ Messages.get_message(
2879
+ MessageCodes.INVALID_COLUMN_TYPE
2880
+ ).format(
2881
+ "period column",
2882
+ type(column_type).__name__,
2883
+ "PERIOD_DATE or PERIOD_TIMESTAMP"
2884
+ ),
2885
+ MessageCodes.INVALID_COLUMN_TYPE
2886
+ )
2887
+ @staticmethod
2888
+ @skip_validation()
2889
+ def _validate_features_not_in_efs_dataset(df,
2890
+ feature_names,
2891
+ action):
2892
+ """
2893
+ DESCRIPTION:
2894
+ Function to validate whether the feature names provided
2895
+ are not present in the EFS dataset.
2896
+
2897
+ PARAMETERS:
2898
+ df:
2899
+ Required Argument.
2900
+ Specifies the EFS dataset dataframe.
2901
+ Types: teradataml.dataframe.dataframe.DataFrame
2902
+
2903
+ feature_names:
2904
+ Required Argument.
2905
+ Specifies the feature names to be validated.
2906
+ Types: str or list of str
2907
+
2908
+ action:
2909
+ Required Argument.
2910
+ Specifies the action to be performed.
2911
+ Permitted Values: 'archived', 'deleted'
2912
+ Types: str
2913
+
2914
+ RETURNS:
2915
+ True, if the feature names are not present in the EFS dataset.
2916
+
2917
+ RAISES:
2918
+ TeradataMlException
2919
+
2920
+ EXAMPLES:
2921
+ >>> _Validators._validate_features_not_in_efs_dataset(df, ["feature1", "feature2"], "delete")
2922
+ """
2923
+ if isinstance(feature_names, str):
2924
+ feature_names = [feature_names]
2925
+
2926
+ invalid_df = df[(df['feature_name'].isin(feature_names))]
2927
+
2928
+ if invalid_df.shape[0] > 0:
2929
+ names = set()
2930
+ datasets = set()
2931
+ for feature in invalid_df.itertuples():
2932
+ names.add(feature.feature_name)
2933
+ datasets.add(feature.dataset_id)
2934
+ datasets_str = ", ".join(f"'{dataset}'" for dataset in datasets)
2935
+ name_str = ", ".join(f"'{name}'" for name in names)
2936
+
2937
+ error_code = MessageCodes.EFS_FEATURE_IN_DATASET
2938
+ error_msg = Messages.get_message(error_code,
2939
+ name_str,
2940
+ datasets_str,
2941
+ action)
2942
+ raise TeradataMlException(error_msg, error_code)
2943
+
2944
+ return True
2945
+
2946
+ @staticmethod
2947
+ def _validate_dataset_ids_not_in_efs(df, ids, data_domain, repo):
2948
+ """
2949
+ DESCRIPTION:
2950
+ Function to validate whether the dataset ids provided
2951
+ are not present in the EFS.
2952
+
2953
+ PARAMETERS:
2954
+ df:
2955
+ Required Argument.
2956
+ Specifies the EFS dataset dataframe.
2957
+ Types: teradataml.dataframe.dataframe.DataFrame
2958
+
2959
+ ids:
2960
+ Required Argument.
2961
+ Specifies the dataset ids to be validated.
2962
+ Types: str or list of str
2963
+
2964
+ data_domain:
2965
+ Required Argument.
2966
+ Specifies the data domain for the feature process.
2967
+ Types: str
2968
+
2969
+ repo:
2970
+ Required Argument.
2971
+ Specifies the repository to be used for validation.
2972
+ Types: str
2973
+
2974
+ RETURNS:
2975
+ True, if the dataset ids are not present in the EFS.
2976
+
2977
+ RAISES:
2978
+ TeradataMlException
2979
+
2980
+ EXAMPLES:
2981
+ >>> _Validators._validate_features_not_in_efs_dataset(df, ["12-dek-3e3-dek"], "d1")
2982
+ """
2983
+ from teradataml.common.utils import UtilFuncs
2984
+ id_list_flag = False if isinstance(ids, str) else True
2985
+ list_ids = UtilFuncs._as_list(ids)
2986
+
2987
+ # Check if the dataset ids are present in the domain.
2988
+ df = df[(df['id'].isin(list_ids)) &
2989
+ (df['data_domain'] == data_domain)]
2990
+ matched_ids = [i.id for i in df.select("id").itertuples()]
2991
+ # Get the list of dataset ids that are not present in the domain.
2992
+ missing_ids = [i for i in list_ids if i not in matched_ids]
2993
+
2994
+ # If there are ids that are not present in the domain,
2995
+ # raise an exception with appropriate error message.
2996
+ if len(missing_ids) > 0:
2997
+ if id_list_flag:
2998
+ msg_code = MessageCodes.EFS_OBJECT_NOT_EXIST
2999
+ error_msg = Messages.get_message(msg_code, "Dataset", "id(s): {}".format(missing_ids),
3000
+ data_domain) + " Use DatasetCatalog.list_datasets() to list valid dataset ids."
3001
+ else:
3002
+ # Check if the dataset id is present in any other domain.
3003
+ from teradataml.store.feature_store.utils import _FSUtils
3004
+ res = _FSUtils._get_data_domains(repo, ids, 'dataset')
3005
+ if res:
3006
+ msg_code = MessageCodes.EFS_OBJECT_IN_OTHER_DOMAIN
3007
+ error_msg = Messages.get_message(msg_code, "Dataset", "id '{}'".format(ids),
3008
+ data_domain, res)
3009
+ else:
3010
+ msg_code = MessageCodes.EFS_OBJECT_NOT_EXIST
3011
+ error_msg = Messages.get_message(msg_code, "Dataset", "id '{}'".format(ids),
3012
+ data_domain)
3013
+ raise TeradataMlException(error_msg, msg_code)
3014
+
3015
+ return True
3016
+
3017
+
3018
+ @staticmethod
3019
+ @skip_validation()
3020
+ def _validate_duplicate_objects(objects, type_="features", arg_name='features'):
3021
+ """
3022
+ DESCRIPTION:
3023
+ Function to validate that there are no duplicate objects in the provided list.
3024
+
3025
+ PARAMETERS:
3026
+ objects:
3027
+ Required Argument.
3028
+ Specifies the objects to validate for duplicates.
3029
+ Types: list or tuple
3030
+
3031
+ type_:
3032
+ Optional Argument.
3033
+ Specifies the type of objects being validated.
3034
+ Default Value: "features"
3035
+ Types: str
3036
+
3037
+ arg_name:
3038
+ Optional Argument.
3039
+ Specifies the name of the argument being validated.
3040
+ Default Value: "features"
3041
+ Types: str
3042
+
3043
+ RAISES:
3044
+ TeradataMlException
3045
+
3046
+ Returns:
3047
+ bool
3048
+
3049
+ EXAMPLES:
3050
+ >>> load_examples_data('dataframe', 'sales')
3051
+ >>> df = DataFrame('sales')
3052
+
3053
+ # Example 1: Validate duplicate features in the list.
3054
+ >>> feature1 = Feature("Jan", df.Jan)
3055
+ >>> _Validators._validate_duplicate_objects([feature1, 'Jan', 'Feb'])
3056
+
3057
+ # Example 2: Validate duplicate datetime.datetime objects in tuple.
3058
+ >>> t = datetime.datetime(2025, 1, 1, 0, 0, 1)
3059
+ >>> td = datetime.date(2025, 1, 1)
3060
+ >>> _Validators._validate_duplicate_objects((td, td.strftime('%Y-%m-%d %H:%M:%S'), t))
3061
+ """
3062
+ from teradataml.common.utils import UtilFuncs
3063
+ from teradataml.store.feature_store.models import Feature
3064
+ seen = set()
3065
+ duplicates = set()
3066
+
3067
+ if isinstance(objects, (list, tuple)):
3068
+ for obj in objects:
3069
+ if isinstance(obj, Feature):
3070
+ name = obj.column_name
3071
+ elif isinstance(obj, (datetime.datetime, datetime.date)):
3072
+ name = obj.strftime('%Y-%m-%d %H:%M:%S')
3073
+ else:
3074
+ name = obj
3075
+
3076
+ if name in seen:
3077
+ duplicates.add(name)
3078
+ else:
3079
+ seen.add(name)
3080
+
3081
+ if len(duplicates) > 0:
3082
+ msg = "{} in {}".format(
3083
+ ", ".join(["'{}'".format(duplicate) for duplicate in sorted(duplicates)]),
3084
+ "'{}' argument".format(arg_name)
3085
+ )
3086
+ raise TeradataMlException(
3087
+ Messages.get_message(
3088
+ MessageCodes.DF_DUPLICATE_VALUES,
3089
+ type_,
3090
+ msg
3091
+ ),
3092
+ MessageCodes.DF_DUPLICATE_VALUES)
3093
+
3094
+ return True
3095
+
3096
+ @staticmethod
3097
+ @skip_validation()
3098
+ def _validate_duplicate_values(df, columns, arg_name, columns_arg='entity column(s)'):
3099
+ """
3100
+ DESCRIPTION:
3101
+ Function to validate that there are no duplicate records in the DataFrame
3102
+ based on the specified columns.
3103
+
3104
+ PARAMETERS:
3105
+ df:
3106
+ Required Argument.
3107
+ Specifies the DataFrame to validate for duplicates.
3108
+ Types: teradataml DataFrame
3109
+
3110
+ columns:
3111
+ Required Argument.
3112
+ Specifies the columns to check for duplicates.
3113
+ Types: str or list of str
3114
+
3115
+ arg_name:
3116
+ Required Argument.
3117
+ Specifies the name of the argument being validated.
3118
+ Types: str
3119
+
3120
+ columns_arg:
3121
+ Optional Argument.
3122
+ Specifies the name of the columns argument.
3123
+ Default Value: 'entity column(s)'
3124
+ Types: str
3125
+
3126
+ RAISES:
3127
+ TeradataMlException
3128
+
3129
+ Returns:
3130
+ bool
3131
+
3132
+ EXAMPLES:
3133
+ >>> _Validators._validate_duplicate_records(df, ['col1', 'col2'], 'columns')
3134
+ """
3135
+ columns = [columns] if isinstance(columns, str) else columns
3136
+ df_ = df.groupby(columns).assign(total_rows_=func.count('*'))
3137
+ duplicate_recs = df_[df_.total_rows_ > 1].shape[0]
3138
+
3139
+ if duplicate_recs > 0:
3140
+ msg = "in {} {} provided in argument {}".format(
3141
+ columns_arg,
3142
+ ", ".join(["'{}'".format(col) for col in columns]),
3143
+ "'{}'".format(arg_name)
3144
+ )
3145
+ raise TeradataMlException(
3146
+ Messages.get_message(
3147
+ MessageCodes.DF_DUPLICATE_VALUES,
3148
+ "values in {}".format(columns_arg),
3149
+ msg
3150
+ ),
3151
+ MessageCodes.DF_DUPLICATE_VALUES)
3152
+
3153
+ return True
3154
+
3155
+ @staticmethod
3156
+ @skip_validation()
3157
+ def _validate_null_values(df,
3158
+ columns,
3159
+ arg_name,
3160
+ columns_arg='entity column(s)',
3161
+ operation='ingesting the features'):
3162
+ """
3163
+ DESCRIPTION:
3164
+ Function to validate that there are no null values in the specified columns
3165
+ of the DataFrame.
3166
+
3167
+ PARAMETERS:
3168
+ df:
3169
+ Required Argument.
3170
+ Specifies the DataFrame to validate for null values.
3171
+ Types: teradataml DataFrame
3172
+
3173
+ columns:
3174
+ Required Argument.
3175
+ Specifies the columns to check for null values.
3176
+ Types: str or list of str
3177
+
3178
+ arg_name:
3179
+ Required Argument.
3180
+ Specifies the name of the argument being validated.
3181
+ Types: str
3182
+
3183
+ columns_arg:
3184
+ Optional Argument.
3185
+ Specifies the name of the columns argument.
3186
+ Default Value: 'entity column(s)'
3187
+ Types: str
3188
+
3189
+ operation:
3190
+ Optional Argument.
3191
+ Specifies the operation being performed.
3192
+ Default Value: 'ingesting the features'
3193
+ Types: str
3194
+
3195
+ RAISES:
3196
+ TeradataMlException
3197
+
3198
+ Returns:
3199
+ bool
3200
+
3201
+ EXAMPLES:
3202
+ >>> _Validators._validate_null_values(df, ['col1', 'col2'], 'columns')
3203
+ """
3204
+ columns = [columns] if isinstance(columns, str) else columns
3205
+ col_expr = (df[columns[0]] == None)
3206
+ for column in columns[1:]:
3207
+ col_expr = col_expr | (df[column] == None)
3208
+
3209
+ null_count = df[col_expr].shape[0]
3210
+
3211
+ if null_count > 0:
3212
+ msg = "in {} {} provided in argument {}".format(
3213
+ columns_arg,
3214
+ ", ".join(["'{}'".format(col) for col in columns]),
3215
+ "'{}'".format(arg_name)
3216
+ )
3217
+ raise TeradataMlException(
3218
+ Messages.get_message(
3219
+ MessageCodes.DF_NULL_VALUES,
3220
+ columns_arg,
3221
+ operation,
3222
+ msg
3223
+ ),
3224
+ MessageCodes.DF_NULL_VALUES)
3225
+
3226
+ return True
3227
+
3228
+ @staticmethod
3229
+ @skip_validation()
3230
+ def _validate_archived_features(features_to_validate, archived_features, msg=""):
3231
+ """
3232
+ DESCRIPTION:
3233
+ Function to validate that the features are already archived or not.
3234
+ If archived, it raises an exception.
3235
+
3236
+ PARAMETERS:
3237
+ features_to_validate:
3238
+ Required Argument.
3239
+ Specifies the features to be validated for archiving.
3240
+ Types: list of str
3241
+
3242
+ archived_features:
3243
+ Required Argument.
3244
+ Specifies the set of already archived features.
3245
+ Types: set of str
3246
+
3247
+ msg:
3248
+ Optional Argument.
3249
+ Specifies the additional message to be displayed in the exception.
3250
+ Default Value: ""
3251
+ Types: str
3252
+
3253
+ RAISES:
3254
+ TeradataMlException
3255
+
3256
+ Returns:
3257
+ bool
3258
+
3259
+ EXAMPLES:
3260
+ >>> _Validators._validate_archived_features(['feature1', 'feature2'], {'feature1'})
3261
+ """
3262
+ features_to_validate = [features_to_validate] if isinstance(features_to_validate, str) \
3263
+ else features_to_validate
3264
+ archived_features = [f for f in features_to_validate if f in archived_features]
3265
+
3266
+ if archived_features:
3267
+ raise TeradataMlException(
3268
+ Messages.get_message(MessageCodes.FEATURES_ARCHIVED,
3269
+ ", ".join("'{}'".format(f) for f in archived_features),
3270
+ msg
3271
+ ),
3272
+ MessageCodes.FEATURES_ARCHIVED)
3273
+
3274
+ return True
3275
+
3276
+ @staticmethod
3277
+ @skip_validation()
3278
+ def _validate_any_argument_passed(args_dict):
3279
+ """
3280
+ DESCRIPTION:
3281
+ Check if any value in the argument dictionary is not None.
3282
+ If all values are None, raise an exception.
3283
+
3284
+ PARAMETERS:
3285
+ args_dict:
3286
+ Required Argument.
3287
+ Specifies the argument to value dictionary to check.
3288
+ Types: dict
3289
+
3290
+ RAISES:
3291
+ TeradataMlException
3292
+
3293
+ Returns:
3294
+ bool
3295
+
3296
+ EXAMPLES:
3297
+ >>> _Validators._validate_any_argument_passed({"arg1": None, "arg2": "abc"})
3298
+ """
3299
+ if all(value is None for value in args_dict.values()):
3300
+ msg_code = MessageCodes.EITHER_ANY_ARGUMENT
3301
+ argument_description = " or ".join(["'{}'".format(key) for key in args_dict.keys()])
3302
+ error_msg = Messages.get_message(msg_code, argument_description)
3303
+ raise TeradataMlException(error_msg, msg_code)
3304
+
3305
+ return True