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,2157 @@
1
+ """
2
+ Copyright (c) 2020 by Teradata Corporation. All rights reserved.
3
+ TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
4
+
5
+ Primary Owner: Trupti.purohit@teradata.com
6
+ Secondary Owner: Gouri.patwardhan@Teradata.com
7
+
8
+ teradataml load library service wrappers.
9
+ ----------
10
+ All teradataml wrappers to provide interface to load library service stored procedures
11
+ from Open Analytics Framework.
12
+ """
13
+ import base64
14
+ import concurrent.futures
15
+ import functools
16
+ import json
17
+ import operator
18
+ import os
19
+ import warnings
20
+ from json.decoder import JSONDecodeError
21
+ from time import sleep, time
22
+ from urllib.parse import urlparse
23
+
24
+ import pandas as pd
25
+
26
+ from teradataml import configure
27
+ from teradataml.clients.auth_client import _AuthWorkflow
28
+ from teradataml.clients.keycloak_client import _KeycloakManager
29
+ from teradataml.clients.pkce_client import _DAWorkflow
30
+ from teradataml.common.constants import (AsyncOpStatus, AsyncStatusColumns,
31
+ AuthMechs, HTTPRequest, TDServices)
32
+ from teradataml.common.exceptions import TeradataMlException
33
+ from teradataml.common.messagecodes import MessageCodes
34
+ from teradataml.common.messages import Messages
35
+ from teradataml.common.utils import UtilFuncs
36
+ from teradataml.context.context import _get_user, get_connection
37
+ from teradataml.scriptmgmt.UserEnv import (UserEnv, _AuthToken,
38
+ _get_auth_token, _get_ccp_url,
39
+ _get_ues_url, _process_ues_response)
40
+ from teradataml.telemetry_utils.queryband import collect_queryband
41
+ from teradataml.utils.internal_buffer import _InternalBuffer
42
+ from teradataml.utils.utils import _async_run_id_info
43
+ from teradataml.utils.validators import _Validators
44
+
45
+
46
+ @collect_queryband(queryband="LstBsEnv")
47
+ def list_base_envs():
48
+ """
49
+ DESCRIPTION:
50
+ Lists the available Python and R base environments versions configured in the
51
+ Open Analytics Framework.
52
+ Note:
53
+ Function is not applicable for conda environments.
54
+ User can use any Python version while creating conda environment as long as Anaconda supports it.
55
+
56
+ PARAMETERS:
57
+ None.
58
+
59
+ RETURNS:
60
+ Pandas DataFrame.
61
+ If the operation is successful, function returns
62
+ environment name, language and version of the language interpreter in a Pandas dataframe.
63
+
64
+ RAISES:
65
+ TeradataMlException.
66
+
67
+ EXAMPLES:
68
+ >>> from teradataml import list_base_envs
69
+ >>> list_base_envs()
70
+ base_name language version
71
+ 0 python_3.7.13 Python 3.7.13
72
+ 1 python_3.8.13 Python 3.8.13
73
+ 2 python_3.9.13 Python 3.9.13
74
+ 3 r_4.1.3 R 4.1.3
75
+ 4 r_3.6.3 R 3.6.3
76
+ 5 r_4.0.2 R 4.0.2
77
+ >>>
78
+ """
79
+ # Check if the cache data is available and is not stale.
80
+ # If available, return the data.
81
+ if _InternalBuffer.get('list_base_envs') is not None:
82
+ return _InternalBuffer.get('list_base_envs')
83
+
84
+ try:
85
+ response = UtilFuncs._http_request(_get_ues_url("base_environments"), headers=_get_auth_token())
86
+
87
+ response = _process_ues_response(api_name="list_base_envs", response=response)
88
+ data = response.json()
89
+
90
+ # If no data, raise warning.
91
+ if len(data) == 0:
92
+ warnings.warn(Messages.get_message(MessageCodes.NO_ENVIRONMENT_FOUND, "Python/R base"))
93
+ return
94
+
95
+ # Create a pandas DataFrame from data.
96
+ _InternalBuffer.add(list_base_envs=pd.DataFrame.from_records(data))
97
+ return _InternalBuffer.get('list_base_envs')
98
+
99
+ except (TeradataMlException, RuntimeError):
100
+ raise
101
+ except Exception as emsg:
102
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
103
+ error_msg = Messages.get_message(msg_code, "list_base_envs", str(emsg))
104
+ raise TeradataMlException(error_msg, msg_code)
105
+
106
+
107
+ @collect_queryband(queryband="LstUsrEnv")
108
+ def list_user_envs(env_name=None, **kwargs):
109
+ """
110
+ DESCRIPTION:
111
+ Lists the Python OR R environments created by the session user in
112
+ Open Analytics Framework.
113
+
114
+ PARAMETERS:
115
+ env_name:
116
+ Optional Argument.
117
+ Specifies the string or regular expression to filter name of the environment.
118
+ Types: str
119
+
120
+ base_env:
121
+ Optional Argument.
122
+ Specifies the string or regular expression to filter the base Python environment.
123
+ Types: str
124
+
125
+ desc:
126
+ Optional Argument.
127
+ Specifies the string or regular expression to filter the description
128
+ about the environment.
129
+ Types: str
130
+
131
+ case:
132
+ Optional Argument.
133
+ Specifies whether filtering operation should be case sensitive or not.
134
+ Default Value: False
135
+ Types: boolean
136
+
137
+ conda_env:
138
+ Optional Argument.
139
+ Specifies the boolean value to filter the conda environment(s).
140
+ When set to True, all conda environments are listed.
141
+ When set to False, all non-conda environments are listed.
142
+ If not specified, all user environments are listed.
143
+ Types: bool
144
+
145
+ regex:
146
+ Optional Argument.
147
+ Specifies whether string passed to "env_name", "base_env", and "desc"
148
+ should be treated as regular expression or a literal.
149
+ When set to True, string is considered as a regular expression pattern,
150
+ otherwise treats it as literal string.
151
+ Default Value: True
152
+ Types: boolean
153
+
154
+ flags:
155
+ Optional Argument.
156
+ Specifies flags to pass for regular expressions in filtering.
157
+ For example
158
+ re.IGNORECASE.
159
+ Default Value: 0
160
+ Types: int
161
+
162
+ RETURNS:
163
+ Pandas DataFrame.
164
+ Function returns remote user environments and their details in a Pandas dataframe.
165
+ Function will help user find environments created, version of Python language used
166
+ in the environment and description of each environment if provided at the time of
167
+ environment creation.
168
+
169
+ RAISES:
170
+ TeradataMlException.
171
+
172
+ EXAMPLES:
173
+ # Create example environments.
174
+ >>> create_env('Fraud_Detection',
175
+ ... 'python_3.7.13',
176
+ ... 'Fraud detection through time matching')
177
+ User environment 'Fraud_detection' created.
178
+ >>> create_env('Lie_Detection',
179
+ ... 'python_3.7.13',
180
+ ... 'Lie detection through time matching')
181
+ User environment 'Lie_Detection' created.
182
+ >>> create_env('Lie_Detection_ML',
183
+ ... 'python_3.8.13',
184
+ ... 'Detect lie through machine learning.')
185
+ User environment 'Lie_Detection_ML' created.
186
+ >>> create_env('Sales_env',
187
+ ... 'python_3.9.13',
188
+ ... 'Sales team environment.')
189
+ User environment 'Sales_env' created.
190
+ >>> create_env('Customer_Trends',
191
+ ... 'r_4.1.3',
192
+ ... 'Analyse customer trends.')
193
+ User environment 'Customer_Trends' created.
194
+ >>> create_env('Carbon_Credits',
195
+ ... 'r_3.6.3',
196
+ ... 'Prediction of carbon credits consumption.')
197
+ User environment 'Carbon_Credits' created.
198
+ >>> create_env('Sales_cond_env',
199
+ ... 'python_3.9',
200
+ ... 'Sales team environment.',
201
+ ... conda_env=True)
202
+ Conda environment creation initiated.
203
+ User environment 'Sales_cond_env' created.
204
+
205
+ # Example 1: List all available user environments.
206
+ >>> list_user_envs()
207
+ env_name env_description base_env_name language conda
208
+ 0 Carbon_Credits Prediction of carbon credits consumption r_3.6.3 R False
209
+ 1 Customer_Trends Analyse customer trends r_4.1.3 R False
210
+ 2 Fraud_Detection Fraud detection through time matching python_3.7.13 Python False
211
+ 3 Lie_Detection Lie detection through time matching python_3.7.13 Python False
212
+ 4 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python False
213
+ 5 Sales_env Sales team environment. python_3.9.13 Python False
214
+ 6 Sales_cond_env Sales team environment. python_3.9 Python True
215
+
216
+
217
+ # Example 2: List all user environments with environment name containing string
218
+ # "Detection" and description that contains string "."(period).
219
+ >>> list_user_envs(env_name="Detection", desc=".", regex=False)
220
+ env_name env_description base_env_name language conda
221
+ 2 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python False
222
+ >>>
223
+
224
+ # Example 3: List all user environments with description that contains string "lie"
225
+ # and is case sensitive.
226
+ >>> list_user_envs(desc="lie", case=True)
227
+ env_name env_description base_env_name language conda
228
+ 4 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python False
229
+ >>>
230
+
231
+ # Example 4: List all user environments with base environment version containing string
232
+ # "3.".
233
+ >>> list_user_envs(base_env="3.")
234
+ env_name env_description base_env_name language conda
235
+ 0 Carbon_Credits Prediction of carbon credits consumption r_3.6.3 R False
236
+ 2 Fraud_Detection Fraud detection through time matching python_3.7.13 Python False
237
+ 3 Lie_Detection Lie detection through time matching python_3.7.13 Python False
238
+ 4 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python False
239
+ 5 Sales_env Sales team environment. python_3.9.13 Python False
240
+ 6 Sales_conda_env Sales team environment. python_3.9 Python True
241
+
242
+ >>>
243
+
244
+ # Example 5: List all user environments with environment name contains string "detection",
245
+ # description containing string "fraud" and base environment containing string "3.7".
246
+ >>> list_user_envs("detection", desc="fraud", base_env="3.7")
247
+ env_name env_description base_env_name language conda
248
+ 2 Fraud_Detection Fraud detection through time matching python_3.7.13 Python False
249
+ >>>
250
+
251
+ # Example 6: List all user environments with environment name that ends with "detection".
252
+ >>> list_user_envs("detection$")
253
+ env_name env_description base_env_name language conda
254
+ 2 Fraud_Detection Fraud detection through time matching python_3.7.13 Python False
255
+ 3 Lie_Detection Lie detection through time matching python_3.7.13 Python False
256
+ >>>
257
+
258
+ # Example 7: List all user environments with description that has either "lie" or "sale".
259
+ # Use re.VERBOSE flag to add inline comment.
260
+ >>> list_user_envs(desc="lie|sale # Search for lie or sale.", flags=re.VERBOSE)
261
+ env_name env_description base_env_name language conda
262
+ 3 Lie_Detection Lie detection through time matching python_3.7.13 Python False
263
+ 4 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python False
264
+ 5 Sales_env Sales team environment. python_3.9.13 Python False
265
+ 6 Sales_conda_env Sales team environment. python_3.9 Python True
266
+ >>>
267
+
268
+ # Example 8: List all user environments where python 3 environment release version has
269
+ # odd number. For e.g. python_3.7.x.
270
+ >>> list_user_envs(base_env="\\.\\d*[13579]\\.")
271
+ env_name env_description base_env_name language
272
+ 1 Customer_Trends Analyse customer trends r_4.1.3 R
273
+ 2 Fraud_Detection Fraud detection through time matching python_3.7.13 Python
274
+ 3 Lie_Detection Lie detection through time matching python_3.7.13 Python
275
+ 5 Sales_env Sales team environment. python_3.9.13 Python
276
+ >>>
277
+
278
+ # Example 9: List all conda environments.
279
+ >>> list_user_envs(conda_env=True)
280
+ env_name env_description base_env_name language conda
281
+ 6 Sales_conda_env Sales team environment. python_3.9 Python True
282
+ >>>
283
+ # Remove example environments.
284
+ remove_env("Fraud_Detection")
285
+ remove_env("Lie_Detection")
286
+ remove_env("Lie_Detection_ML")
287
+ remove_env("Sales_env")
288
+ remove_env("Carbon_Credits")
289
+ remove_env("Customer_Trends")
290
+ remove_env("Sales_conda_env")
291
+ """
292
+ base_env = kwargs.pop("base_env", None)
293
+ desc = kwargs.pop("desc", None)
294
+ case = kwargs.pop("case", False)
295
+ conda_env = kwargs.pop("conda_env", None)
296
+
297
+ __arg_info_matrix = []
298
+ __arg_info_matrix.append(["env_name", env_name, True, (str), True])
299
+ __arg_info_matrix.append(["base_env", base_env, True, (str), True])
300
+ __arg_info_matrix.append(["desc", desc, True, (str), True])
301
+ __arg_info_matrix.append(["conda_env", conda_env, True, (bool)])
302
+
303
+ # Validate arguments
304
+ _Validators._validate_function_arguments(__arg_info_matrix)
305
+
306
+ try:
307
+ response = UtilFuncs._http_request(_get_ues_url(), headers=_get_auth_token())
308
+ # Below condition is special case handling when remove_all_envs() used by user, remove_all_envs()
309
+ # removes all the envs which result in a status_code 404 and due to which warnings provided in
310
+ # list_user_envs() not appears.
311
+ if response.status_code == 404 and "No user environments found." in response.text:
312
+ data = []
313
+ else:
314
+ response = _process_ues_response(api_name="list_user_envs", response=response)
315
+ data = response.json()
316
+
317
+ if len(data) > 0:
318
+ unknown_label = "Unknown"
319
+ # Check if environment is corrupted or not. If it is corrupted, alter the details.
320
+ for base_env_details in data:
321
+ if base_env_details["base_env_name"] == "*":
322
+ base_env_details["base_env_name"] = unknown_label
323
+ base_env_details["language"] = unknown_label
324
+ base_env_details["env_description"] = "Environment is corrupted. Use remove_env() to remove environment."
325
+
326
+ # Return result as Pandas dataframe.
327
+ pandas_df = pd.DataFrame.from_records(data)
328
+ # Filter based on arguments passed by user.
329
+ exprs = []
330
+ if env_name is not None:
331
+ exprs.append(pandas_df.env_name.str.contains(pat=env_name, case=case, **kwargs))
332
+ if base_env is not None:
333
+ exprs.append(pandas_df.base_env_name.str.contains(pat=base_env, case=case, **kwargs))
334
+ if desc is not None:
335
+ exprs.append(pandas_df.env_description.str.contains(pat=desc, case=case, **kwargs))
336
+ if conda_env is not None:
337
+ exprs.append(pandas_df.conda == conda_env)
338
+
339
+ pandas_df = pandas_df[functools.reduce(operator.and_, exprs)] if exprs else pandas_df
340
+
341
+ # Return the DataFrame if not empty.
342
+ if len(pandas_df) > 0:
343
+ return pandas_df
344
+
345
+ print("No user environment(s) found.")
346
+ except (TeradataMlException, RuntimeError):
347
+ raise
348
+ except Exception as emsg:
349
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
350
+ error_msg = Messages.get_message(msg_code, "list_user_envs", emsg)
351
+ raise TeradataMlException(error_msg, msg_code)
352
+
353
+
354
+ def __create_envs(template):
355
+ """
356
+ DESCRIPTION:
357
+ Function creates remote environment(s) as per the specifications provided
358
+ in template json file. Template file contains information about each env
359
+ w.r.t. env name, base env name, env description, files/libs to be
360
+ installed in env.
361
+
362
+ PARAMETERS:
363
+ template:
364
+ Required Argument.
365
+ Specifies the path to template json file to be used for
366
+ env creation.
367
+ Types: str
368
+
369
+ RETURNS:
370
+ None.
371
+
372
+ RAISES:
373
+ TeradataMlException.
374
+
375
+ EXAMPLES:
376
+ # Create environments.
377
+ >>> __create_envs(template="create_env_template.json")
378
+ """
379
+ __arg_info_matrix = []
380
+ __arg_info_matrix.append(["template", template, False, (str), True])
381
+ # Validate argument.
382
+ _Validators._validate_function_arguments(__arg_info_matrix)
383
+
384
+ # Validate the file extension.
385
+ _Validators._validate_file_extension(template, ['json'])
386
+
387
+ # Validate existence of template file.
388
+ _Validators._validate_file_exists(template)
389
+
390
+ # Extract env specs from template file and
391
+ # process request for each env one by one.
392
+ create_env_specs = {}
393
+ try:
394
+ with open(template, 'r') as f:
395
+ create_env_specs = json.load(f)
396
+ except IOError:
397
+ raise
398
+ except JSONDecodeError as json_err:
399
+ raise Exception("Failed to read template json file. {}".format(json_err))
400
+
401
+ requested_envs = UtilFuncs._as_list(create_env_specs['env_specs'])
402
+
403
+ last_successful_env = None
404
+ for env_request in requested_envs:
405
+ # Create env.
406
+ env_name = env_request.get('env_name', None)
407
+ conda_env = env_request.get('conda_env', False)
408
+
409
+ if env_name:
410
+ try:
411
+ # Remove from dictionary and store the specifications
412
+ # which are not required for env creation.
413
+ files = env_request.pop('files', None)
414
+ libs = env_request.pop('libs', None)
415
+ libs_file_path = env_request.pop('libs_file_path', None)
416
+
417
+ print("Creating environment '{}'...".format(env_name))
418
+ create_env(**env_request)
419
+
420
+ print("An empty environment '{}' is created.".format(env_name))
421
+
422
+ env_handle = get_env(env_name)
423
+
424
+ errored = False
425
+ # Install files if requested any.
426
+ if files:
427
+ print("Installing files in environment '{}'...".format(env_name))
428
+ if isinstance(files, str):
429
+ files = [files]
430
+
431
+ for file in files:
432
+ try:
433
+ if os.path.isfile(file):
434
+ env_handle.install_file(file)
435
+ elif os.path.isdir(file):
436
+ errored = __install_files(env_handle, file)
437
+ except Exception as file_installation_failure:
438
+ print("Failed to install file '{}' in environment '{}'.".format(file, env_name))
439
+ print(str(file_installation_failure))
440
+ errored = True
441
+ pass
442
+
443
+ # Install libraries if requested any.
444
+ if libs or libs_file_path:
445
+ print("Installing libraries in environment '{}'...".format(env_name))
446
+ try:
447
+ status = env_handle.install_lib(libs, libs_file_path)
448
+ if status['Stage'][1] == 'Errored':
449
+ err_message = status['Additional Details'][1].replace("Error with package maintenance -> ", "\n")
450
+ raise Exception(err_message)
451
+ else:
452
+ print("Libraries installation in environment '{}' - Completed.".format(env_name))
453
+ except Exception as lib_installation_failure:
454
+ error_code = MessageCodes.FUNC_EXECUTION_FAILED
455
+ error_msg = Messages.get_message(error_code,
456
+ "'install_lib' request for enviornment: '{}'".format(env_name),
457
+ '\n' + str(lib_installation_failure))
458
+ print(error_msg)
459
+ errored = errored or True
460
+ pass
461
+
462
+ # Print specifications of created env.
463
+ if errored:
464
+ print("Created environment '{}'.".format(env_name))
465
+ print("Part of request is not successful. Address manually.")
466
+ else:
467
+ print("Created environment '{}' with specified requirements.".format(env_name))
468
+ print(env_handle)
469
+ last_successful_env = env_handle
470
+ except Exception as env_creation_failure:
471
+ print("Failed to process request for environment: '{}'".format(env_name))
472
+ print(str(env_creation_failure))
473
+ pass
474
+ return last_successful_env
475
+
476
+
477
+ def __get_default_base_env(lang="python"):
478
+ """
479
+ DESCRIPTION:
480
+ Function returns the name of latest environment available with
481
+ Open Analytics Framework for given programming language.
482
+
483
+ PARAMETERS:
484
+ lang:
485
+ Optional Argument.
486
+ Specifies the language for which latest base env is to be retrieved.
487
+ Default value: "python"
488
+ Permitted values: "python", "r", "PYTHON", "R"
489
+ Types: str
490
+
491
+ RETURNS:
492
+ Base environment name.
493
+
494
+ RAISES:
495
+ None.
496
+
497
+ EXAMPLES:
498
+ # Get default R base environment.
499
+ >>> __get_default_base_env(lang="R")
500
+ """
501
+ lang = lang.lower()
502
+ default_env_key = "default_base_env_{}".format(lang)
503
+ # Check if the default base environment is already available.
504
+ if _InternalBuffer.get(default_env_key) is not None:
505
+ return _InternalBuffer.get(default_env_key)
506
+
507
+ try:
508
+ base_envs = list_base_envs()
509
+ versions = base_envs[base_envs.language.str.lower() == lang]['version']
510
+ # Convert version strings to tuples of integers for comparison
511
+ version_tuples = [tuple(map(int, version.split('.'))) for version in versions]
512
+ # Find the latest version tuple using max() function
513
+ latest_version_tuple = max(version_tuples)
514
+ # Convert the latest version tuple back to a string
515
+ latest_version = '.'.join(map(str, latest_version_tuple))
516
+ # Get the base environment name for the latest version and add in internal buffer.
517
+ _InternalBuffer.add(**{default_env_key:
518
+ base_envs[base_envs.version == latest_version]['base_name'].to_list()[0]})
519
+ return _InternalBuffer.get(default_env_key)
520
+ except Exception as base_env_err:
521
+ raise Exception("Failed to obtain default base environment.", str(base_env_err))
522
+
523
+
524
+ def __install_files(env, directory):
525
+ """
526
+ Function to install files under given directory and
527
+ all the subdirectories recursively.
528
+ """
529
+ errored = False
530
+ for (dir_path, dir_names, file_names) in os.walk(directory):
531
+ # install the files under all the directories.
532
+ # If any problem with any file installation, skip the error
533
+ # and proceed to install other files.
534
+ for file_name in file_names:
535
+ try:
536
+ env.install_file(os.path.join(dir_path, file_name))
537
+ except Exception as file_installation_failure:
538
+ print("Failed to install file '{}' in environment '{}'.".format(file_name, env.env_name))
539
+ print(str(file_installation_failure))
540
+ errored = True
541
+
542
+ return errored
543
+
544
+
545
+ @collect_queryband(queryband="CrtEnv")
546
+ def create_env(env_name=None, base_env=None, desc=None, template=None, conda_env=False):
547
+ """
548
+ DESCRIPTION:
549
+ Creates isolated remote user environment(s) in the Open Analytics
550
+ Framework that include a specific Python or R language interpreter version.
551
+ Available base Python or R environments can be found using list_base_envs()
552
+ function. When "template" argument is provided, additionally, files/libs are
553
+ installed if specified in template file. Out of provided specifications in
554
+ template file, if any of the environment creation fails, failure message is
555
+ printed on console and next environment creation is taken up.
556
+
557
+ PARAMETERS:
558
+ env_name:
559
+ Required when "template" is not used, optional otherwise.
560
+ Specifies the name of the environment to be created.
561
+ Note:
562
+ Either "env_name" or "template" argument must be specified.
563
+ Types: str
564
+
565
+ base_env:
566
+ Optional Argument.
567
+ Specifies the name of the base Python or R environment
568
+ to be used to create remote user environment when "env_name"
569
+ is provided. This argument is ignored when "template" is provided.
570
+ Notes:
571
+ * When "base_env" is not provided, highest Python
572
+ base environment listed by list_base_envs() is used.
573
+ * When creating a conda environment, user can pass any Python version
574
+ supported by Anaconda to "base_env", irrespective of base environments
575
+ listed with list_base_envs().
576
+ Types: str
577
+
578
+ desc:
579
+ Optional Argument.
580
+ Specifies description for the remote environment when "env_name"
581
+ is provided. This argument is ignored when "template" is provided.
582
+ Default value: "This env '<env_name>' is created with base env
583
+ '<base_env>'."
584
+ Types: str
585
+
586
+ template:
587
+ Required when "env_name" is not used, optional otherwise.
588
+ Specifies the path to template json file containing details
589
+ of the user environment(s) to be created. Using the template
590
+ file one can create one or more user environments with same or
591
+ different requirements. This template file can contain following
592
+ information about the environments to be created:
593
+ * Name of the environment. (Required)
594
+ * Base Python version to be used. (Optional)
595
+ * Description for the environment. (Optional)
596
+ * Files or libraries to be installed in the environment. (Optional).
597
+
598
+ Here is a sample example of the template file:
599
+ {
600
+ "env_specs" : [
601
+ {
602
+ "env_name" : "<name of the user environment_MUST_BE_SPECIFIED>",
603
+ "base_env" : "<OPTIONAL_base_env>",
604
+ "desc": "<OPTIONAL_env_description>",
605
+ "libs": ["<OPTIONAL>", "<List_of_libs_to_be_installed>"] OR "<location_of_requirements.txt>"
606
+ "files": ["<OPTIONAL>", "<full_path_the_file>", "<full_path_to_dir>"]
607
+ },
608
+ {
609
+ "env_name" : "....",
610
+ "base_env" : "...",
611
+ "desc": "..",
612
+ "libs": ..
613
+ "files": ...
614
+ },
615
+ {
616
+ ...
617
+ },
618
+ {
619
+ ...
620
+ }
621
+ ]
622
+ }
623
+ Notes:
624
+ * Either "template" or "env_name" argument must be specified.
625
+ * Template file can contain details about single or multiple
626
+ environments to be created. At least one is required.
627
+ * Content of template file should adhere to the syntax mentioned
628
+ above. Check example for more details.
629
+ Types: str
630
+
631
+ conda_env:
632
+ Optional Argument.
633
+ Specifies whether the environment to be created is a conda environment or not.
634
+ When set to True, conda environment is created.
635
+ Otherwise, non conda environment is created.
636
+ Note:
637
+ * Currently, only Python conda environment is supported.
638
+ Default value: False
639
+ Types: bool
640
+
641
+
642
+ RETURNS:
643
+ An object of class UserEnv representing the user environment.
644
+ When template file provided with "template" has specifications for multiple
645
+ environments, an object of class UserEnv representing last created environment
646
+ is returned.
647
+
648
+ RAISES:
649
+ TeradataMlException.
650
+
651
+ EXAMPLES:
652
+ # List all available user environments.
653
+ >>> list_base_envs()
654
+ base_name language version
655
+ 0 python_3.7.13 Python 3.7.13
656
+ 1 python_3.8.13 Python 3.8.13
657
+ 2 python_3.9.13 Python 3.9.13
658
+ 3 python_3.10.5 Python 3.10.5
659
+ 4 r_4.1 R 4.1.3
660
+ 5 r_4.0 R 4.0.5
661
+ 6 r_4.2 R 4.2.2
662
+
663
+ # Example 1: Create a Python 3.7.13 environment with given name and description in the Vantage.
664
+ >>> fraud_detection_env = create_env('Fraud_detection',
665
+ ... 'python_3.7.13',
666
+ ... 'Fraud detection through time matching')
667
+ User environment 'Fraud_detection' created.
668
+
669
+ # Example 2: Create a R 4.1.3 environment with given name and description in the Vantage.
670
+ >>> fraud_detection_env = create_env('Carbon_Credits',
671
+ ... 'r_4.1',
672
+ ... 'Prediction of carbon credits consumption')
673
+ User environment 'Carbon_Credits' created.
674
+
675
+ # Example 3: Create multiple environments and install files/libraries
676
+ # in those by providing specifications in template file.
677
+
678
+ # Create a template json file.
679
+ >>> import teradataml, os, json
680
+ >>> tdml_data_path = os.path.join(os.path.dirname(teradataml.__file__), "data")
681
+ ... python_base_env = "python_3.9.13"
682
+ ... r_base_env = "r_4.1"
683
+ ... env_specs = [
684
+ ... {
685
+ ... "env_name": "env_1",
686
+ ... "base_env": python_base_env,
687
+ ... "desc": "Desc for test env 1"
688
+ ... },
689
+ ... {
690
+ ... "env_name": "env_2",
691
+ ... "base_env": r_base_env,
692
+ ... "libs": ["glm2", "stringi"]
693
+ ... "files": [os.path.join(tdml_data_path, "load_example_data.py"),
694
+ ... os.path.join(tdml_data_path, "scripts")]
695
+ ... }
696
+ ... ]
697
+ ... json_data = {"env_specs": env_specs}
698
+ ... with open("template.json", "w") as json_file:
699
+ ... json.dump(json_data, json_file)
700
+
701
+ # Create environments.
702
+ >>> create_env(template="template.json")
703
+ Creating environment 'env_1'...
704
+ User environment 'env_1' created.
705
+ An empty environment 'env_1' is created.
706
+ Created environment 'env_1' with specified requirements.
707
+ Environment Name: env_1
708
+ Base Environment: python_3.9.13
709
+ Description: Desc for test env 1
710
+
711
+ Creating environment 'env_2'...
712
+ User environment 'env_2' created.
713
+ An empty environment 'env_2' is created.
714
+ Installing files in environment 'env_2'...
715
+ File 'load_example_data.py' installed successfully in the remote user environment 'env_2'.
716
+ File 'mapper.py' installed successfully in the remote user environment 'env_2'.
717
+ File 'mapper.R' installed successfully in the remote user environment 'env_2'.
718
+ File 'mapper_replace.py' installed successfully in the remote user environment 'env_2'.
719
+ File installation in environment 'env_2' - Completed.
720
+ Created environment 'env_2' with specified requirements.
721
+ Environment Name: env_2
722
+ Base Environment: r_4.1
723
+ Description: This env 'env_2' is created with base env 'r_4.1'.
724
+
725
+
726
+ ############ Files installed in User Environment ############
727
+
728
+ File Size Timestamp
729
+ 0 mapper.py 547 2023-11-07T10:14:06Z
730
+ 1 mapper.R 613 2023-11-07T10:14:09Z
731
+ 2 load_example_data.py 14158 2023-11-07T10:14:03Z
732
+ 3 mapper_replace.py 552 2023-11-07T10:14:12Z
733
+
734
+
735
+ ############ Libraries installed in User Environment ############
736
+
737
+ name version
738
+ 0 KernSmooth 2.23-20
739
+ 1 MASS 7.3-55
740
+ 2 Matrix 1.4-0
741
+ 3 base 4.1.3
742
+ 4 boot 1.3-28
743
+ 5 class 7.3-20
744
+ 6 cluster 2.1.2
745
+ 7 codetools 0.2-18
746
+ 8 compiler 4.1.3
747
+ 9 datasets 4.1.3
748
+ 10 foreign 0.8-82
749
+ 11 grDevices 4.1.3
750
+ 12 graphics 4.1.3
751
+ 13 grid 4.1.3
752
+ 14 lattice 0.20-45
753
+ 15 methods 4.1.3
754
+ 16 mgcv 1.8-39
755
+ 17 nlme 3.1-155
756
+ 18 nnet 7.3-17
757
+ 19 parallel 4.1.3
758
+ 20 remotes 2.4.2
759
+ 21 rpart 4.1.16
760
+ 22 spatial 7.3-15
761
+ 23 splines 4.1.3
762
+ 24 stats 4.1.3
763
+ 25 stats4 4.1.3
764
+ 26 survival 3.2-13
765
+ 27 tcltk 4.1.3
766
+ 28 tools 4.1.3
767
+ 29 utils 4.1.3
768
+
769
+ # Example 4: Create a Conda Python 3.8 environment with given name and
770
+ # description in the Vantage.
771
+ >>> fraud_detection_env = create_env('Fraud_detection_conda',
772
+ ... 'python_3.8',
773
+ ... 'Fraud detection through time matching',
774
+ ... conda_env=True)
775
+ Conda environment creation initiated.
776
+ User environment 'Fraud_detection_conda' created.
777
+
778
+ # Example 5: Create a Conda R 4.2 environment with given name and
779
+ # description in the Vantage.
780
+ >>> conda_r_env = create_env('conda_r_env',
781
+ ... 'r_4.2',
782
+ ... 'Conda R environment',
783
+ ... conda_env=True)
784
+ Conda environment creation initiated.
785
+ User environment 'conda_r_env' created.
786
+ """
787
+
788
+ # Either env_name or template can be used.
789
+ # At least one is required.
790
+ _Validators._validate_mutually_exclusive_arguments(env_name,
791
+ "env_name",
792
+ template,
793
+ "template",
794
+ skip_all_none_check=False)
795
+ # When env_name is provided, proceed with the conventional way.
796
+ if env_name is not None:
797
+ __arg_info_matrix = []
798
+ __arg_info_matrix.append(["env_name", env_name, False, (str), True])
799
+ __arg_info_matrix.append(["base_env", base_env, True, (str), True])
800
+ __arg_info_matrix.append(["desc", desc, True, (str)])
801
+ __arg_info_matrix.append(["conda_env", conda_env, True, (bool)])
802
+
803
+ # Validate arguments
804
+ _Validators._validate_function_arguments(__arg_info_matrix, skip_empty_check=False)
805
+
806
+ # Get the latest python base env in OpenAF, if base_env is not provided,
807
+ # Or if base_env is provided and not in the list of base envs.
808
+ # Note: By default python base env is obtained.
809
+ if configure.ues_url is not None and \
810
+ get_connection() is not None:
811
+ # Check if base_env is provided or not in the list of base envs.
812
+
813
+ # Check if user requested for conda environment but do not specify the base_env.
814
+ # In such case, set base_env to the default python base environment.
815
+ if conda_env:
816
+ if base_env is None:
817
+ base_env = __get_default_base_env()
818
+ # Not a conda environment.
819
+ else:
820
+ # Check if base_env provided or not. If provided, check if it is available in
821
+ # the list of base envs. If not available, set base_env to the default python base env.
822
+ if not base_env or \
823
+ base_env.lower() not in list_base_envs()['base_name'].str.lower().to_list():
824
+ lang = "python"
825
+ # Print warning message if base_env provided is not available.
826
+ if base_env:
827
+ print(f"Note: The specified base environment '{base_env}' is unavailable. " \
828
+ "Using the default base environment as specified in the documentation.")
829
+ lang = base_env.split('_')[0].lower() # Extract language for given base_env.
830
+ # Set base_env to the default
831
+ base_env = __get_default_base_env(lang=lang)
832
+ if not desc:
833
+ desc = "This env '{}' is created with base env '{}'.".format(env_name, base_env)
834
+ try:
835
+ data = {"env_name": env_name,
836
+ "env_description": desc,
837
+ "base_env_name": base_env
838
+ }
839
+ response = UtilFuncs._http_request(
840
+ _get_ues_url(conda_env=conda_env), HTTPRequest.POST, headers=_get_auth_token(), json=data)
841
+
842
+ # Validate UES response.
843
+ _process_ues_response(api_name="create_env", response=response)
844
+
845
+ msg = "User environment '{}' created."
846
+
847
+ if conda_env:
848
+ print("Conda environment creation initiated.")
849
+ # Get claim_id.
850
+ claim_id = response.json().get("claim_id", "")
851
+
852
+ # Since create_env() for conda environment is internally
853
+ # asynchronous but exposed as synchronous API, keep polling
854
+ # the status of underlying asynchronous operation until
855
+ # it is either successful or errored.
856
+ __poll_claim_id_status(claim_id, "create_env")
857
+ print(msg.format(env_name))
858
+
859
+ # Return an instance of class UserEnv.
860
+ return UserEnv(env_name, base_env, desc, conda_env)
861
+
862
+ except (TeradataMlException, RuntimeError):
863
+ raise
864
+
865
+ except Exception as emsg:
866
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
867
+ error_msg = Messages.get_message(msg_code, "create_env", str(emsg))
868
+ raise TeradataMlException(error_msg, msg_code)
869
+
870
+ else:
871
+ # When template is provided, proceed with recursive way.
872
+ return __create_envs(template)
873
+
874
+
875
+ def _async_run_status_open_af(claim_id):
876
+ """
877
+ DESCRIPTION:
878
+ Internal function to get the status of a claim_id.
879
+
880
+
881
+ PARAMETERS:
882
+ claim_id:
883
+ Required Argument.
884
+ Specifies the unique identifier of the asynchronous process.
885
+ Types: str
886
+
887
+ RETURNS:
888
+ list
889
+
890
+ RAISES:
891
+ None
892
+
893
+ EXAMPLES:
894
+ __get_claim_id_status('278381bf-e3b3-47ff-9ba5-c3b5d9007363')
895
+ """
896
+ # Get the claim id status.
897
+ resp_data = _get_status(claim_id)
898
+
899
+ desc = _async_run_id_info.get(claim_id, {}).get("description", "Unknown")
900
+ get_details = lambda data: {AsyncStatusColumns.ADDITIONAL_DETAILS.value:
901
+ data.pop("details", None),
902
+ AsyncStatusColumns.STATUS.value:
903
+ data.pop("stage", None),
904
+ AsyncStatusColumns.TIMESTAMP.value:
905
+ data.pop("timestamp", None),
906
+ AsyncStatusColumns.RUN_ID.value:
907
+ claim_id,
908
+ AsyncStatusColumns.RUN_DESCRIPTION.value: desc}
909
+
910
+ return [get_details(sub_step) for sub_step in resp_data]
911
+
912
+
913
+ def _get_status(claim_id):
914
+ """
915
+ DESCRIPTION:
916
+ Internal function to get the status of a claim_id using
917
+ status API's REST call.
918
+
919
+
920
+ PARAMETERS:
921
+ claim_id:
922
+ Required Argument.
923
+ Specifies the unique identifier of the asynchronous process.
924
+ Types: str
925
+
926
+ RETURNS:
927
+ list
928
+
929
+ RAISES:
930
+ None
931
+
932
+ EXAMPLES:
933
+ _get_status('278381bf-e3b3-47ff-9ba5-c3b5d9007363')
934
+ """
935
+ # Get the claim id status
936
+ response = UtilFuncs._http_request(_get_ues_url(env_type="fm",
937
+ claim_id=claim_id,
938
+ api_name="status"),
939
+ headers=_get_auth_token())
940
+ return _process_ues_response(api_name="status",
941
+ response=response).json()
942
+
943
+
944
+ @collect_queryband(queryband="RmEnv")
945
+ def remove_env(env_name, **kwargs):
946
+ """
947
+ DESCRIPTION:
948
+ Removes the user's Python or R environment from the Open Analytics Framework.
949
+ The remote user environments are created using create_env() function.
950
+ Note:
951
+ remove_env() should not be triggered on any of the environment if
952
+ install_lib/uninstall_lib/update_lib is running on the corresponding
953
+ environment.
954
+
955
+ PARAMETERS:
956
+ env_name:
957
+ Required Argument.
958
+ Specifies the name of the environment to be removed.
959
+ Types: str
960
+
961
+ **kwargs:
962
+ asynchronous:
963
+ Optional Argument.
964
+ Specifies whether to remove environment synchronously or
965
+ asynchronously. When set to True, environment will be removed
966
+ asynchronously. Otherwise, the environment will be removed synchronously.
967
+ Default Value: False
968
+ Types: bool
969
+
970
+
971
+ RETURNS:
972
+ True, if the operation is synchronous, str otherwise.
973
+
974
+ RAISES:
975
+ TeradataMlException, RuntimeError.
976
+
977
+ EXAMPLES:
978
+ # Create a Python 3.7.13 environment with given name and description in the Vantage.
979
+ >>> fraud_detection_env = create_env('Fraud_detection',
980
+ ... 'python_3.7.13',
981
+ ... 'Fraud detection through time matching')
982
+ User environment 'Fraud_detection' created.
983
+ >>>
984
+ # Create a R 4.1.3 environment with given name and description in the Vantage.
985
+ >>> fraud_detection_env = create_env('Carbon_Credits',
986
+ ... 'r_4.1',
987
+ ... 'Prediction of carbon credits consumption')
988
+ User environment 'Carbon_Credits' created.
989
+ >>>
990
+ # Example 1: Remove Python environment asynchronously.
991
+ >>> remove_env('Fraud_detection', asynchronous=True)
992
+ Request to remove environment initiated successfully. Check the status using list_user_envs(). If environment is not removed, check the status of asynchronous call using async_run_status('ab34cac6-667a-49d7-bac8-d0456f372f6f') or get_env('Fraud_detection').status('ab34cac6-667a-49d7-bac8-d0456f372f6f')
993
+ 'ab34cac6-667a-49d7-bac8-d0456f372f6f'
994
+
995
+ >>>
996
+ # Example 2: Remove R environment synchronously.
997
+ >>> remove_env('Carbon_Credits')
998
+ User environment 'Carbon_Credits' removed.
999
+ True
1000
+ """
1001
+ __arg_info_matrix = []
1002
+ __arg_info_matrix.append(["env_name", env_name, False, (str), True])
1003
+
1004
+ # Validate arguments
1005
+ _Validators._validate_function_arguments(__arg_info_matrix)
1006
+
1007
+ status = __manage_envs(env_name=env_name, api_name="remove_env",
1008
+ **kwargs)
1009
+
1010
+ return status
1011
+
1012
+
1013
+ def __manage_envs(env_name=None, api_name="remove_env", **kwargs):
1014
+ """
1015
+ Internal function to manage environment deletion synchronously or
1016
+ asynchronously.
1017
+
1018
+ PARAMETERS:
1019
+ env_name:
1020
+ Optional Argument.
1021
+ Specifies the name of the environment to be removed.
1022
+ Types: str
1023
+
1024
+ api_name:
1025
+ Optional Argument.
1026
+ Specifies the name of the API.
1027
+ Permitted Values: remove_env, remove_all_envs
1028
+ Default Value: remove_env
1029
+ Types: str
1030
+
1031
+ kwargs:
1032
+ asynchronous:
1033
+ Optional Argument.
1034
+ Specifies whether to remove environment synchronously or
1035
+ asynchronously.
1036
+ Default Value: False
1037
+ Types: bool
1038
+
1039
+ is_print:
1040
+ Optional Argument.
1041
+ Specifies whether to print the message or not.
1042
+ Default Value: True
1043
+ Types: bool
1044
+
1045
+
1046
+ RETURNS:
1047
+ True, if the operation is synchronous, str otherwise.
1048
+
1049
+ RAISES:
1050
+ TeradatamlException.
1051
+
1052
+ EXAMPLES:
1053
+ __manage_envs(env_name="test_env", api_name="remove_env", asynchronous=True)
1054
+ """
1055
+ asynchronous = kwargs.get("asynchronous", False)
1056
+ # In case of remove_all_envs(env_type="R") it was printing async msges
1057
+ # multiple times. To restrict that internally introduced is_print.
1058
+ is_print = kwargs.get("is_print", True)
1059
+
1060
+ __arg_info_matrix = []
1061
+ __arg_info_matrix.append(["api_name", api_name, False, (str), True,
1062
+ ["remove_env", "remove_all_envs"]])
1063
+ __arg_info_matrix.append(["asynchronous", asynchronous, True, bool])
1064
+ __arg_info_matrix.append(["is_print", is_print, True, bool])
1065
+
1066
+ # Argument validation.
1067
+ _Validators._validate_missing_required_arguments(__arg_info_matrix)
1068
+ _Validators._validate_function_arguments(__arg_info_matrix)
1069
+
1070
+ try:
1071
+ # Get the ues url for corresponding API.
1072
+ # While deleting environment, endpoint UES URL for deleting
1073
+ # normal and conda environment is same, unlike creating
1074
+ # normal and conda environment.
1075
+ ues_url = _get_ues_url(env_name=env_name, api_name=api_name) if api_name == "remove_env" \
1076
+ else _get_ues_url(remove_all_envs=True, api_name=api_name)
1077
+
1078
+ response = UtilFuncs._http_request(ues_url, HTTPRequest.DELETE,
1079
+ headers=_get_auth_token())
1080
+
1081
+ resp = _process_ues_response(api_name=api_name, response=response)
1082
+ claim_id = resp.json().get("claim_id", "")
1083
+
1084
+ # If env removal is asynchronous, then print the msg for user with
1085
+ # the claim_id. Else, poll the status using __poll_claim_id_status().
1086
+ if asynchronous:
1087
+ if is_print:
1088
+ msg = "Request to remove environment initiated successfully. " \
1089
+ "Check the status using "
1090
+ if api_name == "remove_env":
1091
+ msg = "{2}list_user_envs(). If environment is not removed, " \
1092
+ "check the status of asynchronous call using" \
1093
+ " async_run_status('{1}') or get_env('{0}').status('{1}')". \
1094
+ format(env_name, claim_id, msg)
1095
+ else:
1096
+ msg = "{0}async_run_status('{1}')".format(msg, claim_id)
1097
+ print(msg)
1098
+ # End of 'is_print' condition.
1099
+
1100
+ # Get the description as per the API.
1101
+ desc = "Remove '{}' user environment.".format(env_name) \
1102
+ if api_name == "remove_env" else "Removing all user environments."
1103
+
1104
+ _async_run_id_info[claim_id] = {"mapped_func": _async_run_status_open_af,
1105
+ "description": desc}
1106
+ return claim_id
1107
+ else:
1108
+ # Poll the claim_id status.
1109
+ __poll_claim_id_status(claim_id, api_name)
1110
+ msg = "User environment '{}' removed.".format(env_name) \
1111
+ if api_name == "remove_env" else \
1112
+ "All user environment(s) removed."
1113
+ print(msg)
1114
+ return True
1115
+
1116
+ except Exception as exc:
1117
+ raise exc
1118
+
1119
+
1120
+ def __poll_claim_id_status(claim_id, api_name="remove_env"):
1121
+ """
1122
+ Internal function to periodically poll and check the
1123
+ status of a claim_id.
1124
+
1125
+ PARAMETERS:
1126
+ claim_id:
1127
+ Required Argument.
1128
+ Specifies the unique identifier of the asynchronous process.
1129
+ Types: str
1130
+
1131
+ api_name:
1132
+ Optional Argument.
1133
+ Specifies the name of the API.
1134
+ Permitted Values: remove_env, remove_all_envs, create_env
1135
+ Default Value: remove_env
1136
+ Types: str
1137
+
1138
+ RETURNS:
1139
+ None.
1140
+
1141
+ RAISES:
1142
+ TeradataMlException
1143
+
1144
+ EXAMPLES:
1145
+ __poll_claim_id_status('cf7245f0-e962-4451-addf-efa7e123998d')
1146
+ """
1147
+ err_details = None
1148
+ while True:
1149
+ sleep(2)
1150
+
1151
+ # Poll the claim id to get the status.
1152
+ resp_data = _get_status(claim_id)
1153
+
1154
+ # Breaking condition -
1155
+ # For create_env and remove_env: Check for the 'Finished' stage in the list of resp.
1156
+ # For remove_all_envs: above cond. and No user envs condition should break it .
1157
+ for data in resp_data:
1158
+ if AsyncOpStatus.FINISHED.value in data["stage"]:
1159
+ return
1160
+ elif AsyncOpStatus.ERRED.value in data["stage"]:
1161
+ err_details = data["details"]
1162
+ break
1163
+ if err_details:
1164
+ break
1165
+
1166
+ raise TeradataMlException(Messages.get_message(MessageCodes.FUNC_EXECUTION_FAILED,
1167
+ api_name, err_details),
1168
+ MessageCodes.FUNC_EXECUTION_FAILED)
1169
+
1170
+
1171
+ @collect_queryband(queryband="GtEnv")
1172
+ def get_env(env_name):
1173
+ """
1174
+ DESCRIPTION:
1175
+ Returns an object of class UserEnv which represents an existing remote user environment
1176
+ created in the Open Analytics Framework. The user environment can be created using
1177
+ create_env() function. This function is useful to get an object of existing user
1178
+ environment. The object returned can be used to perform further operations such as
1179
+ installing, removing files and libraries.
1180
+
1181
+ PARAMETERS:
1182
+ env_name:
1183
+ Required Argument.
1184
+ Specifies the name of the existing remote user environment.
1185
+ Types: str
1186
+
1187
+ RETURNS:
1188
+ An object of class UserEnv representing the remote user environment.
1189
+
1190
+ RAISES:
1191
+ TeradataMlException.
1192
+
1193
+ EXAMPLES:
1194
+ # List available Python environments in the Vantage.
1195
+ >>> list_base_envs()
1196
+ base_name language version
1197
+ 0 python_3.6.11 Python 3.6.11
1198
+ 1 python_3.7.9 Python 3.7.9
1199
+ 2 python_3.8.5 Python 3.8.5
1200
+
1201
+ # Create a Python 3.8.5 environment with given name and description in the Vantage and
1202
+ # get an object of class UserEnv.
1203
+ #
1204
+ >>> test_env = create_env('test_env', 'python_3.8.5', 'Fraud detection through time matching')
1205
+ User environment 'test_env' created.
1206
+
1207
+ # In a new terdataml session, user can use get_env() function to get an object pointing to
1208
+ # existing user environment created in previous step so that further operations can be
1209
+ # performed such as install files/libraries.
1210
+ >>> test_env = get_env('test_env')
1211
+ """
1212
+ __arg_info_matrix = []
1213
+ __arg_info_matrix.append(["env_name", env_name, False, (str), True])
1214
+
1215
+ # Validate arguments
1216
+ _Validators._validate_function_arguments(__arg_info_matrix)
1217
+
1218
+ try:
1219
+ # Get environments created by the current logged in user.
1220
+ user_envs_df = list_user_envs()
1221
+
1222
+ if (user_envs_df is None or
1223
+ (not user_envs_df.empty and env_name not in user_envs_df.env_name.values)):
1224
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
1225
+ error_msg = Messages.get_message(msg_code, "get_env()", "User environment '{}' not found."
1226
+ " Use 'create_env()' function to create"
1227
+ " user environment.".format(env_name))
1228
+ raise TeradataMlException(error_msg, msg_code)
1229
+
1230
+ # Get row matching the environment name.
1231
+ userenv_row = user_envs_df[user_envs_df['env_name'] == env_name]
1232
+
1233
+ if userenv_row.base_env_name.values[0] == "Unknown":
1234
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
1235
+ error_msg = Messages.get_message(msg_code, "get_env()", "User environment '{}' is corrupted."
1236
+ " Use 'remove_env()' function to remove"
1237
+ " user environment.".format(env_name))
1238
+ raise TeradataMlException(error_msg, msg_code)
1239
+
1240
+ # Return an instance of class UserEnv.
1241
+ return UserEnv(userenv_row.env_name.values[0],
1242
+ userenv_row.base_env_name.values[0],
1243
+ userenv_row.env_description.values[0],
1244
+ userenv_row.conda.values[0]
1245
+ )
1246
+ except (TeradataMlException, RuntimeError) as tdemsg:
1247
+ # TeradataMlException and RuntimeError are raised by list_user_envs.
1248
+ # list_user_envs should be replaced with get_env in the error
1249
+ # message for final users.
1250
+ tdemsg.args = (tdemsg.args[0].replace("list_user_envs", "get_env"),)
1251
+ raise tdemsg
1252
+ except Exception as emsg:
1253
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
1254
+ error_msg = Messages.get_message(msg_code, "get_env", emsg)
1255
+ raise TeradataMlException(error_msg, msg_code)
1256
+
1257
+
1258
+ @collect_queryband(queryband="RmAllEnvs")
1259
+ def remove_all_envs(env_type=None, **kwargs):
1260
+ """
1261
+ DESCRIPTION:
1262
+ Removes user environments from the Open Analytics Framework. Function allows user
1263
+ to remove only Python user environments or only R user environments or all user
1264
+ environments based on the value passed to argument "env_type".
1265
+ Note:
1266
+ * Do not execute remove_all_envs() if any of the library management functions(install_lib()
1267
+ /uninstall_lib()/update_lib()) are being executed on any environment.
1268
+
1269
+ PARAMETERS:
1270
+ env_type:
1271
+ Optional Argument.
1272
+ Specifies the type of the user environment to be removed.
1273
+ Permitted Values:
1274
+ * 'PY' - Remove only Python user environments.
1275
+ * 'R' - Remove only R user environments.
1276
+ * None - Remove all (Python and R) user environments.
1277
+ Default Value: None
1278
+ Types: str
1279
+
1280
+ kwargs:
1281
+ asynchronous:
1282
+ Optional Argument.
1283
+ Specifies whether to remove environment synchronously or
1284
+ asynchronously.
1285
+ Default Value: False
1286
+ Types: bool
1287
+
1288
+
1289
+ RETURNS:
1290
+ True when
1291
+ * Operation is synchronous.
1292
+ * Operation is asynchronous with "env_type".
1293
+ str otherwise.
1294
+
1295
+ RAISES:
1296
+ TeradataMlException, RuntimeError.
1297
+
1298
+ EXAMPLES:
1299
+ # Example 1: Remove all the Python and R user environments.
1300
+ >>> create_env('Lie_Detection_ML', 'python_3.8.13', 'Detect lie through machine learning.')
1301
+ >>> create_env('Customer_Trends', 'r_4.1.3', 'Analyse customer trends.')
1302
+ >>> list_user_envs()
1303
+ env_name env_description base_env_name language
1304
+ 0 Customer_Trends Analyse customer trends r_4.1.3 R
1305
+ 1 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
1306
+
1307
+ >>> remove_all_envs()
1308
+ All user environment(s) removed.
1309
+ True
1310
+
1311
+ >>> list_user_envs()
1312
+ No user environment(s) found.
1313
+
1314
+
1315
+ # Example 2: Remove all the Python user environments.
1316
+ >>> create_env('Lie_Detection_ML', 'python_3.8.13', 'Detect lie through machine learning.')
1317
+ >>> create_env('Customer_Trends', 'r_4.1.3', 'Analyse customer trends.')
1318
+ >>> list_user_envs()
1319
+ env_name env_description base_env_name language
1320
+ 0 Customer_Trends Analyse customer trends r_4.1.3 R
1321
+ 1 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
1322
+
1323
+ >>> remove_all_envs(env_type="PY")
1324
+ User environment 'Lie_Detection_ML' removed.
1325
+ All Python environment(s) removed.
1326
+ True
1327
+ >>> list_user_envs()
1328
+ env_name env_description base_env_name language
1329
+ 0 Customer_Trends Analyse customer trends r_4.1.3 R
1330
+
1331
+
1332
+ # Example 3: Remove all the R user environments.
1333
+ >>> create_env('Lie_Detection_ML', 'python_3.8.13', 'Detect lie through machine learning.')
1334
+ >>> create_env('Customer_Trends', 'r_4.1.3', 'Analyse customer trends.')
1335
+ >>> list_user_envs()
1336
+ env_name env_description base_env_name language
1337
+ 0 Customer_Trends Analyse customer trends r_4.1.3 R
1338
+ 1 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
1339
+
1340
+ >>> remove_all_envs(env_type="R")
1341
+ User environment 'Customer_Trends' removed.
1342
+ All R environment(s) removed.
1343
+ True
1344
+ >>> list_user_envs()
1345
+ env_name env_description base_env_name language
1346
+ 0 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
1347
+
1348
+
1349
+ # Example 4: Remove all Python and R environments synchronously.
1350
+ # Note: The example first removes all R environments synchronously,
1351
+ # followed by Python environments.
1352
+ >>> env1 = create_env("env1", "python_3.7.13", "Environment 1")
1353
+ >>> env2 = create_env("env2", "python_3.7.13", "Environment 2")
1354
+ >>> env3 = create_env("env3", "r_4.1", "Environment 3")
1355
+ >>> env4 = create_env("env4", "r_4.1", "Environment 4")
1356
+
1357
+ >>> list_user_envs()
1358
+ env_name env_description base_env_name language
1359
+ 0 env1 Environment 1 python_3.7.13 Python
1360
+ 1 env2 Environment 2 python_3.7.13 Python
1361
+ 2 env3 Environment 3 r_4.1 R
1362
+ 3 env4 Environment 4 r_4.1 R
1363
+
1364
+ # Remove all R environments.
1365
+ >>> remove_all_envs(env_type="R")
1366
+ User environment 'env3' removed.
1367
+ User environment 'env4' removed.
1368
+ All R environment(s) removed.
1369
+ True
1370
+ >>> list_user_envs()
1371
+ env_name env_description base_env_name language
1372
+ 0 env1 Environment 1 python_3.7.13 Python
1373
+ 1 env2 Environment 2 python_3.7.13 Python
1374
+
1375
+ # Try to remove R environments again.
1376
+ >>> remove_all_envs(env_type="R")
1377
+ No R user environment(s) found.
1378
+ True
1379
+
1380
+ # Remove all remaining Python environments.
1381
+ >>> remove_all_envs()
1382
+ All user environment(s) removed.
1383
+ True
1384
+
1385
+
1386
+ # Example 5: Remove all Python and R environments asynchronously.
1387
+ # Note: The example first removes all R environments asynchronously,
1388
+ # followed by Python environments.
1389
+ >>> env1 = create_env("env1", "python_3.7.13", "Environment 1")
1390
+ >>> env2 = create_env("env2", "python_3.7.13", "Environment 2")
1391
+ >>> env3 = create_env("env3", "r_4.1", "Environment 3")
1392
+ >>> env4 = create_env("env4", "r_4.1", "Environment 4")
1393
+
1394
+ >>> list_user_envs()
1395
+ env_name env_description base_env_name language
1396
+ 0 env1 Environment 1 python_3.7.13 Python
1397
+ 1 env2 Environment 2 python_3.7.13 Python
1398
+ 2 env3 Environment 3 r_4.1 R
1399
+ 3 env4 Environment 4 r_4.1 R
1400
+
1401
+ # Remove all R environments asynchronously.
1402
+ >>> remove_all_envs(env_type="R", asynchronous=True)
1403
+ Request to remove environment initiated successfully. Check the status using async_run_status(['5c23f956-c89a-4d69-9f1e-6491bac9973f', '6ec9ecc9-9223-4d3f-92a0-9d1abc652aca'])
1404
+ True
1405
+ >>> list_user_envs()
1406
+ env_name env_description base_env_name language
1407
+ 0 env1 Environment 1 python_3.7.13 Python
1408
+ 1 env2 Environment 2 python_3.7.13 Python
1409
+
1410
+ # Remove all remaining Python environments asynchronously.
1411
+ >>> remove_all_envs(asynchronous=True)
1412
+ Request to remove environment initiated successfully. Check the status using async_run_status('7d86eb99-9ab3-4e0d-b4dd-8b5f1757b9c7')
1413
+ '7d86eb99-9ab3-4e0d-b4dd-8b5f1757b9c7'
1414
+
1415
+
1416
+ # Example 6: Remove all environments asynchronously.
1417
+ >>> env1 = create_env("env1", "python_3.7.13", "Environment 1")
1418
+ >>> env2 = create_env("env2", "python_3.7.13", "Environment 2")
1419
+ >>> env3 = create_env("env3", "r_4.1", "Environment 3")
1420
+ >>> env4 = create_env("env4", "r_4.1", "Environment 4")
1421
+
1422
+ >>> list_user_envs()
1423
+ env_name env_description base_env_name language
1424
+ 0 env1 Environment 1 python_3.7.13 Python
1425
+ 1 env2 Environment 2 python_3.7.13 Python
1426
+ 2 env3 Environment 3 r_4.1 R
1427
+ 3 env4 Environment 4 r_4.1 R
1428
+
1429
+ # Remove all environments asynchronously.
1430
+ >>> remove_all_envs(asynchronous=True)
1431
+ Request to remove environment initiated successfully. Check the status using async_run_status('22f5d693-38d2-469e-b434-9f7246c7bbbb')
1432
+ '22f5d693-38d2-469e-b434-9f7246c7bbbb'
1433
+ """
1434
+ __arg_info_matrix = []
1435
+ __arg_info_matrix.append(["env_type", env_type, True, (str), True, ["PY", "R"]])
1436
+
1437
+ # Validate arguments
1438
+ _Validators._validate_function_arguments(__arg_info_matrix)
1439
+ if env_type is None:
1440
+ status = __manage_envs(api_name="remove_all_envs",
1441
+ **kwargs)
1442
+ return status
1443
+ else:
1444
+ return _remove_all_envs(env_type, **kwargs)
1445
+
1446
+
1447
+ def _remove_all_envs(env_type, **kwargs):
1448
+ """
1449
+ DESCRIPTION:
1450
+ Internal Function removes Python or R user environments.
1451
+
1452
+ PARAMETERS:
1453
+ env_type:
1454
+ Required Argument.
1455
+ Specifies the type of the user environment to be removed.
1456
+ Permitted Values:
1457
+ * 'PY' - Remove only Python user environments.
1458
+ * 'R' - Remove only R user environments.
1459
+ Types: str
1460
+
1461
+ kwargs:
1462
+ asynchronous:
1463
+ Optional Argument.
1464
+ Specifies whether to remove environment synchronously or
1465
+ asynchronously.
1466
+ Default Value: False
1467
+ Types: bool
1468
+
1469
+ is_print:
1470
+ Optional Argument.
1471
+ Specifies whether to print the message or not.
1472
+ Default Value: True
1473
+ Types: bool
1474
+
1475
+
1476
+ RETURNS:
1477
+ True, if the operation is successful.
1478
+
1479
+ RAISES:
1480
+ TeradataMlException, RuntimeError.
1481
+
1482
+ EXAMPLES:
1483
+ >>> _remove_all_envs(env_type="PY")
1484
+ User environment 'Fraud_detection' removed.
1485
+ User environment 'Sales' removed.
1486
+ User environment 'Purchase' removed.
1487
+ All Python environment(s) removed.
1488
+ >>> _remove_all_envs(env_type="R")
1489
+ User environment 'Fraud_detection' removed.
1490
+ User environment 'Carbon_Credits' removed.
1491
+ All R environment(s) removed.
1492
+ >>> remove_all_envs(env_type="R", asynchronous=True)
1493
+ Request to remove environment initiated successfully. Check status using async_run_status(['82cd24d6-1264-49f5-81e1-76e83e09c303'])
1494
+ """
1495
+ # Variable for the message on lines 1437 and 1444.
1496
+ env_type_message = "Python"
1497
+ if env_type.capitalize() == "Py":
1498
+ env_type = ["Python", "python"]
1499
+ else:
1500
+ env_type = ["R", "r"]
1501
+ env_type_message = "R"
1502
+ asynchronous = kwargs.get("asynchronous", False)
1503
+
1504
+ try:
1505
+ # Retrieve all user env data.
1506
+ user_envs_df = list_user_envs()
1507
+ user_envs_lang_df = user_envs_df[user_envs_df.language.isin(env_type)] if \
1508
+ user_envs_df is not None else pd.DataFrame(index=[])
1509
+
1510
+ claim_id_list = []
1511
+ if not user_envs_lang_df.empty:
1512
+ env_name = user_envs_lang_df["env_name"]
1513
+ # Executing remove_env in multiple threads (max_workers set to 10).
1514
+ with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
1515
+ # Execute remove_env for each env_name.
1516
+ future_remove_env = {
1517
+ executor.submit(remove_env, env,
1518
+ asynchronous=asynchronous, is_print=False):
1519
+ env for env in env_name}
1520
+ # Get the result of all executions.
1521
+ failed_envs = {}
1522
+ for future in concurrent.futures.as_completed(future_remove_env):
1523
+ env = future_remove_env[future]
1524
+ try:
1525
+ future_result = future.result()
1526
+ # Populate the claim ids of all the envs that
1527
+ # have been removed asynchronously.
1528
+ if asynchronous:
1529
+ claim_id_list.append(future_result)
1530
+
1531
+ except (TeradataMlException, RuntimeError, Exception) as emsg:
1532
+ # Catching exceptions by remove_env if occurred in any thread.
1533
+ failed_envs[env] = emsg
1534
+
1535
+ # Negative case - Failed to remove env.
1536
+ if len(failed_envs) > 0:
1537
+ emsg = ""
1538
+ for env, tdemsg in failed_envs.items():
1539
+ emsg += "\nUser environment '{0}' failed to remove. Reason: {1}" \
1540
+ .format(env, tdemsg.args[0])
1541
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
1542
+ error_msg = Messages.get_message(msg_code, "remove_all_envs()", emsg)
1543
+ raise TeradataMlException(error_msg, msg_code)
1544
+
1545
+ # Positive case - Envs removed without any failure print msg
1546
+ # as per sync or async removal.
1547
+ if not asynchronous:
1548
+ msg = "All {} environment(s) removed.".format(env_type_message)
1549
+ else:
1550
+ msg = "Request to remove environment initiated successfully. Check " \
1551
+ "the status using " \
1552
+ "async_run_status(['" + "', '".join(claim_id_list) + "'])"
1553
+ print(msg)
1554
+ elif user_envs_lang_df.empty and user_envs_df is not None:
1555
+ print("No {} user environment(s) found.".format(env_type_message))
1556
+ return True
1557
+ except (TeradataMlException, RuntimeError) as tdemsg:
1558
+ # TeradataMlException and RuntimeError are raised by list_user_envs.
1559
+ # list_user_envs should be replaced with remove_all_envs in the error
1560
+ # message for final users.
1561
+ tdemsg.args = (tdemsg.args[0].replace("list_user_envs", "remove_all_envs"),)
1562
+ raise tdemsg
1563
+ except Exception as emsg:
1564
+ msg_code = MessageCodes.FUNC_EXECUTION_FAILED
1565
+ error_msg = Messages.get_message(msg_code, "remove_all_envs", emsg)
1566
+ raise TeradataMlException(error_msg, msg_code)
1567
+
1568
+
1569
+ @collect_queryband(queryband="StUsrEnv")
1570
+ def set_user_env(env):
1571
+ """
1572
+ DESCRIPTION:
1573
+ Function allows to set the default user environment to be used for the Apply()
1574
+ and DataFrame.apply() function execution.
1575
+
1576
+ PARAMETERS:
1577
+ env:
1578
+ Required Argument.
1579
+ Specifies the remote user environment name to set as default for the session.
1580
+ Types: str OR Object of UserEnv
1581
+
1582
+ RETURNS:
1583
+ True, if the operation is successful.
1584
+
1585
+ RAISES:
1586
+ TeradataMlException, RuntimeError.
1587
+
1588
+ EXAMPLES:
1589
+ # Create remote user environment.
1590
+ >>> env = create_env('testenv', 'python_3.7.9', 'Test environment')
1591
+ User environment 'testenv' created.
1592
+
1593
+ # Example 1: Set the environment 'testenv' as default environment.
1594
+ >>> set_user_env('testenv')
1595
+ Default environment is set to 'testenv'.
1596
+ >>>
1597
+
1598
+ # Example 2: Create an environment with name 'demo_env' and set it as default environment.
1599
+ >>> set_user_env(get_env('test_env'))
1600
+ User environment 'testenv' created.
1601
+ Default environment is set to 'testenv'.
1602
+ >>>
1603
+ """
1604
+ __arg_info_matrix = []
1605
+ __arg_info_matrix.append(["env", env, False, (str, UserEnv), True])
1606
+
1607
+ # Validate arguments
1608
+ _Validators._validate_function_arguments(__arg_info_matrix)
1609
+
1610
+ # Get the environment name.
1611
+ env = get_env(env_name=env) if isinstance(env, str) else env
1612
+
1613
+ configure._default_user_env = env
1614
+ print("Default environment is set to '{}'.".format(env.env_name))
1615
+
1616
+ return True
1617
+
1618
+
1619
+ @collect_queryband(queryband="GtUsrEnv")
1620
+ def get_user_env():
1621
+ """
1622
+ DESCRIPTION:
1623
+ Function to get the default user environment set for the session.
1624
+
1625
+ PARAMETERS:
1626
+ None.
1627
+
1628
+ RETURNS:
1629
+ An object of UserEnv, if the operation is successful.
1630
+
1631
+ RAISES:
1632
+ TeradataMlException, RuntimeError.
1633
+
1634
+ EXAMPLES:
1635
+ # Create remote user environment.
1636
+ >>> env = create_env('testenv', 'python_3.7.9', 'Test environment')
1637
+ User environment 'testenv' created.
1638
+ >>> set_user_env('testenv')
1639
+ Default environment is set to 'testenv'.
1640
+ >>>
1641
+
1642
+ # Example 1: Get the default environment.
1643
+ >>> env = get_user_env()
1644
+ """
1645
+ if configure._default_user_env is None:
1646
+ print("Default environment is not set. Set default environment using set_user_env().")
1647
+ return
1648
+
1649
+ return configure._default_user_env
1650
+
1651
+
1652
+ def _validate_jwt_token(base_url, token_data):
1653
+ """
1654
+ DESCRIPTION:
1655
+ Function to validate the authentication token generated using PAT and PEM file.
1656
+
1657
+ PARAMETERS:
1658
+ base_url:
1659
+ Required Argument.
1660
+ Specifies the endpoint URL for a given environment on VantageCloud Lake.
1661
+ Types: str
1662
+
1663
+ token_data:
1664
+ Required Argument.
1665
+ Specifies the JWT token to be authenticated.
1666
+
1667
+ RETURNS:
1668
+ Boolan flag representing validation status.
1669
+ * True: Indicates that token is valid.
1670
+ * None: Indicates that token is not validated.
1671
+
1672
+ RAISES:
1673
+ TeradataMlException
1674
+
1675
+ EXAMPLES:
1676
+ Example 1: Validate JWT token.
1677
+ >>> _validate_jwt_token(base_url, token_data)
1678
+
1679
+ """
1680
+ # Extract environment id from base_url.
1681
+ try:
1682
+ url_parser = urlparse(base_url)
1683
+ env_id = url_parser.path.split("accounts/")[1].split("/")[0]
1684
+ if not env_id:
1685
+ raise
1686
+ except Exception:
1687
+ raise TeradataMlException(Messages.get_message(MessageCodes.FUNC_EXECUTION_FAILED,
1688
+ "set_auth_token",
1689
+ "Use valid value for 'base_url'"),
1690
+ MessageCodes.FUNC_EXECUTION_FAILED)
1691
+
1692
+ valid_token = None
1693
+ try:
1694
+ response = UtilFuncs._http_request(url="{}/{}/{}/{}".format(_get_ccp_url(base_url),
1695
+ "api", "accounts", env_id),
1696
+ method_type=HTTPRequest.GET,
1697
+ headers={"Authorization": "Bearer {}".format(token_data)})
1698
+ if 200 <= response.status_code < 300: # Authorized access.
1699
+ valid_token = True
1700
+ elif 400 <= response.status_code < 500: # Unauthorized access.
1701
+ valid_token = False
1702
+ except:
1703
+ pass
1704
+
1705
+ if valid_token is False:
1706
+ raise TeradataMlException(Messages.get_message(MessageCodes.FUNC_EXECUTION_FAILED,
1707
+ "set_auth_token",
1708
+ "Use valid values for input arguments ['base_url',"
1709
+ " 'pat_token', 'pem_file']."),
1710
+ MessageCodes.FUNC_EXECUTION_FAILED)
1711
+ return valid_token
1712
+
1713
+
1714
+ @collect_queryband(queryband="StAthTkn")
1715
+ def set_auth_token(base_url=None, client_id=None, pat_token=None, pem_file=None, **kwargs):
1716
+ """
1717
+ DESCRIPTION:
1718
+ Function to set the authentication token required to access services running on
1719
+ Teradata Vantage.
1720
+ Notes:
1721
+ * User must have a privilege to login with a NULL password to use set_auth_token().
1722
+ Refer to GRANT LOGON section in Teradata Documentation for more details.
1723
+ * When "auth_mech" is not specified, arguments are used in the following combination
1724
+ to derive authentication mechanism.
1725
+ * If "base_url" and "client_id" are specified then token generation is done through OAuth.
1726
+ * If "base_url", "pat_token", "pem_file" are specified then token generation is done using PAT.
1727
+ * If "base_url", "username" and "password" are specified then authentication is done via
1728
+ Basic authentication mechanism using user credentials.
1729
+ * If "base_url" and "auth_token" are specified then readily available token is used.
1730
+ * If only "base_url" is specified then token generation is done through OAuth.
1731
+ * Refresh token works only for OAuth authentication.
1732
+ * Use the argument "kid" only when key used during the pem file generation is different
1733
+ from pem file name. For example, if you use the key as 'key1' while generating pem file
1734
+ and the name of the pem file is `key1(1).pem`, then pass value 'key1' to the argument "kid".
1735
+
1736
+ PARAMETERS:
1737
+ base_url:
1738
+ Required Argument.
1739
+ Specifies the endpoint URL for a given environment on Teradata Vantage system.
1740
+ Types: str
1741
+
1742
+ client_id:
1743
+ Optional Argument.
1744
+ Specifies the id of the application that requests the access token from
1745
+ VantageCloud Lake.
1746
+ Types: str
1747
+
1748
+ pat_token:
1749
+ Required, if PAT authentication is to be used, optional otherwise.
1750
+ Specifies the PAT token generated from VantageCloud Lake Console.
1751
+ Types: str
1752
+
1753
+ pem_file:
1754
+ Required, if PAT authentication is to be used, optional otherwise.
1755
+ Specifies the path to private key file which is generated from VantageCloud Lake Console.
1756
+ Note:
1757
+ Teradata recommends not to change the name of the file generated from VantageCloud Lake
1758
+ Console. If the name of the file is changed, then authentication token generated from
1759
+ this function will not work.
1760
+ Types: str
1761
+
1762
+ **kwargs:
1763
+ username:
1764
+ Optional Argument.
1765
+ Specifies the user for which authentication is to be requested.
1766
+ If not specified, then user associated with current connection is used.
1767
+ Notes:
1768
+ * Use this option only if name of the database username has lowercase letters.
1769
+ * This option is used only for PAT and not for OAuth.
1770
+ Types: str
1771
+
1772
+ expiration_time:
1773
+ Optional Argument.
1774
+ Specifies the expiration time of the token in seconds. After expiry time, JWT
1775
+ token expires and UserEnv methods does not work, user should regenerate the token.
1776
+ Note:
1777
+ * This option is used only for PAT and not for OAuth.
1778
+ Default Value: 31536000
1779
+ Types: int
1780
+
1781
+ auth_token:
1782
+ Optional Argument.
1783
+ Specifies the authentication token required to access services running
1784
+ on Teradata Vantage.
1785
+ Notes:
1786
+ * If "auth_token" is set through this function, then this function
1787
+ should always be used only after create_context().
1788
+ * Use this option only if user has got JWT token and wants to set
1789
+ the same instead of generating it again from this function.
1790
+
1791
+ Types: str
1792
+
1793
+ kid:
1794
+ Optional Argument.
1795
+ Specifies the name of the key which is used while generating 'pem_file'.
1796
+ Types: str
1797
+
1798
+ password:
1799
+ Optional Argument.
1800
+ Specifies the password for database user to be used for Basic authentication.
1801
+ Types: str
1802
+
1803
+ auth_url:
1804
+ Optional Argument.
1805
+ Specifies the endpoint URL for a keycloak server.
1806
+ Types: str
1807
+
1808
+ rest_client:
1809
+ Optional Argument.
1810
+ Specifies the service for which keycloak token is to be generated.
1811
+ Permitted values: "VECTORSTORE"
1812
+ Default value: "VECTORSTORE"
1813
+ Types: str
1814
+
1815
+ auth_mech:
1816
+ Optional Argument.
1817
+ Specifies the mechanism to be used for generating authentication token.
1818
+ Note:
1819
+ * When "auth_mech" is provided, other arguments are used in the following
1820
+ combination as per value of "auth_mech":
1821
+ * OAuth: Token generation is done through OAuth by using client id
1822
+ which can be sepcified by user in "client_id" argument or
1823
+ can be derived internally from "base_url".
1824
+ * PAT: Token generation is done using "pat_token" and "pem_file".
1825
+ * BASIC: Authentication is done via Basic authentication mechanism
1826
+ using user credentials passed in "username" and "password"
1827
+ arguments.
1828
+ * JWT: Readily available token in "auth_token" argument is used.
1829
+ * KEYCLOAK: Token generation is done using keycloak.
1830
+ Permitted Values: "OAuth", "PAT", "BASIC", "JWT", "KEYCLOAK".
1831
+ Types: str
1832
+
1833
+ validate_jwt:
1834
+ Optional Argument.
1835
+ Specifies whether to validate generated JWT token or not.
1836
+ Note:
1837
+ * Applicable only when "auth_mech" is "PAT".
1838
+ Default value: True
1839
+ Types: boolean
1840
+
1841
+ valid_from:
1842
+ Optional Argument.
1843
+ Specifies epoch seconds representing time from which JWT token will be valid.
1844
+ Note:
1845
+ * Applicable only when "auth_mech" is "PAT".
1846
+ Default value: 0
1847
+ Types: int
1848
+
1849
+ RETURNS:
1850
+ True, if the operation is successful.
1851
+
1852
+ RAISES:
1853
+ TeradataMlException, RuntimeError.
1854
+
1855
+ EXAMPLES:
1856
+
1857
+ # Example 1: Set the Authentication token using default client_id.
1858
+ >>> import getpass
1859
+ >>> set_auth_token(base_url=getpass.getpass("ues_url : "))
1860
+ Authentication token is generated and set for the session.
1861
+ True
1862
+
1863
+ # Example 2: Set the Authentication token by specifying the client_id.
1864
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1865
+ ... client_id=getpass.getpass("client_id : "))
1866
+ Authentication token is generated and set for the session.
1867
+ True
1868
+
1869
+ # Example 3: Set the Authentication token by specifying the "pem_file" and "pat_token"
1870
+ # without specifying "username".
1871
+ >>> import getpass
1872
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1873
+ ... pat_token=getpass.getpass("pat_token : "),
1874
+ ... pem_file=getpass.getpass("pem_file : "))
1875
+ Authentication token is generated, authenticated and set for the session.
1876
+ True
1877
+
1878
+ # Example 4: Set the Authentication token by specifying the "pem_file" and "pat_token"
1879
+ # and "username".
1880
+ >>> import getpass
1881
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1882
+ ... pat_token=getpass.getpass("pat_token : "),
1883
+ ... pem_file=getpass.getpass("pem_file : "),
1884
+ ... username=getpass.getpass("username : "))
1885
+ Authentication token is generated, authenticated and set for the session.
1886
+ True
1887
+
1888
+ # Example 5: Set the Authentication token by specifying the "pem_file" and "pat_token"
1889
+ # and "kid".
1890
+ >>> import getpass
1891
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1892
+ ... pat_token=getpass.getpass("pat_token : "),
1893
+ ... pem_file=getpass.getpass("pem_file : ")
1894
+ ... kid="key1")
1895
+ Authentication token is generated, authenticated and set for the session.
1896
+ True
1897
+
1898
+ # Example 6: Set the authentication token via Basic Authentication mechanism by
1899
+ # specifying the "base_url", "username" and "password".
1900
+ >>> import getpass
1901
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1902
+ ... username=getpass.getpass("username : "),
1903
+ ... password=getpass.getpass("password : "))
1904
+ Authentication token is generated and set for the session.
1905
+ True
1906
+
1907
+ # Example 7: Set the authentication token for by specifying "base_url" and
1908
+ # "auth_mech" as "OAuth".
1909
+ >>> import getpass
1910
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1911
+ ... auth_mech="OAuth")
1912
+ Authentication token is generated and set for the session.
1913
+ True
1914
+
1915
+ # Example 8: Set the authentication token for by specifying "base_url", "auth_url"
1916
+ # "password" and "rest_client" and generating keycloak token internally.
1917
+ >>> import getpass
1918
+ >>> set_auth_token(base_url=getpass.getpass("base_url : "),
1919
+ ... auth_url=getpass.getpass("auth_url : "),
1920
+ ... password=getpass.getpass("password : "),
1921
+ ... rest_client=getpass.getpass("rest_client : "))
1922
+ Authentication token is generated and set for the session.
1923
+ True
1924
+
1925
+ """
1926
+
1927
+ # Deriving global connection using get_connection().
1928
+ if get_connection() is None:
1929
+ raise TeradataMlException(Messages.get_message(MessageCodes.INVALID_CONTEXT_CONNECTION),
1930
+ MessageCodes.INVALID_CONTEXT_CONNECTION)
1931
+
1932
+ # Remove keys from _InternalBuffer which are interrelated to base_url and authentication token.
1933
+ _InternalBuffer.remove_keys(['list_base_envs', 'default_base_env_python', 'default_base_env_r',
1934
+ 'vs_session_id', 'vs_header'])
1935
+
1936
+ # ---------------------------------ARGUMENT VALIDATION------------------------------------------------------
1937
+ # STEP 1: Validate arguments for allowed types.
1938
+ # ----------------------------------------------------------------------------------------------------------
1939
+ __arg_info_matrix = []
1940
+ __arg_info_matrix.append(["base_url", base_url, True, (str), True])
1941
+ __arg_info_matrix.append(["client_id", client_id, True, (str), True])
1942
+ __arg_info_matrix.append(["pat_token", pat_token, True, (str), True])
1943
+ __arg_info_matrix.append(["pem_file", pem_file, True, (str), True])
1944
+
1945
+ # Get keyword arguments.
1946
+ ues_url = kwargs.get("ues_url", None)
1947
+ __arg_info_matrix.append(["ues_url", ues_url, True, (str), True])
1948
+
1949
+ username = kwargs.get("username", _get_user())
1950
+ __arg_info_matrix.append(["username", username, True, (str), True])
1951
+
1952
+ password = kwargs.get("password", None)
1953
+ __arg_info_matrix.append(["password", password, True, (str), True])
1954
+
1955
+ auth_token = kwargs.get("auth_token")
1956
+ __arg_info_matrix.append(["auth_token", auth_token, True, (str), True])
1957
+
1958
+ expiration_time = kwargs.get("expiration_time", 31536000) # 31536000 seconds meaning 365 days.
1959
+ __arg_info_matrix.append(["expiration_time", expiration_time, True, (int), True])
1960
+
1961
+ kid = kwargs.get("kid")
1962
+ __arg_info_matrix.append(["kid", kid, True, (str), True])
1963
+
1964
+ auth_url = kwargs.get("auth_url", None)
1965
+ __arg_info_matrix.append(["auth_url", auth_url, True, (str), True])
1966
+
1967
+ rest_client = kwargs.get("rest_client", "VECTORSTORE")
1968
+ __arg_info_matrix.append(["rest_client", rest_client, True, (str), True, [svc.name for svc in TDServices]])
1969
+
1970
+ auth_mech = kwargs.get("auth_mech", None)
1971
+ __arg_info_matrix.append(["auth_mech", auth_mech, True, (str), True, [mech.name for mech in AuthMechs]])
1972
+
1973
+ validate_jwt = kwargs.get("validate_jwt", True)
1974
+ __arg_info_matrix.append(["validate_jwt", validate_jwt, True, (bool)])
1975
+
1976
+ valid_from = kwargs.get("valid_from", 0) # This sets iat to UTC beginning.
1977
+ __arg_info_matrix.append(["valid_from", valid_from, True, int])
1978
+
1979
+ # Validate arguments.
1980
+ _Validators._validate_function_arguments(__arg_info_matrix)
1981
+
1982
+ # ---------------------------------BASE_URL PROCESSING------------------------------------------------------
1983
+ # STEP 2: Process base_url/ues_url and set applicable config options.
1984
+ # ----------------------------------------------------------------------------------------------------------
1985
+
1986
+ # base_url should not end with 'open-analytics' or 'data-insights'
1987
+ if base_url:
1988
+ if base_url.endswith('open-analytics') or base_url.endswith('data-insights'):
1989
+ message = Messages.get_message(MessageCodes.ARG_NONE,
1990
+ "base_url", "ending with 'data-insights' or 'open-analytics", "")
1991
+ raise TeradataMlException(message, MessageCodes.ARG_NONE)
1992
+
1993
+ # Set the vector_store_base_url. This should only be done if base_url is set.
1994
+ # In case ues_url is set, vector_store_base_url should not be set.
1995
+ # Remove trailing forward slash from base_url if present.
1996
+ base_url = base_url[: -1] if base_url.endswith("/") else base_url
1997
+ configure._vector_store_base_url = f'{base_url}/data-insights'
1998
+
1999
+ if ues_url:
2000
+ # If incorrectly formatted UES service URL is passed, set it to None
2001
+ # and let further validation raise error.
2002
+ if not (ues_url.endswith('open-analytics') or ues_url.endswith('user-environment-service/api/v1/')):
2003
+ ues_url = None
2004
+
2005
+ # If ues_url is provided, then use it as base_url.
2006
+ base_url = ues_url if ues_url else base_url
2007
+
2008
+ if not (base_url or ues_url):
2009
+ raise TeradataMlException(Messages.get_message(MessageCodes.MISSING_ARGS, ["base_url"]),
2010
+ MessageCodes.MISSING_ARGS)
2011
+
2012
+ # Set the OpenAF url.
2013
+ # If ues_url is present, then use that otherwise generate it from base_url.
2014
+ configure.ues_url = ues_url if ues_url else f'{base_url}/open-analytics'
2015
+
2016
+ # Extract the base URL and org id.
2017
+ url_parser = urlparse(base_url)
2018
+ parsed_base_url = "{}://{}".format(url_parser.scheme, url_parser.netloc)
2019
+ org_id = url_parser.netloc.split('.')[0]
2020
+
2021
+ # ---------------------------------TOKEN GENERATION------------------------------------------------------
2022
+ # STEP 3: Based on auth_mech, generate authentication token data and store in _InternalBuffer.
2023
+ # Note: auth_mech can be user-provided or can be derived from valid combination of supporting parameters.
2024
+ # --------------------------------------------------------------------------------------------------------
2025
+ if auth_mech:
2026
+ auth_mech = auth_mech.lower()
2027
+ if auth_mech == 'oauth':
2028
+ pat_token = pem_file = password = auth_token = auth_url = None
2029
+ elif auth_mech == 'jwt':
2030
+ pat_token = pem_file = password = client_id = auth_url = None
2031
+ elif auth_mech == 'basic':
2032
+ pat_token = pem_file = auth_token = client_id = auth_url = None
2033
+ elif auth_mech == 'pat':
2034
+ password = client_id = auth_token = auth_url = None
2035
+ elif auth_mech == 'keycloak':
2036
+ pat_token = pem_file = auth_token = client_id = None
2037
+
2038
+ # Validate arguments for mutual exclusiveness.
2039
+ all_groups_none = \
2040
+ _Validators._validate_mutually_exclusive_argument_groups({"client_id": client_id},
2041
+ {"auth_token": auth_token},
2042
+ {"pat_token": pat_token,
2043
+ "pem_file": pem_file},
2044
+ {"password": password} if not auth_url else
2045
+ {"password": password, "auth_url": auth_url},
2046
+ return_all_falsy_status=True)
2047
+
2048
+ # Determine authentication mechanism from availability of supportive arguments.
2049
+ if auth_mech is None:
2050
+ if auth_token:
2051
+ auth_mech = 'jwt'
2052
+ elif any([pat_token, pem_file]):
2053
+ auth_mech = 'pat'
2054
+ elif auth_url:
2055
+ auth_mech = 'keycloak'
2056
+ elif password:
2057
+ # Authentication is done via Basic authentication mechanism
2058
+ # by passing 'basic' field in header.
2059
+ auth_mech = 'basic'
2060
+ # When all supporting arguments are None, default mechanism is OAuth.
2061
+ elif client_id or all_groups_none:
2062
+ auth_mech = 'oauth'
2063
+
2064
+ token_validated = False
2065
+ # Generate and use authentication data as per authentication mechanism.
2066
+ if auth_mech == 'jwt':
2067
+ if not auth_token:
2068
+ raise TeradataMlException(Messages.get_message(MessageCodes.MISSING_ARGS, ["auth_token"]),
2069
+ MessageCodes.MISSING_ARGS)
2070
+ # Validate JWT token if base_url points to CCP environment.
2071
+ # TODO: Uncomment when mechanism to validate JWT for AI-On-prem system is available.
2072
+ # if not ues_url:
2073
+ # token_validated = _validate_jwt_token(base_url, auth_token)
2074
+
2075
+ _InternalBuffer.add(auth_token=_AuthToken(token=auth_token,
2076
+ auth_type='bearer'))
2077
+ elif auth_mech == 'oauth':
2078
+ configure._oauth = True
2079
+ client_id = "{}-oaf-device".format(org_id) if client_id is None else client_id
2080
+ da_wf = _DAWorkflow(parsed_base_url, client_id)
2081
+ token_data = da_wf._get_token_data()
2082
+
2083
+ # Set Open AF parameters.
2084
+ configure._oauth_client_id = client_id
2085
+ configure._oauth_end_point = da_wf.device_auth_end_point
2086
+ configure._auth_token_expiry_time = time() + token_data["expires_in"] - 15
2087
+
2088
+ # Store the jwt token in internal class attribute.
2089
+ _InternalBuffer.add(auth_token=_AuthToken(token=token_data["access_token"],
2090
+ auth_type='bearer'))
2091
+ elif auth_mech == 'pat':
2092
+ if any([pat_token, pem_file]):
2093
+ _Validators._validate_mutually_inclusive_n_arguments(pat_token=pat_token,
2094
+ pem_file=pem_file)
2095
+ else:
2096
+ raise TeradataMlException(Messages.get_message(MessageCodes.MISSING_ARGS, ["pat_token", "pem_file"]),
2097
+ MessageCodes.MISSING_ARGS)
2098
+
2099
+ # Check if pem file exists.
2100
+ if pem_file is not None:
2101
+ _Validators._validate_file_exists(pem_file)
2102
+
2103
+ # Generate JWT token.
2104
+ auth_wf = _AuthWorkflow({"base_url": parsed_base_url,
2105
+ "org_id": org_id,
2106
+ "pat_token": pat_token,
2107
+ "pem_file": pem_file,
2108
+ "username": username,
2109
+ "expiration_time": expiration_time,
2110
+ "kid": kid,
2111
+ "valid_from": valid_from})
2112
+ token_data = auth_wf._proxy_jwt()
2113
+
2114
+ if validate_jwt:
2115
+ # Validate generated JWT token.
2116
+ token_validated = _validate_jwt_token(base_url, token_data)
2117
+
2118
+ # Store the jwt token in internal class attribute.
2119
+ _InternalBuffer.add(auth_token=_AuthToken(token=token_data,
2120
+ auth_type='bearer'))
2121
+ elif auth_mech == 'basic':
2122
+ if not password:
2123
+ raise TeradataMlException(Messages.get_message(MessageCodes.MISSING_ARGS, ["password"]),
2124
+ MessageCodes.MISSING_ARGS)
2125
+ credentials = f"{username}:{password}"
2126
+ # Encode the credentials string using Base64.
2127
+ encoded_credentials = base64.b64encode(credentials.encode('utf-8')).decode('utf-8')
2128
+ # Store the header data in internal class attribute.
2129
+ _InternalBuffer.add(auth_token=_AuthToken(token=encoded_credentials,
2130
+ auth_type='basic'))
2131
+ elif auth_mech == 'keycloak':
2132
+ _Validators._validate_missing_required_arguments([["password", password, False, (str), True],
2133
+ ["auth_url", auth_url, False, (str), True]
2134
+ ])
2135
+ token_generator = _KeycloakManager(auth_url=auth_url,
2136
+ client_id=TDServices[rest_client].value)
2137
+
2138
+ # Store manager object in _InternalBuffer in order to generate token after expiry time.
2139
+ _InternalBuffer.add(keycloak_manager=token_generator)
2140
+ try:
2141
+ token_data = token_generator.generate_token(username=username,
2142
+ password=password)
2143
+ except:
2144
+ raise TeradataMlException(Messages.get_message(MessageCodes.FUNC_EXECUTION_FAILED,
2145
+ "set_auth_token",
2146
+ "Failed to generate keycloak token."),
2147
+ MessageCodes.FUNC_EXECUTION_FAILED)
2148
+
2149
+ _InternalBuffer.add(auth_token=_AuthToken(token=token_data,
2150
+ auth_type='keycloak'))
2151
+
2152
+ if token_validated:
2153
+ print("Authentication token is generated, authenticated and set for the session.")
2154
+ else:
2155
+ print("Authentication token is generated and set for the session.")
2156
+
2157
+ return True