teradataml 20.0.0.5__py3-none-any.whl → 20.0.0.6__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 (53) hide show
  1. teradataml/LICENSE-3RD-PARTY.pdf +0 -0
  2. teradataml/README.md +96 -0
  3. teradataml/_version.py +1 -1
  4. teradataml/analytics/analytic_function_executor.py +1 -1
  5. teradataml/analytics/utils.py +56 -11
  6. teradataml/clients/auth_client.py +10 -6
  7. teradataml/clients/keycloak_client.py +165 -0
  8. teradataml/common/constants.py +10 -0
  9. teradataml/common/exceptions.py +32 -0
  10. teradataml/common/messagecodes.py +27 -0
  11. teradataml/common/messages.py +9 -1
  12. teradataml/common/sqlbundle.py +3 -2
  13. teradataml/common/utils.py +94 -12
  14. teradataml/context/context.py +37 -9
  15. teradataml/data/jsons/byom/onnxembeddings.json +1 -0
  16. teradataml/data/pattern_matching_data.csv +11 -0
  17. teradataml/data/sdk/modelops/modelops_spec.json +101737 -0
  18. teradataml/data/teradataml_example.json +8 -1
  19. teradataml/data/url_data.csv +10 -9
  20. teradataml/dataframe/copy_to.py +1 -1
  21. teradataml/dataframe/dataframe.py +980 -82
  22. teradataml/dataframe/dataframe_utils.py +58 -25
  23. teradataml/dataframe/functions.py +962 -1
  24. teradataml/dataframe/sql.py +570 -1031
  25. teradataml/hyperparameter_tuner/utils.py +4 -2
  26. teradataml/lib/aed_0_1.dll +0 -0
  27. teradataml/opensource/_base.py +7 -1
  28. teradataml/options/configure.py +20 -4
  29. teradataml/scriptmgmt/UserEnv.py +13 -2
  30. teradataml/scriptmgmt/lls_utils.py +99 -24
  31. teradataml/sdk/README.md +79 -0
  32. teradataml/sdk/__init__.py +4 -0
  33. teradataml/sdk/_auth_modes.py +422 -0
  34. teradataml/sdk/_func_params.py +487 -0
  35. teradataml/sdk/_json_parser.py +453 -0
  36. teradataml/sdk/_openapi_spec_constants.py +249 -0
  37. teradataml/sdk/_utils.py +236 -0
  38. teradataml/sdk/api_client.py +897 -0
  39. teradataml/sdk/constants.py +62 -0
  40. teradataml/sdk/modelops/__init__.py +98 -0
  41. teradataml/sdk/modelops/_client.py +406 -0
  42. teradataml/sdk/modelops/_constants.py +304 -0
  43. teradataml/sdk/modelops/models.py +2308 -0
  44. teradataml/sdk/spinner.py +107 -0
  45. teradataml/table_operators/query_generator.py +4 -21
  46. teradataml/utils/dtypes.py +2 -1
  47. teradataml/utils/utils.py +0 -1
  48. teradataml/utils/validators.py +5 -1
  49. {teradataml-20.0.0.5.dist-info → teradataml-20.0.0.6.dist-info}/METADATA +101 -2
  50. {teradataml-20.0.0.5.dist-info → teradataml-20.0.0.6.dist-info}/RECORD +53 -36
  51. {teradataml-20.0.0.5.dist-info → teradataml-20.0.0.6.dist-info}/WHEEL +0 -0
  52. {teradataml-20.0.0.5.dist-info → teradataml-20.0.0.6.dist-info}/top_level.txt +0 -0
  53. {teradataml-20.0.0.5.dist-info → teradataml-20.0.0.6.dist-info}/zip-safe +0 -0
@@ -1953,7 +1953,7 @@ class DataFrameUtils():
1953
1953
  return _DtypesMappers.DATALAKE_STR_to_TDSQLALCHEMY_DATATYPE_MAPPER[td_str_type]()
1954
1954
 
1955
1955
  @staticmethod
1956
- def _get_datalake_table_columns_info(schema, table_name, datalake):
1956
+ def _get_datalake_table_columns_info(schema, table_name, datalake, use_dialect=False):
1957
1957
  """
1958
1958
  Function to get column names and corresponding teradatasqlalchemy types
1959
1959
  of a datalake table using results of 'help table <datalake>.<db_name>.<table_name>'
@@ -1990,31 +1990,64 @@ class DataFrameUtils():
1990
1990
  VARCHAR(length=2000, charset='UNICODE'),
1991
1991
  INTEGER()])
1992
1992
  """
1993
- # Get the column information from the strings type.
1994
- prepared = preparer(td_dialect())
1995
- sqlbundle = SQLBundle()
1996
- full_tbl_name = '{}.{}.{}'.format(prepared.quote(datalake),
1997
- prepared.quote(schema),
1998
- prepared.quote(table_name))
1999
- help_table_sql = sqlbundle._get_sql_query(SQLConstants.SQL_HELP_TABLE).format(full_tbl_name)
2000
-
2001
- cur = execute_sql(help_table_sql)
2002
- td_types_col_index = -1
2003
- for i, col_metadata in enumerate(cur.description):
2004
- # Help Table returns column names and
2005
- # corresponding IcebergType, TeradataInternalType,
2006
- # TeradataType. We need to extract column index for
2007
- # 'TeradataType' column.
2008
- if col_metadata[0].lower() == 'teradatatype':
2009
- td_types_col_index = i
2010
-
2011
1993
  col_names = []
2012
1994
  col_types = []
2013
- if td_types_col_index > -1:
2014
- for col_info in cur.fetchall():
2015
- col_names.append(col_info[0])
2016
- col_types.append(DataFrameUtils._get_sqlalchemy_type_from_str(col_info[td_types_col_index]))
1995
+ if not use_dialect:
1996
+ # Get the column information from the strings type.
1997
+ prepared = preparer(td_dialect())
1998
+ sqlbundle = SQLBundle()
1999
+ full_tbl_name = '{}.{}.{}'.format(prepared.quote(datalake),
2000
+ prepared.quote(schema),
2001
+ prepared.quote(table_name))
2002
+ help_table_sql = sqlbundle._get_sql_query(SQLConstants.SQL_HELP_TABLE).format(full_tbl_name)
2003
+
2004
+ cur = execute_sql(help_table_sql)
2005
+ td_types_col_index = -1
2006
+
2007
+ for i, col_metadata in enumerate(cur.description):
2008
+ # Help Table returns column names and
2009
+ # corresponding IcebergType, TeradataInternalType,
2010
+ # TeradataType. We need to extract column index for
2011
+ # 'TeradataType' column.
2012
+ if col_metadata[0].lower() in ['teradatatype', 'Type']:
2013
+ td_types_col_index = i
2014
+
2015
+ if td_types_col_index > -1:
2016
+ for col_info in cur.fetchall():
2017
+ col_names.append(col_info[0])
2018
+ col_types.append(DataFrameUtils._get_sqlalchemy_type_from_str(col_info[td_types_col_index]))
2019
+ else:
2020
+ raise TeradataMlException(Messages.get_message(MessageCodes.TDMLDF_CREATE_FAIL),
2021
+ MessageCodes.TDMLDF_CREATE_FAIL)
2017
2022
  else:
2018
- raise TeradataMlException(Messages.get_message(MessageCodes.TDMLDF_CREATE_FAIL),
2019
- MessageCodes.TDMLDF_CREATE_FAIL)
2023
+ new_kwarg = get_connection().dialect.__class__.__name__ + "_datalake"
2024
+ all_col_info = get_connection().dialect.get_columns(connection=get_connection(),
2025
+ table_name=table_name,
2026
+ schema=schema,
2027
+ table_only=True,
2028
+ **{new_kwarg: datalake})
2029
+ for col_dict in all_col_info:
2030
+ col_names.append(col_dict.get('name', col_dict.get('Column Name')))
2031
+ col_types.append(col_dict.get('type', col_dict.get('Type')))
2032
+
2020
2033
  return col_names, col_types
2034
+
2035
+ @staticmethod
2036
+ def check_otf_dataframe():
2037
+ """Decorator for validating if DataFrame is created on OTF table or not and throw error."""
2038
+ def decorator(method):
2039
+ def wrapper(self, *args, **kwargs):
2040
+ if not self._datalake:
2041
+ attr = getattr(type(self), method.__name__, None)
2042
+ caller_name = method.__name__ + '()'
2043
+ if isinstance(attr, property):
2044
+ caller_name = method.__name__
2045
+ raise TeradataMlException(Messages.get_message(MessageCodes.OTF_TABLE_REQUIRED,
2046
+ caller_name),
2047
+ MessageCodes.UNSUPPORTED_OPERATION)
2048
+
2049
+ return method(self, *args, **kwargs)
2050
+
2051
+ return wrapper
2052
+
2053
+ return decorator