teradataml 20.0.0.0__py3-none-any.whl → 20.0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of teradataml might be problematic. Click here for more details.

Files changed (263) hide show
  1. teradataml/LICENSE-3RD-PARTY.pdf +0 -0
  2. teradataml/LICENSE.pdf +0 -0
  3. teradataml/README.md +183 -0
  4. teradataml/__init__.py +6 -3
  5. teradataml/_version.py +2 -2
  6. teradataml/analytics/__init__.py +3 -2
  7. teradataml/analytics/analytic_function_executor.py +275 -40
  8. teradataml/analytics/analytic_query_generator.py +92 -0
  9. teradataml/analytics/byom/__init__.py +3 -2
  10. teradataml/analytics/json_parser/metadata.py +1 -0
  11. teradataml/analytics/json_parser/utils.py +17 -21
  12. teradataml/analytics/meta_class.py +40 -1
  13. teradataml/analytics/sqle/DecisionTreePredict.py +1 -1
  14. teradataml/analytics/sqle/__init__.py +10 -2
  15. teradataml/analytics/table_operator/__init__.py +3 -2
  16. teradataml/analytics/uaf/__init__.py +21 -2
  17. teradataml/analytics/utils.py +62 -1
  18. teradataml/analytics/valib.py +1 -1
  19. teradataml/automl/__init__.py +1553 -319
  20. teradataml/automl/custom_json_utils.py +139 -61
  21. teradataml/automl/data_preparation.py +276 -319
  22. teradataml/automl/data_transformation.py +163 -81
  23. teradataml/automl/feature_engineering.py +402 -239
  24. teradataml/automl/feature_exploration.py +9 -2
  25. teradataml/automl/model_evaluation.py +48 -51
  26. teradataml/automl/model_training.py +291 -189
  27. teradataml/catalog/byom.py +8 -8
  28. teradataml/catalog/model_cataloging_utils.py +1 -1
  29. teradataml/clients/auth_client.py +133 -0
  30. teradataml/clients/pkce_client.py +1 -1
  31. teradataml/common/aed_utils.py +3 -2
  32. teradataml/common/constants.py +48 -6
  33. teradataml/common/deprecations.py +13 -7
  34. teradataml/common/garbagecollector.py +156 -120
  35. teradataml/common/messagecodes.py +6 -1
  36. teradataml/common/messages.py +3 -1
  37. teradataml/common/sqlbundle.py +1 -1
  38. teradataml/common/utils.py +103 -11
  39. teradataml/common/wrapper_utils.py +1 -1
  40. teradataml/context/context.py +121 -31
  41. teradataml/data/advertising.csv +201 -0
  42. teradataml/data/bank_marketing.csv +11163 -0
  43. teradataml/data/bike_sharing.csv +732 -0
  44. teradataml/data/boston2cols.csv +721 -0
  45. teradataml/data/breast_cancer.csv +570 -0
  46. teradataml/data/complaints_test_tokenized.csv +353 -0
  47. teradataml/data/complaints_tokens_model.csv +348 -0
  48. teradataml/data/covid_confirm_sd.csv +83 -0
  49. teradataml/data/customer_segmentation_test.csv +2628 -0
  50. teradataml/data/customer_segmentation_train.csv +8069 -0
  51. teradataml/data/dataframe_example.json +10 -0
  52. teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +3 -1
  53. teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +6 -0
  54. teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +5 -1
  55. teradataml/data/docs/sqle/docs_17_20/ANOVA.py +61 -1
  56. teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
  57. teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +2 -0
  58. teradataml/data/docs/sqle/docs_17_20/FTest.py +105 -26
  59. teradataml/data/docs/sqle/docs_17_20/GLM.py +162 -1
  60. teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +5 -3
  61. teradataml/data/docs/sqle/docs_17_20/KMeans.py +48 -1
  62. teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
  63. teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +3 -2
  64. teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +5 -0
  65. teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +6 -0
  66. teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +2 -0
  67. teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
  68. teradataml/data/docs/sqle/docs_17_20/ROC.py +3 -2
  69. teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +13 -2
  70. teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +119 -1
  71. teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +93 -1
  72. teradataml/data/docs/sqle/docs_17_20/Shap.py +197 -0
  73. teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +163 -1
  74. teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
  75. teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
  76. teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
  77. teradataml/data/docs/sqle/docs_17_20/XGBoost.py +12 -4
  78. teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +7 -1
  79. teradataml/data/docs/sqle/docs_17_20/ZTest.py +72 -7
  80. teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -10
  81. teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +1 -1
  82. teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +35 -5
  83. teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +3 -1
  84. teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
  85. teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
  86. teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +3 -2
  87. teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +1 -1
  88. teradataml/data/docs/uaf/docs_17_20/Convolve.py +13 -10
  89. teradataml/data/docs/uaf/docs_17_20/Convolve2.py +4 -1
  90. teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +5 -4
  91. teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +4 -4
  92. teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
  93. teradataml/data/docs/uaf/docs_17_20/DWT2D.py +214 -0
  94. teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +1 -1
  95. teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +1 -1
  96. teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
  97. teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +1 -1
  98. teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +9 -31
  99. teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +4 -2
  100. teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +1 -8
  101. teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
  102. teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
  103. teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
  104. teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
  105. teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +2 -2
  106. teradataml/data/docs/uaf/docs_17_20/MAMean.py +3 -3
  107. teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
  108. teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +15 -6
  109. teradataml/data/docs/uaf/docs_17_20/PACF.py +0 -1
  110. teradataml/data/docs/uaf/docs_17_20/Portman.py +2 -2
  111. teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
  112. teradataml/data/docs/uaf/docs_17_20/Resample.py +9 -1
  113. teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
  114. teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +17 -10
  115. teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
  116. teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +3 -1
  117. teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
  118. teradataml/data/dwt2d_dataTable.csv +65 -0
  119. teradataml/data/dwt_dataTable.csv +8 -0
  120. teradataml/data/dwt_filterTable.csv +3 -0
  121. teradataml/data/finance_data4.csv +13 -0
  122. teradataml/data/glm_example.json +28 -1
  123. teradataml/data/grocery_transaction.csv +19 -0
  124. teradataml/data/housing_train_segment.csv +201 -0
  125. teradataml/data/idwt2d_dataTable.csv +5 -0
  126. teradataml/data/idwt_dataTable.csv +8 -0
  127. teradataml/data/idwt_filterTable.csv +3 -0
  128. teradataml/data/insect2Cols.csv +61 -0
  129. teradataml/data/interval_data.csv +5 -0
  130. teradataml/data/jsons/paired_functions.json +14 -0
  131. teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +99 -27
  132. teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
  133. teradataml/data/jsons/sqle/17.20/TD_FTest.json +166 -83
  134. teradataml/data/jsons/sqle/17.20/TD_GLM.json +90 -14
  135. teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +48 -5
  136. teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +5 -3
  137. teradataml/data/jsons/sqle/17.20/TD_KMeans.json +31 -11
  138. teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
  139. teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
  140. teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +3 -2
  141. teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +9 -9
  142. teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
  143. teradataml/data/jsons/sqle/17.20/TD_ROC.json +2 -1
  144. teradataml/data/jsons/sqle/17.20/TD_SVM.json +16 -16
  145. teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +19 -1
  146. teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +168 -15
  147. teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +50 -1
  148. teradataml/data/jsons/sqle/17.20/TD_Shap.json +222 -0
  149. teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
  150. teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
  151. teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +25 -7
  152. teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +17 -4
  153. teradataml/data/jsons/sqle/17.20/TD_ZTest.json +157 -80
  154. teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
  155. teradataml/data/jsons/uaf/17.20/TD_ACF.json +1 -18
  156. teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +3 -16
  157. teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +0 -3
  158. teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +5 -3
  159. teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
  160. teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
  161. teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +0 -3
  162. teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +0 -2
  163. teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +2 -1
  164. teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +2 -5
  165. teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +3 -6
  166. teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +1 -3
  167. teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +0 -5
  168. teradataml/data/jsons/uaf/17.20/TD_DFFT.json +1 -4
  169. teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +2 -7
  170. teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +1 -2
  171. teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +0 -2
  172. teradataml/data/jsons/uaf/17.20/TD_DTW.json +3 -6
  173. teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
  174. teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
  175. teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +1 -1
  176. teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +16 -30
  177. teradataml/data/jsons/uaf/17.20/{TD_HOLT_WINTERS_FORECAST.json → TD_HOLT_WINTERS_FORECASTER.json} +1 -2
  178. teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +1 -15
  179. teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
  180. teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
  181. teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
  182. teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +1 -1
  183. teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +1 -1
  184. teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +1 -3
  185. teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
  186. teradataml/data/jsons/uaf/17.20/TD_PACF.json +2 -2
  187. teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +5 -5
  188. teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +48 -28
  189. teradataml/data/jsons/uaf/17.20/TD_SAX.json +208 -0
  190. teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +12 -6
  191. teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +0 -1
  192. teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +8 -8
  193. teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +1 -1
  194. teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +1 -1
  195. teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +400 -0
  196. teradataml/data/kmeans_example.json +5 -0
  197. teradataml/data/kmeans_table.csv +10 -0
  198. teradataml/data/load_example_data.py +8 -2
  199. teradataml/data/naivebayestextclassifier_example.json +1 -1
  200. teradataml/data/naivebayestextclassifierpredict_example.json +11 -0
  201. teradataml/data/onehot_encoder_train.csv +4 -0
  202. teradataml/data/openml_example.json +29 -0
  203. teradataml/data/peppers.png +0 -0
  204. teradataml/data/real_values.csv +14 -0
  205. teradataml/data/sax_example.json +8 -0
  206. teradataml/data/scale_attributes.csv +3 -0
  207. teradataml/data/scale_example.json +52 -1
  208. teradataml/data/scale_input_part_sparse.csv +31 -0
  209. teradataml/data/scale_input_partitioned.csv +16 -0
  210. teradataml/data/scale_input_sparse.csv +11 -0
  211. teradataml/data/scale_parameters.csv +3 -0
  212. teradataml/data/scripts/deploy_script.py +21 -2
  213. teradataml/data/scripts/sklearn/sklearn_fit.py +40 -37
  214. teradataml/data/scripts/sklearn/sklearn_fit_predict.py +22 -30
  215. teradataml/data/scripts/sklearn/sklearn_function.template +42 -24
  216. teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +23 -33
  217. teradataml/data/scripts/sklearn/sklearn_neighbors.py +19 -28
  218. teradataml/data/scripts/sklearn/sklearn_score.py +32 -32
  219. teradataml/data/scripts/sklearn/sklearn_transform.py +85 -42
  220. teradataml/data/star_pivot.csv +8 -0
  221. teradataml/data/templates/open_source_ml.json +2 -1
  222. teradataml/data/teradataml_example.json +97 -1
  223. teradataml/data/timestamp_data.csv +4 -0
  224. teradataml/data/titanic_dataset_unpivoted.csv +19 -0
  225. teradataml/data/uaf_example.json +55 -1
  226. teradataml/data/unpivot_example.json +15 -0
  227. teradataml/data/url_data.csv +9 -0
  228. teradataml/data/windowdfft.csv +16 -0
  229. teradataml/data/ztest_example.json +16 -0
  230. teradataml/dataframe/copy_to.py +9 -4
  231. teradataml/dataframe/data_transfer.py +125 -64
  232. teradataml/dataframe/dataframe.py +575 -57
  233. teradataml/dataframe/dataframe_utils.py +47 -9
  234. teradataml/dataframe/fastload.py +273 -90
  235. teradataml/dataframe/functions.py +339 -0
  236. teradataml/dataframe/row.py +160 -0
  237. teradataml/dataframe/setop.py +2 -2
  238. teradataml/dataframe/sql.py +740 -18
  239. teradataml/dataframe/window.py +1 -1
  240. teradataml/dbutils/dbutils.py +324 -18
  241. teradataml/geospatial/geodataframe.py +1 -1
  242. teradataml/geospatial/geodataframecolumn.py +1 -1
  243. teradataml/hyperparameter_tuner/optimizer.py +13 -13
  244. teradataml/lib/aed_0_1.dll +0 -0
  245. teradataml/opensource/sklearn/_sklearn_wrapper.py +254 -122
  246. teradataml/options/__init__.py +16 -5
  247. teradataml/options/configure.py +39 -6
  248. teradataml/options/display.py +2 -2
  249. teradataml/plot/axis.py +4 -4
  250. teradataml/scriptmgmt/UserEnv.py +26 -19
  251. teradataml/scriptmgmt/lls_utils.py +120 -16
  252. teradataml/table_operators/Script.py +4 -5
  253. teradataml/table_operators/TableOperator.py +160 -26
  254. teradataml/table_operators/table_operator_util.py +88 -41
  255. teradataml/table_operators/templates/dataframe_udf.template +63 -0
  256. teradataml/telemetry_utils/__init__.py +0 -0
  257. teradataml/telemetry_utils/queryband.py +52 -0
  258. teradataml/utils/validators.py +41 -3
  259. {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/METADATA +191 -6
  260. {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/RECORD +263 -185
  261. {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/WHEEL +0 -0
  262. {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/top_level.txt +0 -0
  263. {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/zip-safe +0 -0
@@ -26,7 +26,7 @@ from teradataml.options.display import display
26
26
  from teradataml.common.constants import ModelCatalogingConstants as mac
27
27
  from teradataml.options.configure import configure
28
28
  from teradataml.utils.utils import execute_sql
29
- from teradatasqlalchemy.telemetry.queryband import collect_queryband
29
+ from teradataml.telemetry_utils.queryband import collect_queryband
30
30
 
31
31
  validator = _Validators()
32
32
 
@@ -541,13 +541,12 @@ def save_byom(model_id,
541
541
  # If exists, extract required information about table columns types
542
542
  # else extract from additional_columns_types.
543
543
  # Also validate model_id against allowed length.
544
- table_exists = connection.dialect.has_table(connection, table_name=table_name, schema=schema_name)
544
+ table_exists = connection.dialect.has_table(connection, table_name=table_name,
545
+ schema=schema_name, table_only=True)
545
546
  if table_exists:
546
547
  # Check if model exists or not. If exists, raise error.
547
548
  __check_if_model_exists(
548
549
  model_id, table_name, schema_name, raise_error_if_model_found=True)
549
- if len(additional_columns_types) != 0:
550
- warnings.warn("Argument additional_columns_types is ignored since table already exists.", stacklevel=2)
551
550
 
552
551
  # Gather column name and type information from existing table
553
552
  existing_table_df = DataFrame(in_schema(schema_name, table_name))
@@ -807,7 +806,7 @@ def delete_byom(model_id, table_name=None, schema_name=None):
807
806
 
808
807
  # Before proceed further, check whether table exists or not.
809
808
  conn = get_connection()
810
- if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name):
809
+ if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name, table_only=True):
811
810
  error_code = MessageCodes.MODEL_CATALOGING_OPERATION_FAILED
812
811
  error_msg = Messages.get_message(
813
812
  error_code, "delete", 'Table "{}.{}" does not exist.'.format(schema_name, table_name))
@@ -1472,7 +1471,7 @@ def retrieve_byom(model_id,
1472
1471
 
1473
1472
  # Before proceeding further, check whether table exists or not.
1474
1473
  conn = get_connection()
1475
- if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name):
1474
+ if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name, table_only=True):
1476
1475
  error_code = MessageCodes.MODEL_CATALOGING_OPERATION_FAILED
1477
1476
  error_msg = Messages.get_message(
1478
1477
  error_code, "retrieve", 'Table "{}.{}" does not exist.'.format(schema_name, table_name))
@@ -1535,7 +1534,8 @@ def retrieve_byom(model_id,
1535
1534
  license_table = in_schema(license_schema_name, license_table_name)
1536
1535
 
1537
1536
  # Check whether license table exists or not before proceed further.
1538
- if not conn.dialect.has_table(conn, table_name=license_table_name, schema=license_schema_name):
1537
+ if not conn.dialect.has_table(conn, table_name=license_table_name, schema=license_schema_name,
1538
+ table_only=True):
1539
1539
  error_code = MessageCodes.EXECUTION_FAILED
1540
1540
  error_msg = Messages.get_message(
1541
1541
  error_code, "retrieve the model", 'Table "{}" does not exist.'.format(license_table))
@@ -1723,7 +1723,7 @@ def list_byom(table_name=None, schema_name=None, model_id=None):
1723
1723
 
1724
1724
  # Before proceeding further, check whether table exists or not.
1725
1725
  conn = get_connection()
1726
- if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name):
1726
+ if not conn.dialect.has_table(conn, table_name=table_name, schema=schema_name, table_only=True):
1727
1727
  error_code = MessageCodes.MODEL_CATALOGING_OPERATION_FAILED
1728
1728
  error_msg = Messages.get_message(
1729
1729
  error_code, "list", 'Table "{}.{}" does not exist.'.format(schema_name, table_name))
@@ -179,7 +179,7 @@ def __get_model_inputs_outputs(model, function_arg_map):
179
179
  tdp = preparer(td_dialect)
180
180
  nrows, ncols = member.shape
181
181
  db_schema = UtilFuncs._extract_db_name(member._table_name)
182
- # Add quotes around the DB name in case we are getting it using _get_current_databasename()
182
+ # Add quotes around the DB name in case we are getting it using _get_current_databasename().
183
183
  db_schema = tdp.quote(_get_current_databasename()) if db_schema is None else db_schema
184
184
  db_table_name = UtilFuncs._extract_table_name(member._table_name)
185
185
 
@@ -0,0 +1,133 @@
1
+ """
2
+ Unpublished work.
3
+ Copyright (c) 2024 by Teradata Corporation. All rights reserved.
4
+ TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
5
+ Primary Owner: gouri.patwardhan@teradata.com
6
+ Secondary Owner: Pradeep.Garre@teradata.com
7
+ This file implements workflow for generating JWT token.
8
+ """
9
+ import base64
10
+ import jwt
11
+ import time
12
+ from pathlib import Path
13
+ import pathlib
14
+ from teradataml import configure
15
+
16
+ class _AuthWorkflow:
17
+ """
18
+ Get the JWT token for requested user.
19
+ """
20
+ def __init__(self, state):
21
+ """
22
+ DESCRIPTION:
23
+ Constructor to initiate Authentication work flow.
24
+
25
+ PARAMETERS:
26
+ state:
27
+ Required Argument.
28
+ Specifies the dictionary containing following:
29
+ 1. "base_url" which is extracted from "ues_url".
30
+ 2. "org_id" which is also extracted from "ues_url".
31
+ 3. "pat_token" which is obtained from VantageCloud Lake Console, and it is specific to the user.
32
+ 4. "pem_file" which is obtained from VantageCloud Lake Console, and it is specific to the user.
33
+ 5. "username" which is the DB user.
34
+ 5. "expiration_time" which is the expiration time for the token and has a default value of
35
+ 31536000 seconds.
36
+ Types: dict
37
+
38
+ RETURNS:
39
+ Instance of _AuthWorkflow.
40
+
41
+ RAISES:
42
+ None
43
+
44
+ EXAMPLES :
45
+ >>> _AuthWorkflow(state)
46
+ """
47
+ self.state = state
48
+
49
+ def _get_epoch_time(self):
50
+ """
51
+ DESCRIPTION:
52
+ Generate expiry epoch time.
53
+
54
+ RETURNS:
55
+ float
56
+ """
57
+ current_epoch_time = int(time.time())
58
+ expiry_epoch_time = current_epoch_time + self.state.get('expiration_time')
59
+ return current_epoch_time, expiry_epoch_time
60
+
61
+ def _generate_header(self):
62
+ """
63
+ DESCRIPTION:
64
+ Generate JWT header.
65
+
66
+ RETURNS:
67
+ dict
68
+ """
69
+ # Extract the pem file name without extension.
70
+ kid = pathlib.Path(self.state.get('pem_file')).stem
71
+ header = {
72
+ "alg": "RS256",
73
+ "kid": kid,
74
+ "typ": "JWT"
75
+ }
76
+ return header
77
+
78
+ def _generate_payload(self):
79
+ """
80
+ DESCRIPTION:
81
+ Generate JWT payload.
82
+
83
+ RETURNS:
84
+ A dictionary with the JWT payload.
85
+ """
86
+ iat, exp= self._get_epoch_time()
87
+ payload = {
88
+ "aud": [
89
+ "td:service:authentication"
90
+ ],
91
+ "iat": iat,
92
+ "exp": exp,
93
+ "iss": "teradataml",
94
+ "multi-use": True,
95
+ "org_id": self.state['org_id'],
96
+ "pat": self.state['pat_token'],
97
+ "sub": self.state['username']
98
+ }
99
+ return payload
100
+
101
+ def _sign_jwt(self, payload, header):
102
+ """
103
+ DESCRIPTION:
104
+ Encode JWT using private key.
105
+
106
+ PARAMETERS:
107
+ payload:
108
+ Required Argument.
109
+ Specifies the payload required for encoding the JWT token.
110
+ Types: dict
111
+ header:
112
+ Required Argument.
113
+ Specified the header required for encoding the JWT token.
114
+ Types: dict
115
+
116
+ RETURNS:
117
+ str
118
+ """
119
+ with open(self.state['pem_file'], "r") as f:
120
+ private_key = f.read()
121
+ return jwt.encode(payload=payload, key=private_key, algorithm=header["alg"], headers=header)
122
+
123
+ def _proxy_jwt(self):
124
+ """
125
+ DESCRIPTION:
126
+ Generate JWT token and add the value in dictionary.
127
+
128
+ RETURNS:
129
+ str
130
+ """
131
+ jwt = self._sign_jwt(self._generate_payload(), self._generate_header())
132
+ self.state['jwt'] = jwt
133
+ return(jwt)
@@ -425,7 +425,7 @@ class _DAWorkflow:
425
425
  """
426
426
  device_cfg = requests.post(
427
427
  url=self.device_auth_end_point,
428
- data={'client_id': self.__client_id})
428
+ data={'client_id': self.__client_id, 'scope': 'openid'})
429
429
 
430
430
  # Check the status. If response is not 200, raise error.
431
431
  _Validators._validate_http_response(device_cfg, 200, "get the device metadata")
@@ -1287,8 +1287,9 @@ class AedUtils:
1287
1287
  arg_name = ["group by"]
1288
1288
  # If option is passed, add prefix of the option to the groupby_expr,
1289
1289
  # else, add prefix as empty string.
1290
- arg_value = ["{} | {}".format(option, groupby_expr)] if option\
1291
- else ["{}| {}".format("", groupby_expr)]
1290
+ if isinstance(groupby_expr, str):
1291
+ arg_value = ["{} | {}".format(option, groupby_expr)] if option \
1292
+ else ["{}| {}".format("", groupby_expr)]
1292
1293
  temp_table_name = UtilFuncs._generate_temp_table_name(prefix="groupby_", use_default_database=True, quote=False)
1293
1294
  output_table = [UtilFuncs._extract_table_name(temp_table_name)]
1294
1295
  output_schema = [UtilFuncs._extract_db_name(temp_table_name)]
@@ -65,6 +65,7 @@ class TeradataConstants(Enum):
65
65
  CONTAINER = 5
66
66
  TERADATA_TEXT_FILE = 6
67
67
  TERADATA_APPLY = 7
68
+ TERADATA_VOLATILE_TABLE = 8
68
69
  TABLE_COLUMN_LIMIT = 2048
69
70
  TERADATA_JOINS = ["inner", "left", "right", "full", "cross"]
70
71
  TERADATA_JOIN_OPERATORS = ['>=', '<=', '<>', '!=', '>', '<', '=']
@@ -424,6 +425,8 @@ class TableOperatorConstants(Enum):
424
425
  MAP_TEMPLATE = "dataframe_map.template"
425
426
  # Template of the intermediate script that will be generated.
426
427
  APPLY_TEMPLATE = "dataframe_apply.template"
428
+ # Template of the intermediate script that will be generated for UDF.
429
+ UDF_TEMPLATE = "dataframe_udf.template"
427
430
  # In-DB execution mode.
428
431
  INDB_EXEC = "IN-DB"
429
432
  # Local execution mode.
@@ -438,6 +441,8 @@ class TableOperatorConstants(Enum):
438
441
  MAP_PARTITION_OP = "map_partition"
439
442
  # apply operation.
440
443
  APPLY_OP = "apply"
444
+ # udf operation.
445
+ UDF_OP = "udf"
441
446
  # Template of the script_executor that will be used to generate the temporary script_executor file.
442
447
  SCRIPT_TEMPLATE = "script_executor.template"
443
448
  # Log Type.
@@ -463,18 +468,18 @@ class TableOperatorConstants(Enum):
463
468
  ON (select 1) PARTITION BY ANY
464
469
  SCRIPT_COMMAND('{}/bin/pip3 --version')
465
470
  returns('package VARCHAR(256)'))
466
- """.format(configure.indb_install_location)
471
+ """
467
472
 
468
473
  # Script Query to get Python packages and corresponding versions.
469
474
  # Location of In-DB packages is indicated by configure.indb_install_location.
470
475
  partial_version_query = "SELECT distinct * FROM SCRIPT( ON (select 1) " \
471
- "PARTITION BY ANY SCRIPT_COMMAND('{}/bin/pip3 freeze | "\
472
- .format(configure.indb_install_location)
473
- PACKAGE_VERSION_QUERY = partial_version_query + "{0}awk -F ''=='' " \
476
+ "PARTITION BY ANY SCRIPT_COMMAND('{0}/bin/pip3 freeze | "
477
+
478
+ PACKAGE_VERSION_QUERY = partial_version_query + "{1}awk -F ''=='' " \
474
479
  "''{{print $1, $2}}''') " \
475
480
  "delimiter(' ') " \
476
- "returns('package VARCHAR({1}), " \
477
- "version VARCHAR({1})'))"
481
+ "returns('package VARCHAR({2}), " \
482
+ "version VARCHAR({2})'))"
478
483
 
479
484
  class ValibConstants(Enum):
480
485
  # A dictionary that maps teradataml name of the exposed VALIB function name
@@ -1368,6 +1373,7 @@ class TeradataAnalyticFunctionTypes(Enum):
1368
1373
  UAF = "UAF"
1369
1374
  TABLEOPERATOR = "TABLE_OPERATOR"
1370
1375
  BYOM = "BYOM"
1376
+ STORED_PROCEDURE = "STORED_PROCEDURE"
1371
1377
 
1372
1378
 
1373
1379
  class TeradataAnalyticFunctionInfo(Enum):
@@ -1378,6 +1384,8 @@ class TeradataAnalyticFunctionInfo(Enum):
1378
1384
  TABLE_OPERATOR = {"func_type": "tableoperator", "lowest_version": "17.00 ",
1379
1385
  "display_function_type_name" :"TABLE OPERATOR"}
1380
1386
  BYOM = {"func_type": "byom", "lowest_version": None, "display_function_type_name": "BYOM"}
1387
+ STORED_PROCEDURE = {"func_type": "storedprocedure", "lowest_version": "17.20", "display_function_type_name": "UAF",
1388
+ "metadata_class" : "_AnlyFuncMetadataUAF"}
1381
1389
 
1382
1390
  class TeradataUAFSpecificArgs(Enum):
1383
1391
  INPUT_MODE = "input_mode"
@@ -1404,6 +1412,10 @@ class DriverEscapeFunctions(Enum):
1404
1412
  WRITE_TO_CSV = "{{fn teradata_write_csv({0})}}"
1405
1413
  FIELD_QUOTE = "{{fn teradata_field_quote({0})}}"
1406
1414
  FIELD_SEP = "{{fn teradata_field_sep({0})}}"
1415
+ ERR_TBL_1 = "{{fn teradata_error_table_1_suffix({0})}}"
1416
+ ERR_TBL_2 = "{{fn teradata_error_table_2_suffix({0})}}"
1417
+ ERR_STAGING_DB = "{{fn teradata_error_table_database({0})}}"
1418
+ ERR_TBL_MNG_FLAG = "{{fn teradata_manage_error_tables_{0}}}"
1407
1419
 
1408
1420
 
1409
1421
  class HTTPRequest(Enum):
@@ -1431,3 +1443,33 @@ class CloudProvider(Enum):
1431
1443
  # and '2018-03-28', using the latest one.
1432
1444
  X_MS_VERSION = "2019-12-12"
1433
1445
  X_MS_BLOB_TYPE = "BlockBlob"
1446
+
1447
+ class SessionParamsSQL:
1448
+ # Holds the SQL Statements for Session params.
1449
+ TIMEZONE = "SET TIME ZONE {}"
1450
+ ACCOUNT = "SET SESSION ACCOUNT = '{}' FOR {}"
1451
+ CALENDAR = "SET SESSION CALENDAR = {}"
1452
+ CHARACTER_SET_UNICODE = "SET SESSION CHARACTER SET UNICODE PASS THROUGH {}"
1453
+ COLLATION = "SET SESSION COLLATION {}"
1454
+ CONSTRAINT = "SET SESSION CONSTRAINT = {}"
1455
+ DATABASE = "SET SESSION DATABASE {}"
1456
+ DATEFORM = "SET SESSION DATEFORM = {}"
1457
+ DEBUG_FUNCTION = "SET SESSION DEBUG FUNCTION {} {}"
1458
+ DOT_NOTATION = "SET SESSION DOT NOTATION {} ON ERROR"
1459
+ ISOLATED_LOADING = "SET SESSION FOR {} ISOLATED LOADING"
1460
+ FUNCTION_TRACE = "SET SESSION FUNCTION TRACE USING {} FOR TABLE {}"
1461
+ JSON_IGNORE_ERRORS = "SET SESSION JSON IGNORE ERRORS {}"
1462
+ SEARCHUIFDBPATH = "SET SESSION SEARCHUIFDBPATH = {}"
1463
+ TRANSACTION_ISOLATION_LEVEL = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL {}"
1464
+ QUERY_BAND = "SET QUERY_BAND = {} FOR {}"
1465
+ UDFSEARCHPATH = "SET SESSION UDFSEARCHPATH = {} FOR FUNCTION = {}"
1466
+
1467
+ class SessionParamsPythonNames:
1468
+ # Holds the SQL Statements for Session params.
1469
+ TIMEZONE = "Session Time Zone"
1470
+ ACCOUNT = "Account Name"
1471
+ CALENDAR = "Calendar"
1472
+ COLLATION = "Collation"
1473
+ DATABASE = "Current DataBase"
1474
+ DATEFORM = 'Current DateForm'
1475
+
@@ -87,13 +87,19 @@ def argument_deprecation(tdml_version, deprecated_arguments, behaviour=False, al
87
87
 
88
88
  def decorator(func):
89
89
  def wrapper(*args, **kwargs):
90
- msg = "\nThe argument(s) \"{}\" will be deprecated in {}."
91
- if behaviour:
92
- msg = "\nBehaviour of the argument(s) \"{}\" will change in {}."
93
- msg = msg.format(deprecated_arguments, tdml_version)
94
- if alternatives is not None:
95
- msg += "\nUse argument(s) \"{}\" instead.".format(alternatives)
96
- warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
90
+ # Check if deprecated arguments is a list, if not convert it to a list
91
+ deprecated_args_list = deprecated_arguments if isinstance(deprecated_arguments, list) \
92
+ else [deprecated_arguments]
93
+ # Check list of deprecated arguments are used in the function call
94
+ deprecated_arguments_used = [arg for arg in deprecated_args_list if arg in kwargs]
95
+ if deprecated_arguments_used:
96
+ msg = "\nThe argument(s) \"{}\" will be deprecated in {}."
97
+ if behaviour:
98
+ msg = "\nBehaviour of the argument(s) \"{}\" will change in {}."
99
+ msg = msg.format(deprecated_arguments_used, tdml_version)
100
+ if alternatives is not None:
101
+ msg += "\nUse argument(s) \"{}\" instead.".format(alternatives)
102
+ warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
97
103
  return func(*args, **kwargs)
98
104
 
99
105
  return wraps(func)(wrapper)