teradataml 20.0.0.3__py3-none-any.whl → 20.0.0.5__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 (151) hide show
  1. teradataml/LICENSE-3RD-PARTY.pdf +0 -0
  2. teradataml/README.md +193 -1
  3. teradataml/__init__.py +2 -1
  4. teradataml/_version.py +2 -2
  5. teradataml/analytics/analytic_function_executor.py +25 -18
  6. teradataml/analytics/byom/__init__.py +1 -1
  7. teradataml/analytics/json_parser/analytic_functions_argument.py +4 -0
  8. teradataml/analytics/sqle/__init__.py +20 -2
  9. teradataml/analytics/utils.py +15 -1
  10. teradataml/analytics/valib.py +18 -4
  11. teradataml/automl/__init__.py +341 -112
  12. teradataml/automl/autodataprep/__init__.py +471 -0
  13. teradataml/automl/data_preparation.py +84 -42
  14. teradataml/automl/data_transformation.py +69 -33
  15. teradataml/automl/feature_engineering.py +76 -9
  16. teradataml/automl/feature_exploration.py +639 -25
  17. teradataml/automl/model_training.py +35 -14
  18. teradataml/clients/auth_client.py +2 -2
  19. teradataml/common/__init__.py +1 -2
  20. teradataml/common/constants.py +122 -63
  21. teradataml/common/messagecodes.py +14 -3
  22. teradataml/common/messages.py +8 -4
  23. teradataml/common/sqlbundle.py +40 -10
  24. teradataml/common/utils.py +366 -74
  25. teradataml/common/warnings.py +11 -0
  26. teradataml/context/context.py +348 -86
  27. teradataml/data/amazon_reviews_25.csv +26 -0
  28. teradataml/data/apriori_example.json +22 -0
  29. teradataml/data/byom_example.json +11 -0
  30. teradataml/data/docs/byom/docs/DataRobotPredict.py +2 -2
  31. teradataml/data/docs/byom/docs/DataikuPredict.py +40 -1
  32. teradataml/data/docs/byom/docs/H2OPredict.py +2 -2
  33. teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
  34. teradataml/data/docs/byom/docs/ONNXPredict.py +2 -2
  35. teradataml/data/docs/byom/docs/PMMLPredict.py +2 -2
  36. teradataml/data/docs/sqle/docs_17_20/Apriori.py +138 -0
  37. teradataml/data/docs/sqle/docs_17_20/NERExtractor.py +121 -0
  38. teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +3 -3
  39. teradataml/data/docs/sqle/docs_17_20/SMOTE.py +212 -0
  40. teradataml/data/docs/sqle/docs_17_20/Shap.py +28 -6
  41. teradataml/data/docs/sqle/docs_17_20/TextMorph.py +119 -0
  42. teradataml/data/docs/sqle/docs_17_20/TextParser.py +54 -3
  43. teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -1
  44. teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +2 -2
  45. teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +2 -2
  46. teradataml/data/docs/uaf/docs_17_20/DFFT.py +1 -1
  47. teradataml/data/docs/uaf/docs_17_20/DFFT2.py +1 -1
  48. teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +1 -1
  49. teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +1 -1
  50. teradataml/data/docs/uaf/docs_17_20/DWT2D.py +4 -1
  51. teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +4 -4
  52. teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +2 -2
  53. teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +2 -2
  54. teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +6 -6
  55. teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
  56. teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +1 -1
  57. teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +4 -4
  58. teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +1 -1
  59. teradataml/data/docs/uaf/docs_17_20/PACF.py +1 -1
  60. teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
  61. teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +3 -3
  62. teradataml/data/docs/uaf/docs_17_20/Resample.py +5 -5
  63. teradataml/data/docs/uaf/docs_17_20/SAX.py +3 -3
  64. teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
  65. teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +1 -1
  66. teradataml/data/docs/uaf/docs_17_20/Smoothma.py +3 -3
  67. teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +1 -1
  68. teradataml/data/hnsw_alter_data.csv +5 -0
  69. teradataml/data/hnsw_data.csv +10 -0
  70. teradataml/data/jsons/byom/h2opredict.json +1 -1
  71. teradataml/data/jsons/byom/onnxembeddings.json +266 -0
  72. teradataml/data/jsons/sqle/17.20/NGramSplitter.json +6 -6
  73. teradataml/data/jsons/sqle/17.20/TD_Apriori.json +181 -0
  74. teradataml/data/jsons/sqle/17.20/TD_NERExtractor.json +145 -0
  75. teradataml/data/jsons/sqle/17.20/TD_SMOTE.json +267 -0
  76. teradataml/data/jsons/sqle/17.20/TD_Shap.json +0 -1
  77. teradataml/data/jsons/sqle/17.20/TD_TextMorph.json +134 -0
  78. teradataml/data/jsons/sqle/17.20/TD_TextParser.json +114 -9
  79. teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +328 -0
  80. teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +420 -0
  81. teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +343 -0
  82. teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +328 -0
  83. teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +328 -0
  84. teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +328 -0
  85. teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +328 -0
  86. teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +359 -0
  87. teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +360 -0
  88. teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +343 -0
  89. teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +343 -0
  90. teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
  91. teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
  92. teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
  93. teradataml/data/jsons/sqle/20.00/TD_KMeans.json +2 -2
  94. teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +3 -3
  95. teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +6 -6
  96. teradataml/data/ner_dict.csv +8 -0
  97. teradataml/data/ner_input_eng.csv +7 -0
  98. teradataml/data/ner_rule.csv +5 -0
  99. teradataml/data/pos_input.csv +40 -0
  100. teradataml/data/tdnerextractor_example.json +14 -0
  101. teradataml/data/teradataml_example.json +21 -0
  102. teradataml/data/textmorph_example.json +5 -0
  103. teradataml/data/to_num_data.csv +4 -0
  104. teradataml/data/tochar_data.csv +5 -0
  105. teradataml/data/trans_dense.csv +16 -0
  106. teradataml/data/trans_sparse.csv +55 -0
  107. teradataml/data/vectordistance_example.json +1 -1
  108. teradataml/dataframe/copy_to.py +45 -29
  109. teradataml/dataframe/data_transfer.py +72 -46
  110. teradataml/dataframe/dataframe.py +642 -166
  111. teradataml/dataframe/dataframe_utils.py +167 -22
  112. teradataml/dataframe/functions.py +135 -20
  113. teradataml/dataframe/setop.py +11 -6
  114. teradataml/dataframe/sql.py +330 -78
  115. teradataml/dbutils/dbutils.py +556 -140
  116. teradataml/dbutils/filemgr.py +14 -10
  117. teradataml/hyperparameter_tuner/optimizer.py +12 -1
  118. teradataml/lib/aed_0_1.dll +0 -0
  119. teradataml/opensource/{sklearn/_sklearn_wrapper.py → _base.py} +168 -1013
  120. teradataml/opensource/_class.py +141 -17
  121. teradataml/opensource/{constants.py → _constants.py} +7 -3
  122. teradataml/opensource/_lightgbm.py +52 -53
  123. teradataml/opensource/_sklearn.py +1008 -0
  124. teradataml/opensource/_wrapper_utils.py +5 -5
  125. teradataml/options/__init__.py +47 -15
  126. teradataml/options/configure.py +103 -26
  127. teradataml/options/display.py +13 -2
  128. teradataml/plot/axis.py +47 -8
  129. teradataml/plot/figure.py +33 -0
  130. teradataml/plot/plot.py +63 -13
  131. teradataml/scriptmgmt/UserEnv.py +307 -40
  132. teradataml/scriptmgmt/lls_utils.py +428 -145
  133. teradataml/store/__init__.py +2 -3
  134. teradataml/store/feature_store/feature_store.py +102 -7
  135. teradataml/table_operators/Apply.py +48 -19
  136. teradataml/table_operators/Script.py +23 -2
  137. teradataml/table_operators/TableOperator.py +3 -1
  138. teradataml/table_operators/table_operator_util.py +58 -9
  139. teradataml/utils/dtypes.py +49 -1
  140. teradataml/utils/internal_buffer.py +38 -0
  141. teradataml/utils/validators.py +377 -62
  142. {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/METADATA +200 -4
  143. {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/RECORD +146 -112
  144. teradataml/data/SQL_Fundamentals.pdf +0 -0
  145. teradataml/libaed_0_1.dylib +0 -0
  146. teradataml/libaed_0_1.so +0 -0
  147. teradataml/opensource/sklearn/__init__.py +0 -0
  148. teradataml/store/vector_store/__init__.py +0 -1586
  149. {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/WHEEL +0 -0
  150. {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/top_level.txt +0 -0
  151. {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/zip-safe +0 -0
@@ -26,10 +26,10 @@ from teradataml.context import context as tdmlctx
26
26
  from teradataml.dataframe.copy_to import copy_to_sql
27
27
  from teradataml.dataframe.dataframe import DataFrame
28
28
  from teradataml import execute_sql, get_connection
29
- from teradataml import SVM, GLM, DecisionForest, XGBoost, GridSearch, KNN, RandomSearch
29
+ from teradataml import configure, SVM, GLM, DecisionForest, XGBoost, GridSearch, KNN, RandomSearch
30
30
  from teradataml.utils.validators import _Validators
31
31
  from teradataml.common.utils import UtilFuncs
32
-
32
+ from teradataml.common.constants import TeradataConstants
33
33
 
34
34
  class _ModelTraining:
35
35
 
@@ -114,6 +114,12 @@ class _ModelTraining:
114
114
  session.
115
115
  Default Value: False
116
116
  Types: bool
117
+
118
+ seed:
119
+ Optional Argument.
120
+ Specifies the random seed for reproducibility.
121
+ Default Value: 42
122
+ Types: int
117
123
  """
118
124
  self.data = data
119
125
  self.target_column = target_column
@@ -126,6 +132,7 @@ class _ModelTraining:
126
132
  self.startify_col = None
127
133
  self.persist = kwargs.get("persist", False)
128
134
  self.volatile = kwargs.get("volatile", False)
135
+ self.seed = kwargs.get("seed", 42)
129
136
 
130
137
  def model_training(self,
131
138
  auto=True,
@@ -499,7 +506,7 @@ class _ModelTraining:
499
506
  'max_depth': tuple(max_depth),
500
507
  'min_node_size': tuple(min_node_size),
501
508
  'iter_num': tuple(iter_num),
502
- 'seed':42
509
+ 'seed':self.seed
503
510
  }
504
511
  # Hyperparameters for Decision Forest model
505
512
  df_params = {
@@ -510,7 +517,7 @@ class _ModelTraining:
510
517
  'max_depth': tuple(max_depth),
511
518
  'min_node_size': tuple(min_node_size),
512
519
  'num_trees': tuple(num_trees),
513
- 'seed':42
520
+ 'seed':self.seed
514
521
  }
515
522
 
516
523
  # Updating model type in case of classification
@@ -768,7 +775,7 @@ class _ModelTraining:
768
775
 
769
776
  # Defining training data
770
777
  data_types = ['lasso', 'rfe', 'pca']
771
- trainng_datas = tuple(DataFrame(self.table_name_mapping[f'{data_type}_train']) for data_type in data_types)
778
+ trainng_datas = tuple(DataFrame(self.data_mapping[f'{data_type}_train']) for data_type in data_types)
772
779
 
773
780
  if self.task_type == "Classification":
774
781
  response_values = trainng_datas[0].get(self.target_column).drop_duplicate().get_values().flatten().tolist()
@@ -874,16 +881,30 @@ class _ModelTraining:
874
881
  verbose = 0
875
882
 
876
883
  # Hyperparameter tunning
884
+ # Parallel run opens multiple connections for parallel execution,
885
+ # but volatile tables are not accessible across different sessions.
886
+ # Therefore, execution is performed sequentially by setting run_parallel=False.
887
+
888
+ run_parallel = configure.temp_object_type != TeradataConstants.TERADATA_VOLATILE_TABLE
889
+
890
+ common_params = {
891
+ "data": train_data,
892
+ "evaluation_metric": self.stopping_metric,
893
+ "early_stop": self.stopping_tolerance,
894
+ "run_parallel": run_parallel,
895
+ "sample_seed": self.seed,
896
+ "sample_id_column": "id",
897
+ "discard_invalid_column_params": True,
898
+ "stratify_column": self.startify_col,
899
+ "verbose": verbose,
900
+ "max_time": self.max_runtime_secs,
901
+ "suppress_refer_msg": True
902
+ }
903
+
877
904
  if model_param['name'] == 'knn':
878
- _obj.fit(data=train_data, evaluation_metric=self.stopping_metric,
879
- early_stop=self.stopping_tolerance, run_parallel=True,
880
- sample_seed=42, sample_id_column='id', discard_invalid_column_params=True,
881
- stratify_column=self.startify_col,verbose=verbose, max_time=self.max_runtime_secs)
905
+ _obj.fit(**common_params)
882
906
  else:
883
- _obj.fit(data=train_data, evaluation_metric=self.stopping_metric,
884
- early_stop=self.stopping_tolerance, **eval_params,
885
- run_parallel=True, discard_invalid_column_params=True, sample_seed=42,
886
- sample_id_column='id',stratify_column=self.startify_col, verbose=verbose, max_time=self.max_runtime_secs)
907
+ _obj.fit(**common_params, **eval_params)
887
908
 
888
909
  # Getting all passed models
889
910
  model_info = _obj.model_stats.merge(_obj.models[_obj.models['STATUS']=='PASS'][['MODEL_ID', 'DATA_ID', 'PARAMETERS']],
@@ -992,4 +1013,4 @@ class _ModelTraining:
992
1013
  elif ml_name == 'glm':
993
1014
  eval_params['family'] = 'GAUSSIAN'
994
1015
 
995
- return eval_params
1016
+ return eval_params
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Unpublished work.
3
- Copyright (c) 2024 by Teradata Corporation. All rights reserved.
3
+ Copyright (c) 2025 by Teradata Corporation. All rights reserved.
4
4
  TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
5
5
  Primary Owner: gouri.patwardhan@teradata.com
6
6
  Secondary Owner: Pradeep.Garre@teradata.com
@@ -67,7 +67,7 @@ class _AuthWorkflow:
67
67
  dict
68
68
  """
69
69
  # Extract the pem file name without extension.
70
- kid = pathlib.Path(self.state.get('pem_file')).stem
70
+ kid = pathlib.Path(self.state.get('pem_file')).stem if not self.state.get('kid') else self.state['kid']
71
71
  header = {
72
72
  "alg": "RS256",
73
73
  "kid": kid,
@@ -1,2 +1 @@
1
- from teradataml.common.formula import as_categorical
2
- from teradataml.common.constants import Action, Permission
1
+ from teradataml.common.formula import as_categorical
@@ -14,14 +14,13 @@ A class for holding all constants
14
14
  import re
15
15
  import sqlalchemy
16
16
  from enum import Enum
17
- from teradataml.options.configure import configure
18
17
  from teradatasqlalchemy.types import (INTEGER, SMALLINT, BIGINT, BYTEINT, DECIMAL, FLOAT, NUMBER, VARCHAR)
19
18
  from teradatasqlalchemy.types import (DATE, TIME, TIMESTAMP)
20
19
  from teradatasqlalchemy.types import (BYTE, VARBYTE, BLOB)
21
20
  from teradatasqlalchemy import (CHAR, CLOB)
22
21
  from teradatasqlalchemy import (PERIOD_DATE, PERIOD_TIME, PERIOD_TIMESTAMP)
23
22
  from teradatasqlalchemy import (INTERVAL_YEAR, INTERVAL_YEAR_TO_MONTH, INTERVAL_MONTH,
24
- INTERVAL_DAY,INTERVAL_DAY_TO_HOUR, INTERVAL_DAY_TO_MINUTE,
23
+ INTERVAL_DAY, INTERVAL_DAY_TO_HOUR, INTERVAL_DAY_TO_MINUTE,
25
24
  INTERVAL_DAY_TO_SECOND, INTERVAL_HOUR,
26
25
  INTERVAL_HOUR_TO_MINUTE, INTERVAL_HOUR_TO_SECOND,
27
26
  INTERVAL_MINUTE, INTERVAL_MINUTE_TO_SECOND,
@@ -62,6 +61,8 @@ class SQLConstants(Enum):
62
61
  SQL_DELETE_SPECIFIC_ROW = 30
63
62
  SQL_EXEC_STORED_PROCEDURE = 31
64
63
  SQL_SELECT_COLUMNNAMES_WITH_WHERE = 32
64
+ SQL_HELP_DATABASE = 33
65
+ SQL_HELP_DATALAKE = 34
65
66
  CONSTRAINT = ["check_constraint", "primary_key_constraint",
66
67
  "foreign_key_constraint", "unique_key_constraint"]
67
68
 
@@ -81,7 +82,7 @@ class TeradataConstants(Enum):
81
82
  # Order of operators
82
83
  # shouldn't be changed. This is the order in which join condition is tested - first, operators
83
84
  # with two characters and then the operators with single character.
84
- SUPPORTED_ENGINES = {"ENGINE_SQL" : {"name" : "sqle", "file" : "sqlengine_alias_definitions"}}
85
+ SUPPORTED_ENGINES = {"ENGINE_SQL": {"name": "sqle", "file": "sqlengine_alias_definitions"}}
85
86
  SUPPORTED_VANTAGE_VERSIONS = {"vantage1.0": "v1.0", "vantage1.1": "v1.1",
86
87
  "vantage1.3": "v1.3", "vantage2.0": "v1.1"}
87
88
  RANGE_SEPARATORS = [":"]
@@ -89,7 +90,7 @@ class TeradataConstants(Enum):
89
90
 
90
91
  class AEDConstants(Enum):
91
92
  AED_NODE_NOT_EXECUTED = 0
92
- AED_NODE_EXECUTED = 1
93
+ AED_NODE_EXECUTED = 1
93
94
  AED_DB_OBJECT_NAME_BUFFER_SIZE = 128
94
95
  AED_NODE_TYPE_BUFFER_SIZE = 32
95
96
  AED_ASSIGN_DROP_EXISITING_COLUMNS = "Y"
@@ -147,7 +148,7 @@ class TeradataTableKindConstants(Enum):
147
148
  TABLE = "table"
148
149
  VIEW = "view"
149
150
  TEMP = "temp"
150
- ALL = "all"
151
+ ALL = "all"
151
152
  ML_PATTERN = "ml_%"
152
153
  VOLATILE_TABLE_NAME = 'Table Name'
153
154
  REGULAR_TABLE_NAME = 'TableName'
@@ -219,7 +220,7 @@ class ModelCatalogingConstants(Enum):
219
220
 
220
221
 
221
222
  class CopyToConstants(Enum):
222
- DBAPI_BATCHSIZE = 16383
223
+ DBAPI_BATCHSIZE = 16383
223
224
 
224
225
 
225
226
  class PTITableConstants(Enum):
@@ -376,34 +377,34 @@ class GeospatialConstants(Enum):
376
377
  "buffer": lambda x: "ST_Buffer",
377
378
  "contains": lambda x: "ST_Contains",
378
379
  "crosses": lambda x: "ST_Crosses",
379
- "difference": lambda x: "ST_Difference", # M
380
+ "difference": lambda x: "ST_Difference", # M
380
381
  "disjoint": lambda x: "ST_Disjoint",
381
- "distance": lambda x: "ST_Distance", # M
382
- "distance_3D": lambda x: "ST_3DDistance", # M
382
+ "distance": lambda x: "ST_Distance", # M
383
+ "distance_3D": lambda x: "ST_3DDistance", # M
383
384
  "geom_equals": lambda x: "ST_Equals",
384
385
  "intersection": lambda x: "ST_Intersection",
385
- #"intersect": lambda x: "ST_Intersect", # M
386
+ # "intersect": lambda x: "ST_Intersect", # M
386
387
  "make_2D": lambda x: "Make_2D",
387
388
  "overlaps": lambda x: "ST_Overlaps",
388
389
  "relates": lambda x: "ST_Relate",
389
390
  "simplify": lambda x: "SimplifyPreserveTopology",
390
- "sym_difference": lambda x: "ST_SymDifference", # M
391
+ "sym_difference": lambda x: "ST_SymDifference", # M
391
392
  "touches": lambda x: "ST_Touches",
392
393
  "transform": lambda x: "ST_Transform",
393
394
  "union": lambda x: "ST_Union",
394
395
  "within": lambda x: "ST_Within",
395
- "wkb_geom_to_sql": lambda x: "ST_WKBToSQL", # M
396
- "wkt_geom_to_sql": lambda x: "ST_WKTToSQL", # M
396
+ "wkb_geom_to_sql": lambda x: "ST_WKBToSQL", # M
397
+ "wkt_geom_to_sql": lambda x: "ST_WKTToSQL", # M
397
398
  "set_srid": lambda x: "ST_SRID",
398
399
 
399
400
  ## *** Geometry Type ST_Point Methods *** ##
400
401
  "set_x": lambda x: "ST_X",
401
402
  "set_y": lambda x: "ST_Y",
402
403
  "set_z": lambda x: "ST_Z",
403
- "spherical_buffer": lambda x: "ST_SphericalBufferMBR", # M
404
- "spherical_distance": lambda x: "ST_SphericalDistance", # M
405
- "spheroidal_buffer": lambda x: "ST_SpheroidalBufferMBR", # M
406
- "spheroidal_distance": lambda x: "ST_SpheroidalDistance", # M
404
+ "spherical_buffer": lambda x: "ST_SphericalBufferMBR", # M
405
+ "spherical_distance": lambda x: "ST_SphericalDistance", # M
406
+ "spheroidal_buffer": lambda x: "ST_SpheroidalBufferMBR", # M
407
+ "spheroidal_distance": lambda x: "ST_SpheroidalDistance", # M
407
408
 
408
409
  ## *** Geometry Type ST_LineString Methods *** ##
409
410
  "line_interpolate_point": lambda x: "ST_Line_Interpolate_Point",
@@ -485,11 +486,18 @@ class TableOperatorConstants(Enum):
485
486
 
486
487
  # Check if Python interpretor and add-ons are installed or not.
487
488
  # Location of In-DB packages is indicated by configure.indb_install_location.
489
+ # Check for both python and pip versions.
488
490
  CHECK_PYTHON_INSTALLED = """SELECT distinct * FROM SCRIPT(
489
491
  ON (select 1) PARTITION BY ANY
490
- SCRIPT_COMMAND('{}/bin/pip3 --version')
491
- returns('package VARCHAR(256)'))
492
+ SCRIPT_COMMAND('echo $({0}/bin/pip3 --version) -- $({0}/bin/python3 --version)')
493
+ returns('pip VARCHAR(256)'))
492
494
  """
495
+ # Check which version of rpms are installed.
496
+ INDB_PYTHON_PATH = """SEL DISTINCT os_ver
497
+ FROM SCRIPT(
498
+ SCRIPT_COMMAND('grep CPE_NAME /etc/os-release')
499
+ RETURNS('os_ver VARCHAR(100)')
500
+ );"""
493
501
 
494
502
  # Script Query to get Python packages and corresponding versions.
495
503
  # Location of In-DB packages is indicated by configure.indb_install_location.
@@ -501,9 +509,18 @@ class TableOperatorConstants(Enum):
501
509
  "delimiter(' ') " \
502
510
  "returns('package VARCHAR({2}), " \
503
511
  "version VARCHAR({2})'))"
504
-
512
+
505
513
  SCRIPT_LIST_FILES_QUERY = "SELECT DISTINCT * FROM SCRIPT (SCRIPT_COMMAND " \
506
- "('ls ./{}') RETURNS ('Files VARCHAR({})'))"
514
+ "('ls ./{}') RETURNS ('Files VARCHAR({})'))"
515
+
516
+
517
+ # OpenBlas by default is multi-threaded, needs to be set to single-threaded.
518
+ OPENBLAS_NUM_THREADS = "OPENBLAS_NUM_THREADS=1"
519
+
520
+ # Query to create a DataFrame with a range of numbers.
521
+ RANGE_QUERY = "WITH RECURSIVE NumberSeries (id) AS (SELECT id AS id from {0} "\
522
+ "UNION ALL SELECT id {3} {1} FROM NumberSeries WHERE id {3} {1} {4} {2}) "\
523
+ "SELECT id FROM NumberSeries;"
507
524
 
508
525
  class ValibConstants(Enum):
509
526
  # A dictionary that maps teradataml name of the exposed VALIB function name
@@ -802,7 +819,8 @@ class ValibConstants(Enum):
802
819
  "subdivision_method": "subdivisionmethod",
803
820
  "subdivision_threshold": "subdivisionthreshold",
804
821
  "filter": "where",
805
- "gen_sql_only": "gensqlonly"
822
+ "gen_sql_only": "gensqlonly",
823
+ "charset": "charset"
806
824
  },
807
825
 
808
826
  "DATAEXPLORER": {
@@ -819,7 +837,8 @@ class ValibConstants(Enum):
819
837
  "stats_options": "statsoptions",
820
838
  "distinct": "uniques",
821
839
  "filter": "where",
822
- "gen_sql": "gensql"
840
+ "gen_sql": "gensql",
841
+ "charset": "charset"
823
842
  },
824
843
 
825
844
  "FREQUENCY": {
@@ -833,7 +852,8 @@ class ValibConstants(Enum):
833
852
  "style": "style",
834
853
  "top_n": "topvalues",
835
854
  "filter": "where",
836
- "gen_sql_only": "gensqlonly"
855
+ "gen_sql_only": "gensqlonly",
856
+ "charset": "charset"
837
857
  },
838
858
 
839
859
  "HISTOGRAM": {
@@ -848,7 +868,8 @@ class ValibConstants(Enum):
848
868
  "stats_columns": "statisticscolumns",
849
869
  "hist_style": "style",
850
870
  "filter": "where",
851
- "gen_sql_only": "gensqlonly"
871
+ "gen_sql_only": "gensqlonly",
872
+ "charset": "charset"
852
873
  },
853
874
 
854
875
  "STATISTICS": {
@@ -859,7 +880,8 @@ class ValibConstants(Enum):
859
880
  "statistical_method": "statisticalmethod",
860
881
  "stats_options": "statsoptions",
861
882
  "filter": "where",
862
- "gen_sql_only": "gensqlonly"
883
+ "gen_sql_only": "gensqlonly",
884
+ "charset": "charset"
863
885
  },
864
886
 
865
887
  "TEXTFIELDANALYZER": {
@@ -867,7 +889,8 @@ class ValibConstants(Enum):
867
889
  "exclude_columns": "columnstoexclude",
868
890
  "analyze_numerics": "extendednumericanalysis",
869
891
  "analyze_unicode": "extendedunicodeanalysis",
870
- "gen_sql_only": "gensqlonly"
892
+ "gen_sql_only": "gensqlonly",
893
+ "charset": "charset"
871
894
  },
872
895
 
873
896
  "VALUES": {
@@ -876,7 +899,8 @@ class ValibConstants(Enum):
876
899
  "group_columns": "groupby",
877
900
  "distinct": "uniques",
878
901
  "filter": "where",
879
- "gen_sql_only": "gensqlonly"
902
+ "gen_sql_only": "gensqlonly",
903
+ "charset": "charset"
880
904
  },
881
905
 
882
906
  "ASSOCIATION": {
@@ -901,7 +925,8 @@ class ValibConstants(Enum):
901
925
  "filter": "where",
902
926
  "no_support_results": "dropsupporttables",
903
927
  "support_result_prefix": "resulttableprefix",
904
- "gen_sql_only": "gensqlonly"
928
+ "gen_sql_only": "gensqlonly",
929
+ "charset": "charset"
905
930
  },
906
931
 
907
932
  "KMEANS": {
@@ -911,7 +936,8 @@ class ValibConstants(Enum):
911
936
  "continuation": "continuation",
912
937
  "max_iter": "iterations",
913
938
  "operator_database": "operatordatabase",
914
- "threshold": "threshold"
939
+ "threshold": "threshold",
940
+ "charset": "charset"
915
941
  },
916
942
 
917
943
  "KMEANSSCORE": {
@@ -919,7 +945,8 @@ class ValibConstants(Enum):
919
945
  "cluster_column": "clustername",
920
946
  "fallback": "fallback",
921
947
  "operator_database": "operatordatabase",
922
- "accumulate": "retain"
948
+ "accumulate": "retain",
949
+ "charset": "charset"
923
950
  },
924
951
 
925
952
  "DECISIONTREE": {
@@ -931,7 +958,8 @@ class ValibConstants(Enum):
931
958
  "max_depth": "max_depth",
932
959
  "num_splits": "min_records",
933
960
  "operator_database": "operatordatabase",
934
- "pruning": "pruning"
961
+ "pruning": "pruning",
962
+ "charset": "charset"
935
963
  },
936
964
 
937
965
  "DECISIONTREESCORE": {
@@ -941,7 +969,8 @@ class ValibConstants(Enum):
941
969
  "profile": "profiletables",
942
970
  "accumulate": "retain",
943
971
  "targeted_value": "targetedvalue",
944
- "gen_sql_only": "gensqlonly"
972
+ "gen_sql_only": "gensqlonly",
973
+ "charset": "charset"
945
974
  },
946
975
 
947
976
  "MATRIX": {
@@ -951,7 +980,8 @@ class ValibConstants(Enum):
951
980
  "matrix_output": "matrixoutput",
952
981
  "type": "matrixtype",
953
982
  "handle_nulls": "nullhandling",
954
- "filter": "where"
983
+ "filter": "where",
984
+ "charset": "charset"
955
985
  },
956
986
 
957
987
  "LINEAR": {
@@ -973,7 +1003,8 @@ class ValibConstants(Enum):
973
1003
  "stepwise": "stepwise",
974
1004
  "use_fstat": "usefstat",
975
1005
  "use_pvalue": "usepvalue",
976
- "variance_prop_threshold": "varianceproportionthreshold"
1006
+ "variance_prop_threshold": "varianceproportionthreshold",
1007
+ "charset": "charset"
977
1008
  },
978
1009
 
979
1010
  "LINEARSCORE": {
@@ -981,7 +1012,8 @@ class ValibConstants(Enum):
981
1012
  "response_column": "predicted",
982
1013
  "residual_column": "residual",
983
1014
  "accumulate": "retain",
984
- "gen_sql_only": "gensqlonly"
1015
+ "gen_sql_only": "gensqlonly",
1016
+ "charset": "charset"
985
1017
  },
986
1018
 
987
1019
  "LOGISTIC": {
@@ -1011,7 +1043,8 @@ class ValibConstants(Enum):
1011
1043
  "end_threshold": "thresholdend",
1012
1044
  "increment_threshold": "thresholdincrement",
1013
1045
  "threshold_output": "thresholdtable",
1014
- "variance_prop_threshold": "varianceproportionthreshold"
1046
+ "variance_prop_threshold": "varianceproportionthreshold",
1047
+ "charset": "charset"
1015
1048
  },
1016
1049
 
1017
1050
  "LOGISTICSCORE": {
@@ -1023,7 +1056,8 @@ class ValibConstants(Enum):
1023
1056
  "start_threshold": "thresholdbegin",
1024
1057
  "end_threshold": "thresholdend",
1025
1058
  "increment_threshold": "thresholdincrement",
1026
- "gen_sql_only": "gensqlonly"
1059
+ "gen_sql_only": "gensqlonly",
1060
+ "charset": "charset"
1027
1061
 
1028
1062
  # The following 3 arguments three should not be present for LogRegPredict function
1029
1063
  # where as when the function is LogRegEvaluator, at least one of these should be
@@ -1051,13 +1085,15 @@ class ValibConstants(Enum):
1051
1085
  "rotation_type": "rotationtype",
1052
1086
  "load_threshold": "thresholdloading",
1053
1087
  "percent_threshold": "thresholdpercent",
1054
- "variance_prop_threshold": "varianceproportionthreshold"
1088
+ "variance_prop_threshold": "varianceproportionthreshold",
1089
+ "charset": "charset"
1055
1090
  },
1056
1091
 
1057
1092
  "FACTORSCORE": {
1058
1093
  "index_columns": "index",
1059
1094
  "accumulate": "retain",
1060
- "gen_sql_only": "gensqlonly"
1095
+ "gen_sql_only": "gensqlonly",
1096
+ "charset": "charset"
1061
1097
  },
1062
1098
 
1063
1099
  "PARAMETRICTEST": {
@@ -1076,7 +1112,8 @@ class ValibConstants(Enum):
1076
1112
  "style": "teststyle",
1077
1113
  "probability_threshold": "thresholdprobability",
1078
1114
  "with_indicator": "withindicator",
1079
- "gen_sql_only": "gensqlonly"
1115
+ "gen_sql_only": "gensqlonly",
1116
+ "charset": "charset"
1080
1117
  },
1081
1118
 
1082
1119
  "BINOMIALTEST": {
@@ -1091,7 +1128,8 @@ class ValibConstants(Enum):
1091
1128
  "stats_database": "statsdatabase",
1092
1129
  "style": "teststyle",
1093
1130
  "probability_threshold": "thresholdprobability",
1094
- "gen_sql_only": "gensqlonly"
1131
+ "gen_sql_only": "gensqlonly",
1132
+ "charset": "charset"
1095
1133
  },
1096
1134
 
1097
1135
  "KSTEST": {
@@ -1103,7 +1141,8 @@ class ValibConstants(Enum):
1103
1141
  "stats_database": "statsdatabase",
1104
1142
  "style": "teststyle",
1105
1143
  "probability_threshold": "thresholdprobability",
1106
- "gen_sql_only": "gensqlonly"
1144
+ "gen_sql_only": "gensqlonly",
1145
+ "charset": "charset"
1107
1146
  },
1108
1147
 
1109
1148
  "CHISQUARETEST": {
@@ -1117,7 +1156,8 @@ class ValibConstants(Enum):
1117
1156
  "stats_database": "statsdatabase",
1118
1157
  "style": "teststyle",
1119
1158
  "probability_threshold": "thresholdprobability",
1120
- "gen_sql_only": "gensqlonly"
1159
+ "gen_sql_only": "gensqlonly",
1160
+ "charset": "charset"
1121
1161
  },
1122
1162
 
1123
1163
  "RANKTEST": {
@@ -1136,7 +1176,8 @@ class ValibConstants(Enum):
1136
1176
  "style": "teststyle",
1137
1177
  "probability_threshold": "thresholdprobability",
1138
1178
  "treatment_column": "treatmentcolumn",
1139
- "gen_sql_only": "gensqlonly"
1179
+ "gen_sql_only": "gensqlonly",
1180
+ "charset": "charset"
1140
1181
  },
1141
1182
 
1142
1183
  "VARTRAN": {
@@ -1147,13 +1188,15 @@ class ValibConstants(Enum):
1147
1188
  "allow_duplicates": "multiset",
1148
1189
  "nopi": "noindex",
1149
1190
  "filter": "whereclause",
1150
- "gen_sql_only": "gensqlonly"
1191
+ "gen_sql_only": "gensqlonly",
1192
+ "charset": "charset"
1151
1193
  },
1152
1194
 
1153
1195
  "REPORT": {
1154
1196
  "analysis_type": "analysistype",
1155
1197
  "filter": "where",
1156
- "gen_sql_only": "gensqlonly"
1198
+ "gen_sql_only": "gensqlonly",
1199
+ "charset": "charset"
1157
1200
  }
1158
1201
  }
1159
1202
 
@@ -1321,7 +1364,7 @@ class SQLFunctionConstants(Enum):
1321
1364
  "regexp_replace": "REGEXP_REPLACE",
1322
1365
  "regexp_similar": "REGEXP_SIMILAR",
1323
1366
  "regexp_substr": "REGEXP_SUBSTR",
1324
-
1367
+
1325
1368
  # DateTime Functions
1326
1369
  'week_begin': 'td_week_begin',
1327
1370
  'week_start': 'td_week_begin',
@@ -1392,6 +1435,7 @@ class TeradataReservedKeywords(Enum):
1392
1435
  "TYPE"
1393
1436
  ]
1394
1437
 
1438
+
1395
1439
  class TeradataAnalyticFunctionTypes(Enum):
1396
1440
  SQLE = "FASTPATH"
1397
1441
  UAF = "UAF"
@@ -1401,15 +1445,15 @@ class TeradataAnalyticFunctionTypes(Enum):
1401
1445
 
1402
1446
 
1403
1447
  class TeradataAnalyticFunctionInfo(Enum):
1404
-
1405
- FASTPATH = {"func_type": "sqle", "lowest_version": "16.20", "display_function_type_name" :"SQLE"}
1448
+ FASTPATH = {"func_type": "sqle", "lowest_version": "16.20", "display_function_type_name": "SQLE"}
1406
1449
  UAF = {"func_type": "uaf", "lowest_version": "17.20", "display_function_type_name": "UAF",
1407
- "metadata_class" : "_AnlyFuncMetadataUAF"}
1450
+ "metadata_class": "_AnlyFuncMetadataUAF"}
1408
1451
  TABLE_OPERATOR = {"func_type": "tableoperator", "lowest_version": "17.00 ",
1409
- "display_function_type_name" :"TABLE OPERATOR"}
1452
+ "display_function_type_name": "TABLE OPERATOR"}
1410
1453
  BYOM = {"func_type": "byom", "lowest_version": None, "display_function_type_name": "BYOM"}
1411
1454
  STORED_PROCEDURE = {"func_type": "storedprocedure", "lowest_version": "17.20", "display_function_type_name": "UAF",
1412
- "metadata_class" : "_AnlyFuncMetadataUAF"}
1455
+ "metadata_class": "_AnlyFuncMetadataUAF"}
1456
+
1413
1457
 
1414
1458
  class TeradataUAFSpecificArgs(Enum):
1415
1459
  INPUT_MODE = "input_mode"
@@ -1417,9 +1461,11 @@ class TeradataUAFSpecificArgs(Enum):
1417
1461
  OUTPUT_FMT_INDEX = "output_fmt_index"
1418
1462
  OUTPUT_FMT_INDEX_STYLE = "output_fmt_index_style"
1419
1463
 
1464
+
1420
1465
  class Query(Enum):
1421
1466
  VANTAGE_VERSION = "SELECT InfoData FROM DBC.DBCInfoV where InfoKey = 'VERSION'"
1422
1467
 
1468
+
1423
1469
  class DriverEscapeFunctions(Enum):
1424
1470
  # Holds variables for the teradatasql driver escape functions to be used
1425
1471
  NATIVE_SQL = "{fn teradata_nativesql}"
@@ -1448,6 +1494,7 @@ class HTTPRequest(Enum):
1448
1494
  POST = "post"
1449
1495
  PUT = "put"
1450
1496
  DELETE = "delete"
1497
+ PATCH = "patch"
1451
1498
 
1452
1499
 
1453
1500
  class AsyncStatusColumns(Enum):
@@ -1459,6 +1506,13 @@ class AsyncStatusColumns(Enum):
1459
1506
  ADDITIONAL_DETAILS = "Additional Details"
1460
1507
 
1461
1508
 
1509
+ class AsyncOpStatus(Enum):
1510
+ # Holds valid status for asynchronous operatiosns in UES.
1511
+ FILE_INSTALLED = "File Installed"
1512
+ ERRED = "Errored"
1513
+ FINISHED = "Finished"
1514
+
1515
+
1462
1516
  class CloudProvider(Enum):
1463
1517
  # Holds variable names for Cloud Providers.
1464
1518
  AWS = "AWS"
@@ -1468,7 +1522,8 @@ class CloudProvider(Enum):
1468
1522
  X_MS_VERSION = "2019-12-12"
1469
1523
  X_MS_BLOB_TYPE = "BlockBlob"
1470
1524
 
1471
- class SessionParamsSQL:
1525
+
1526
+ class SessionParamsSQL(Enum):
1472
1527
  # Holds the SQL Statements for Session params.
1473
1528
  TIMEZONE = "SET TIME ZONE {}"
1474
1529
  ACCOUNT = "SET SESSION ACCOUNT = '{}' FOR {}"
@@ -1488,7 +1543,8 @@ class SessionParamsSQL:
1488
1543
  QUERY_BAND = "SET QUERY_BAND = {} FOR {}"
1489
1544
  UDFSEARCHPATH = "SET SESSION UDFSEARCHPATH = {} FOR FUNCTION = {}"
1490
1545
 
1491
- class SessionParamsPythonNames:
1546
+
1547
+ class SessionParamsPythonNames(Enum):
1492
1548
  # Holds the SQL Statements for Session params.
1493
1549
  TIMEZONE = "Session Time Zone"
1494
1550
  ACCOUNT = "Account Name"
@@ -1498,13 +1554,16 @@ class SessionParamsPythonNames:
1498
1554
  DATEFORM = 'Current DateForm'
1499
1555
 
1500
1556
 
1501
- class Action(Enum):
1502
- # Holds variable names for the type of grant to be provided.
1503
- GRANT = "GRANT"
1504
- REVOKE = "REVOKE"
1557
+ class AutoMLConstants(Enum):
1558
+ # List stores feature selection methods
1559
+ FEATURE_SELECTION_MTDS = ["lasso", "rfe", "pca"]
1505
1560
 
1506
- class Permission(Enum):
1507
- # Holds variable names for the type of permission to be provided.
1508
- READ = "READ"
1509
- WRITE = "WRITE"
1510
1561
 
1562
+ class AuthMechs(Enum):
1563
+ """
1564
+ Enum to hold permitted values for authentication mechanism.
1565
+ """
1566
+ OAUTH = "OAuth"
1567
+ JWT = "JWT"
1568
+ PAT = "PAT"
1569
+ BASIC = "BASIC"