teradataml 20.0.0.2__py3-none-any.whl → 20.0.0.4__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.
- teradataml/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/README.md +315 -2
- teradataml/__init__.py +4 -0
- teradataml/_version.py +1 -1
- teradataml/analytics/analytic_function_executor.py +95 -8
- teradataml/analytics/byom/__init__.py +1 -1
- teradataml/analytics/json_parser/metadata.py +12 -3
- teradataml/analytics/json_parser/utils.py +7 -2
- teradataml/analytics/sqle/__init__.py +5 -1
- teradataml/analytics/table_operator/__init__.py +1 -1
- teradataml/analytics/uaf/__init__.py +1 -1
- teradataml/analytics/utils.py +4 -0
- teradataml/analytics/valib.py +18 -4
- teradataml/automl/__init__.py +51 -6
- teradataml/automl/data_preparation.py +59 -35
- teradataml/automl/data_transformation.py +58 -33
- teradataml/automl/feature_engineering.py +27 -12
- teradataml/automl/model_training.py +73 -46
- teradataml/common/constants.py +88 -29
- teradataml/common/garbagecollector.py +2 -1
- teradataml/common/messagecodes.py +19 -3
- teradataml/common/messages.py +6 -1
- teradataml/common/sqlbundle.py +64 -12
- teradataml/common/utils.py +246 -47
- teradataml/common/warnings.py +11 -0
- teradataml/context/context.py +161 -27
- teradataml/data/amazon_reviews_25.csv +26 -0
- teradataml/data/byom_example.json +11 -0
- teradataml/data/dataframe_example.json +18 -2
- teradataml/data/docs/byom/docs/DataRobotPredict.py +2 -2
- teradataml/data/docs/byom/docs/DataikuPredict.py +40 -1
- teradataml/data/docs/byom/docs/H2OPredict.py +2 -2
- teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
- teradataml/data/docs/byom/docs/ONNXPredict.py +2 -2
- teradataml/data/docs/byom/docs/PMMLPredict.py +2 -2
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +1 -1
- teradataml/data/docs/sqle/docs_17_20/Shap.py +34 -6
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +4 -4
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +3 -3
- teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
- teradataml/data/docs/uaf/docs_17_20/CopyArt.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +4 -1
- teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +18 -21
- teradataml/data/hnsw_alter_data.csv +5 -0
- teradataml/data/hnsw_data.csv +10 -0
- teradataml/data/jsons/byom/h2opredict.json +1 -1
- teradataml/data/jsons/byom/onnxembeddings.json +266 -0
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +0 -1
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +1 -1
- teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
- teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -0
- teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +10 -19
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +3 -1
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +15 -5
- teradataml/data/medical_readings.csv +101 -0
- teradataml/data/patient_profile.csv +101 -0
- teradataml/data/scripts/lightgbm/dataset.template +157 -0
- teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +247 -0
- teradataml/data/scripts/lightgbm/lightgbm_function.template +216 -0
- teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +159 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +194 -167
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +136 -115
- teradataml/data/scripts/sklearn/sklearn_function.template +14 -19
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +155 -137
- teradataml/data/scripts/sklearn/sklearn_transform.py +129 -42
- teradataml/data/target_udt_data.csv +8 -0
- teradataml/data/templates/open_source_ml.json +3 -2
- teradataml/data/teradataml_example.json +8 -0
- teradataml/data/vectordistance_example.json +4 -0
- teradataml/dataframe/copy_to.py +8 -3
- teradataml/dataframe/data_transfer.py +11 -1
- teradataml/dataframe/dataframe.py +1049 -285
- teradataml/dataframe/dataframe_utils.py +152 -20
- teradataml/dataframe/functions.py +578 -35
- teradataml/dataframe/setop.py +11 -6
- teradataml/dataframe/sql.py +185 -16
- teradataml/dbutils/dbutils.py +1049 -115
- teradataml/dbutils/filemgr.py +48 -1
- teradataml/hyperparameter_tuner/optimizer.py +12 -1
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/__init__.py +1 -1
- teradataml/opensource/_base.py +1466 -0
- teradataml/opensource/_class.py +464 -0
- teradataml/opensource/{sklearn/constants.py → _constants.py} +21 -14
- teradataml/opensource/_lightgbm.py +949 -0
- teradataml/opensource/_sklearn.py +1008 -0
- teradataml/opensource/{sklearn/_wrapper_utils.py → _wrapper_utils.py} +5 -6
- teradataml/options/__init__.py +54 -38
- teradataml/options/configure.py +131 -27
- teradataml/options/display.py +13 -2
- teradataml/plot/axis.py +47 -8
- teradataml/plot/figure.py +33 -0
- teradataml/plot/plot.py +63 -13
- teradataml/scriptmgmt/UserEnv.py +5 -5
- teradataml/scriptmgmt/lls_utils.py +130 -40
- teradataml/store/__init__.py +12 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +291 -0
- teradataml/store/feature_store/feature_store.py +2318 -0
- teradataml/store/feature_store/models.py +1505 -0
- teradataml/table_operators/Apply.py +32 -18
- teradataml/table_operators/Script.py +3 -1
- teradataml/table_operators/TableOperator.py +3 -1
- teradataml/table_operators/query_generator.py +3 -0
- teradataml/table_operators/table_operator_query_generator.py +3 -1
- teradataml/table_operators/table_operator_util.py +37 -38
- teradataml/table_operators/templates/dataframe_register.template +69 -0
- teradataml/utils/dtypes.py +51 -2
- teradataml/utils/internal_buffer.py +18 -0
- teradataml/utils/validators.py +99 -8
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/METADATA +321 -5
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/RECORD +121 -94
- teradataml/libaed_0_1.dylib +0 -0
- teradataml/libaed_0_1.so +0 -0
- teradataml/opensource/sklearn/__init__.py +0 -1
- teradataml/opensource/sklearn/_class.py +0 -255
- teradataml/opensource/sklearn/_sklearn_wrapper.py +0 -1800
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.2.dist-info → teradataml-20.0.0.4.dist-info}/zip-safe +0 -0
teradataml/context/context.py
CHANGED
|
@@ -13,32 +13,35 @@ A teradataml context functions provide interface to Teradata Vantage. Provides f
|
|
|
13
13
|
context which can be used by other analytical functions to get the Teradata Vantage connection.
|
|
14
14
|
|
|
15
15
|
"""
|
|
16
|
+
import atexit
|
|
16
17
|
import ipaddress
|
|
18
|
+
import os
|
|
19
|
+
import socket
|
|
20
|
+
import sys
|
|
21
|
+
import threading
|
|
22
|
+
import urllib.parse
|
|
23
|
+
import warnings
|
|
17
24
|
from pathlib import Path
|
|
25
|
+
from dotenv import dotenv_values
|
|
26
|
+
|
|
18
27
|
from sqlalchemy import create_engine
|
|
19
|
-
from
|
|
28
|
+
from sqlalchemy.engine.base import Engine
|
|
29
|
+
from sqlalchemy.engine.url import URL
|
|
30
|
+
|
|
31
|
+
from teradataml.common.constants import Query, SQLConstants, TeradataConstants
|
|
20
32
|
from teradataml.common.deprecations import argument_deprecation
|
|
21
33
|
from teradataml.common.exceptions import TeradataMlException
|
|
22
|
-
from teradataml.common.
|
|
23
|
-
from teradataml.common.messages import Messages
|
|
34
|
+
from teradataml.common.garbagecollector import GarbageCollector
|
|
24
35
|
from teradataml.common.messagecodes import MessageCodes
|
|
36
|
+
from teradataml.common.messages import Messages
|
|
25
37
|
from teradataml.common.sqlbundle import SQLBundle
|
|
26
|
-
from teradataml.common.
|
|
27
|
-
from teradataml.common.garbagecollector import GarbageCollector
|
|
38
|
+
from teradataml.common.warnings import TeradataMlRuntimeWarning
|
|
28
39
|
from teradataml.context.aed_context import AEDContext
|
|
29
|
-
from teradataml.common.constants import TeradataConstants, Query
|
|
30
40
|
from teradataml.options.configure import configure
|
|
41
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
42
|
+
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
31
43
|
from teradataml.utils.utils import execute_sql
|
|
32
44
|
from teradataml.utils.validators import _Validators
|
|
33
|
-
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
34
|
-
from sqlalchemy.engine.base import Engine
|
|
35
|
-
from sqlalchemy.engine.url import URL
|
|
36
|
-
import os
|
|
37
|
-
import warnings
|
|
38
|
-
import atexit
|
|
39
|
-
import socket
|
|
40
|
-
import threading
|
|
41
|
-
import urllib.parse
|
|
42
45
|
|
|
43
46
|
# Store a global Teradata Vantage Connection.
|
|
44
47
|
# Right now user can only provide a single Vantage connection at any point of time.
|
|
@@ -47,6 +50,8 @@ td_sqlalchemy_engine = None
|
|
|
47
50
|
temporary_database_name = None
|
|
48
51
|
user_specified_connection = False
|
|
49
52
|
python_packages_installed = False
|
|
53
|
+
python_version_vantage = None
|
|
54
|
+
python_version_local = None
|
|
50
55
|
td_user = None
|
|
51
56
|
|
|
52
57
|
function_alias_mappings = {}
|
|
@@ -201,9 +206,16 @@ def create_context(host = None, username = None, password = None, tdsqlengine =
|
|
|
201
206
|
"""
|
|
202
207
|
DESCRIPTION:
|
|
203
208
|
Creates a connection to the Teradata Vantage using the teradatasql + teradatasqlalchemy DBAPI and dialect
|
|
204
|
-
combination. Users can pass all required parameters (host, username, password) for establishing a connection to
|
|
205
|
-
Vantage, or pass a sqlalchemy engine to the tdsqlengine parameter to override the default DBAPI and dialect
|
|
206
209
|
combination.
|
|
210
|
+
Users can create a connection by passing the connection parameters using any of the following methods:
|
|
211
|
+
1. Pass all required parameters (host, username, password) directly to the function, OR
|
|
212
|
+
2. Set the connection parameters in a configuration file (.cfg or .env) and
|
|
213
|
+
pass the configuration file OR
|
|
214
|
+
3. Set the connection parameters in environment variables and create_context() reads from
|
|
215
|
+
environment variables.
|
|
216
|
+
|
|
217
|
+
Alternatively, users can pass a SQLAlchemy engine to the `tdsqlengine` parameter to override the default DBAPI
|
|
218
|
+
and dialect combination.
|
|
207
219
|
|
|
208
220
|
Note:
|
|
209
221
|
1. teradataml requires that the user has certain permissions on the user's default database or the initial
|
|
@@ -241,6 +253,17 @@ def create_context(host = None, username = None, password = None, tdsqlengine =
|
|
|
241
253
|
| | default database. |
|
|
242
254
|
+------------------------------------------------------+---------------------------------------------+
|
|
243
255
|
|
|
256
|
+
3. The function prioritizes parameters in the following order:
|
|
257
|
+
1. Explicitly passed arguments (host, username, password).
|
|
258
|
+
2. Environment variables (TD_HOST, TD_USERNAME, TD_PASSWORD, etc.).
|
|
259
|
+
Note:
|
|
260
|
+
* The environment variables should start with 'TD_' and all must be in upper case.
|
|
261
|
+
Example:
|
|
262
|
+
os.environ['TD_HOST'] = 'tdhost'
|
|
263
|
+
os.environ['TD_USERNAME'] = 'tduser'
|
|
264
|
+
os.environ['TD_PASSWORD'] = 'tdpassword'
|
|
265
|
+
3. A configuration file if provided (such as a .env file).
|
|
266
|
+
|
|
244
267
|
PARAMETERS:
|
|
245
268
|
host:
|
|
246
269
|
Optional Argument.
|
|
@@ -331,6 +354,25 @@ def create_context(host = None, username = None, password = None, tdsqlengine =
|
|
|
331
354
|
integer or boolean value, instead of quoted integer or quoted boolean as suggested in the
|
|
332
355
|
documentation. Please check the examples for usage.
|
|
333
356
|
|
|
357
|
+
config_file:
|
|
358
|
+
Optional Argument.
|
|
359
|
+
Specifies the name of the configuration file to read the connection parameters.
|
|
360
|
+
Notes:
|
|
361
|
+
* If user do not specify full path of file,then file look up is done at current working directory.
|
|
362
|
+
* The content of the file must be in '.env' format.
|
|
363
|
+
* Use parameters of create_context() as key in the configuration file.
|
|
364
|
+
Example:
|
|
365
|
+
host=tdhost
|
|
366
|
+
username=tduser
|
|
367
|
+
password=tdpassword
|
|
368
|
+
temp_database_name=tdtemp_database_name
|
|
369
|
+
logmech=tdlogmech
|
|
370
|
+
logdata=tdlogdata
|
|
371
|
+
database=tddatabase
|
|
372
|
+
* For more information please refer examples section.
|
|
373
|
+
Default Value : td_properties.cfg
|
|
374
|
+
Types: str
|
|
375
|
+
|
|
334
376
|
RETURNS:
|
|
335
377
|
A Teradata sqlalchemy engine object.
|
|
336
378
|
|
|
@@ -400,13 +442,56 @@ def create_context(host = None, username = None, password = None, tdsqlengine =
|
|
|
400
442
|
>>> td_context = create_context(host = 'tdhost', username='tduser', password = 'tdpassword', tmode = 'tera',
|
|
401
443
|
log = 8, lob_support = False)
|
|
402
444
|
|
|
445
|
+
# Example 14: Create context from config file with name 'td_properties.cfg'
|
|
446
|
+
# available under current working directory.
|
|
447
|
+
# td_properties.cfg content:
|
|
448
|
+
# host=tdhost
|
|
449
|
+
# username=tduser
|
|
450
|
+
# password=tdpassword
|
|
451
|
+
# temp_database_name=tdtemp_database_name
|
|
452
|
+
# logmech=tdlogmech
|
|
453
|
+
# logdata=tdlogdata
|
|
454
|
+
# database=tddatabase
|
|
455
|
+
>>> td_context = create_context()
|
|
456
|
+
|
|
457
|
+
# Example 15: Create context using the file specified in user's home directory
|
|
458
|
+
# with name user_td_properties.cfg.
|
|
459
|
+
# user_td_properties.cfg content:
|
|
460
|
+
# host=tdhost
|
|
461
|
+
# username=tduser
|
|
462
|
+
# password=tdpassword
|
|
463
|
+
# temp_database_name=tdtemp_database_name
|
|
464
|
+
# logmech=tdlogmech
|
|
465
|
+
# logdata=tdlogdata
|
|
466
|
+
# database=tddatabase
|
|
467
|
+
>>> td_context = create_context(config_file="user_td_properties.cfg")
|
|
468
|
+
|
|
469
|
+
# Example 16: Create context using environment variables.
|
|
470
|
+
# Set these using os.environ and then run the example:
|
|
471
|
+
# os.environ['TD_HOST'] = 'tdhost'
|
|
472
|
+
# os.environ['TD_USERNAME'] = 'tduser'
|
|
473
|
+
# os.environ['TD_PASSWORD'] = 'tdpassword'
|
|
474
|
+
# os.environ['TD_TEMP_DATABASE_NAME'] = 'tdtemp_database_name'
|
|
475
|
+
# os.environ['TD_LOGMECH'] = 'tdlogmech'
|
|
476
|
+
# os.environ['TD_LOGDATA'] = 'tdlogdata'
|
|
477
|
+
# os.environ['TD_DATABASE'] = 'tddatabase'
|
|
478
|
+
>>> td_context = create_context()
|
|
403
479
|
"""
|
|
404
480
|
global td_connection
|
|
405
481
|
global td_sqlalchemy_engine
|
|
406
482
|
global temporary_database_name
|
|
407
483
|
global user_specified_connection
|
|
408
484
|
global python_packages_installed
|
|
485
|
+
global python_version_vantage
|
|
486
|
+
global python_version_local
|
|
409
487
|
global td_user
|
|
488
|
+
|
|
489
|
+
# Check if the user has provided the connection parameters or tdsqlengine.
|
|
490
|
+
# If not, check if the user has provided the connection parameters in the environment variables.
|
|
491
|
+
# If not, check if the user has provided the connection parameters in the config file.
|
|
492
|
+
if not (host or tdsqlengine) and host!="":
|
|
493
|
+
return _load_context_from_env_config(kwargs.pop('config_file', 'td_properties.cfg'))
|
|
494
|
+
|
|
410
495
|
awu_matrix = []
|
|
411
496
|
awu_matrix.append(["host", host, True, (str), True])
|
|
412
497
|
awu_matrix.append(["username", username, True, (str), True])
|
|
@@ -497,6 +582,8 @@ def create_context(host = None, username = None, password = None, tdsqlengine =
|
|
|
497
582
|
_load_function_aliases()
|
|
498
583
|
|
|
499
584
|
python_packages_installed = False
|
|
585
|
+
python_version_vantage = None
|
|
586
|
+
python_version_local = sys.version.split(" ")[0].strip()
|
|
500
587
|
|
|
501
588
|
# Assign the tempdatabase name to global
|
|
502
589
|
if temp_database_name is None:
|
|
@@ -527,6 +614,34 @@ def create_context(host = None, username = None, password = None, tdsqlengine =
|
|
|
527
614
|
# Return the connection by default
|
|
528
615
|
return td_sqlalchemy_engine
|
|
529
616
|
|
|
617
|
+
def _load_context_from_env_config(config_file):
|
|
618
|
+
"""
|
|
619
|
+
DESCRIPTION:
|
|
620
|
+
Reads the connection parameters from the configuration file or environment variables.
|
|
621
|
+
|
|
622
|
+
PARAMETERS:
|
|
623
|
+
config_file:
|
|
624
|
+
Required Argument.
|
|
625
|
+
Specifies the name of the configuration file to read the connection parameters.
|
|
626
|
+
Types: str
|
|
627
|
+
|
|
628
|
+
RETURNS:
|
|
629
|
+
A Teradata sqlalchemy engine object.
|
|
630
|
+
|
|
631
|
+
RAISES:
|
|
632
|
+
TeradataMlException
|
|
633
|
+
"""
|
|
634
|
+
host = os.environ.get('TD_HOST')
|
|
635
|
+
connection_params_from_file = dotenv_values(config_file)
|
|
636
|
+
if host:
|
|
637
|
+
connection_params_from_env = {key[3:].lower(): value for key, value in os.environ.items()
|
|
638
|
+
if key.startswith('TD_')}
|
|
639
|
+
return create_context(**connection_params_from_env)
|
|
640
|
+
elif connection_params_from_file.get('host'):
|
|
641
|
+
return create_context(**connection_params_from_file)
|
|
642
|
+
else:
|
|
643
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.CONNECTION_PARAMS),
|
|
644
|
+
MessageCodes.MISSING_ARGS)
|
|
530
645
|
|
|
531
646
|
def _mask_logmech_logdata():
|
|
532
647
|
"""
|
|
@@ -625,6 +740,8 @@ def set_context(tdsqlengine, temp_database_name=None):
|
|
|
625
740
|
global temporary_database_name
|
|
626
741
|
global user_specified_connection
|
|
627
742
|
global python_packages_installed
|
|
743
|
+
global python_version_local
|
|
744
|
+
global python_version_vantage
|
|
628
745
|
if td_connection is not None:
|
|
629
746
|
# Clearing the internal buffer.
|
|
630
747
|
_InternalBuffer.clean()
|
|
@@ -654,6 +771,8 @@ def set_context(tdsqlengine, temp_database_name=None):
|
|
|
654
771
|
_load_function_aliases()
|
|
655
772
|
|
|
656
773
|
python_packages_installed = False
|
|
774
|
+
python_version_vantage = None
|
|
775
|
+
python_version_local = sys.version.split(" ")[0].strip()
|
|
657
776
|
|
|
658
777
|
# Initialise Dag
|
|
659
778
|
__initalise_dag()
|
|
@@ -687,6 +806,8 @@ def remove_context():
|
|
|
687
806
|
global td_sqlalchemy_engine
|
|
688
807
|
global user_specified_connection
|
|
689
808
|
global python_packages_installed
|
|
809
|
+
global python_version_vantage
|
|
810
|
+
global python_version_local
|
|
690
811
|
global td_user
|
|
691
812
|
|
|
692
813
|
# Initiate the garbage collection
|
|
@@ -706,10 +827,13 @@ def remove_context():
|
|
|
706
827
|
td_connection = None
|
|
707
828
|
td_sqlalchemy_engine = None
|
|
708
829
|
python_packages_installed = False
|
|
830
|
+
python_version_local = None
|
|
831
|
+
python_version_vantage = None
|
|
709
832
|
td_user = None
|
|
710
833
|
configure._current_database_name = None
|
|
711
834
|
configure._database_username = None
|
|
712
835
|
configure.database_version = None
|
|
836
|
+
configure.indb_install_location = ''
|
|
713
837
|
|
|
714
838
|
# Closing Dag
|
|
715
839
|
__close_dag()
|
|
@@ -1010,19 +1134,21 @@ def _get_host():
|
|
|
1010
1134
|
EXAMPLES:
|
|
1011
1135
|
_get_host()
|
|
1012
1136
|
"""
|
|
1013
|
-
|
|
1014
|
-
|
|
1137
|
+
if td_connection is None:
|
|
1138
|
+
return None
|
|
1139
|
+
else:
|
|
1140
|
+
return td_sqlalchemy_engine.url.host
|
|
1015
1141
|
|
|
1016
1142
|
def _get_host_ip():
|
|
1017
1143
|
"""
|
|
1018
1144
|
DESCRIPTION:
|
|
1019
|
-
Function to return the host IP address.
|
|
1145
|
+
Function to return the host IP address or host name associated with the current context.
|
|
1020
1146
|
|
|
1021
1147
|
PARAMETERS:
|
|
1022
1148
|
None.
|
|
1023
1149
|
|
|
1024
1150
|
RETURNS:
|
|
1025
|
-
Host IP address.
|
|
1151
|
+
Host IP address or host name associated with the current context.
|
|
1026
1152
|
|
|
1027
1153
|
RAISES:
|
|
1028
1154
|
None.
|
|
@@ -1034,21 +1160,29 @@ def _get_host_ip():
|
|
|
1034
1160
|
if td_connection is None:
|
|
1035
1161
|
return None
|
|
1036
1162
|
|
|
1037
|
-
|
|
1163
|
+
host = _get_host()
|
|
1038
1164
|
try:
|
|
1039
1165
|
# Validate if host_ip is a valid IP address (IPv4 or IPv6)
|
|
1040
|
-
ipaddress.ip_address(
|
|
1166
|
+
ipaddress.ip_address(host)
|
|
1167
|
+
return host
|
|
1041
1168
|
except ValueError:
|
|
1042
1169
|
# If host is not an IP address, get the IP address by DNS name from _InternalBuffer.
|
|
1043
|
-
|
|
1044
|
-
if
|
|
1045
|
-
|
|
1170
|
+
dns_host_ip = _InternalBuffer.get('dns_host_ip')
|
|
1171
|
+
if dns_host_ip:
|
|
1172
|
+
return dns_host_ip
|
|
1173
|
+
|
|
1174
|
+
# If DNS host ip not found, resolve the host name to get the IP address.
|
|
1175
|
+
# If there is issue in resolving the host name, it will proceed with DNS host as it is.
|
|
1176
|
+
try:
|
|
1046
1177
|
# Get the list of addresses(compatible for both IPv4 and IPv6)
|
|
1047
|
-
addr_info = socket.getaddrinfo(
|
|
1178
|
+
addr_info = socket.getaddrinfo(host, None)
|
|
1048
1179
|
# Pick the first address from the list
|
|
1049
1180
|
host_ip = addr_info[0][4][0]
|
|
1050
1181
|
# Add the DNS host IP to the _InternalBuffer.
|
|
1051
1182
|
_InternalBuffer.add(dns_host_ip=host_ip)
|
|
1183
|
+
except socket.gaierror:
|
|
1184
|
+
# Use dns host as it is
|
|
1185
|
+
host_ip = host
|
|
1052
1186
|
return host_ip
|
|
1053
1187
|
|
|
1054
1188
|
class ContextUtilFuncs():
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"rev_id","aid","rev_name","helpful","rev_text","rating","prodsummary","unixrevtime","revtime"
|
|
2
|
+
A10000012B7CGYKOMPQ4L,"000100039X",Adam,"[0, 0]",Spiritually and mentally inspiring! A book that allows you to question your morals and will help you discover who you really are!,5.00,Wonderful!,1355616000,"12 16, 2012"
|
|
3
|
+
A2KU9IU07LOJS1,"000100039X",Amazon Customer,"[0, 0]",This book has been a classic for many years. It has so much wisdom in it that it can be read numerous times and new things will come out each time. My favorite chapter is the one on children.,5.00,Great classic that everyone should read,1384905600,"11 20, 2013"
|
|
4
|
+
A19N3FCQCLJYUA,"000100039X",Amazon Customer,"[1, 1]","I discovered The Prophet fifty years ago in college and have read it dozens of times since then. Now, in addition to my beat up hard copy, I have a portable e-copy. If you were looking for an example of an intelligently designed (pun intended) book of spiritual guidance, this would be it. It doesn""t care how you picture, name or define "God" or whether you give him a gender and a personality. It just cuts to the heart of how to live and how to relate to others. If Jesus and the Buddha teamed up to write a book, it might come out like this.When I first read it, I found some passages difficult to grasp. Looking back, I now think that it was not because they were hard to understand, but because I did not want to hear gently spoken, intelligently phrased ideas that contradicted my own. Now, if I could have only one book, this would probably be it.",5.00,A book everyone "should" read,1358899200,"01 23, 2013"
|
|
5
|
+
A5E9TSD20U9PR,"000100039X",April,"[0, 0]","For those who don""t know Gibran, get to know his work. The Prophet is a must read. His outlook on life is truly an inspiring guide on how to approach major life decisions. This is a relationship with a man""s work you won""t regret having.",5.00,Just beautiful.,1377475200,"08 26, 2013"
|
|
6
|
+
A1BM81XB4QHOA3,"000100039X","""Ahoro Blethends """"Seriously""""""","[0, 0]","This book provides a reflection that you can apply to your own life.And, a way for you to try and assess whether you are truly doing the right thing and making the most of your short time on this plane.",5.00,Must Read for Life Afficianados,1390003200,"01 18, 2014"
|
|
7
|
+
A26GKZPS079GFF,"000100039X",Areej,"[2, 3]","I would have to say that this is the best book I""ve ever read.. I could feel every word deep in my heart everytime, of the many times I""ve read it! I would never get enough of it! its a treasure..",5.00,Touches my heart.. again and.. again...,982972800,"02 24, 2001"
|
|
8
|
+
A1MOSTXNIO5MPJ,"000100039X",Alan Krug,"[0, 0]","I first read THE PROPHET in college back in the 60""s. The book had a revival as did anything metaphysical in the turbulent 60""s. It had a profound effect on me and became a book I always took with me. After graduation I joined the Peace Corps and during stressful training in country (Liberia) at times of illness and the night before I left, this book gave me great comfort. I read it before I married, just before and again after my children were born and again after two near fatal illnesses. I am always amazed that there is a chapter that reaches out to you, grabs you and offers both comfort and hope for the future.Gibran offers timeless insights and love with each word. I think that we as a nation should read AND learn the lessons here. It is definitely a time for thought and reflection this book could guide us through.",5.00,Timeless for every good and bad time in your life.,1317081600,"09 27, 2011"
|
|
9
|
+
A1TT4CY55WLHAR,"000100039X",anonymous,"[0, 0]","I have the 1972 version, bought in 1974. The 1972 version originally had a dust jacket but my dust jacket is long gone. This particular rendition has had many re-printings, for a reason: it""s very popular. The textured paper, old-style typography, and leather cover are better than a plain-old paperback. The size is diminutive, which is perfect for this book.",5.00,"textured paper, old-style typography, and leather cover",1342396800,"07 16, 2012"
|
|
10
|
+
A3FFNE1DR5SI1W,"000100039X",A. Morelli,"[1, 1]","Can""t say enough about Kahlil Gibran""s work among this piece. Everybody in the whole world should read this! There is almost too much to take in, really appreciate and put towards our daily lives. In my opinion, it is just one of the most beautiful literature pieces ever written. Would recommend to as a gift for anyone spiritual/poetic/philosophy/educational piece or just something to enjoy here and there. 5 stars for sure!",5.00,phenomenal piece of literature!,1340755200,"06 27, 2012"
|
|
11
|
+
A1340OFLZBW5NG,"000100039X",Amazon Customer,"[0, 0]",I LOVE this book... his writing seems to just flow from page to page. I get something different from this book each time I read it..,5.00,Perhaps the greatest book that I have ever read,1231977600,"01 15, 2009"
|
|
12
|
+
A29TRDMK51GKZR,"000100039X",Alpine Plume,"[0, 0]","Deep, moving dramatic verses of the heart and soul.Truths of ancient wisdom from a true and romantic poet.Relevant for all eternity.",5.00,Such Beauty,1383436800,"11 3, 2013"
|
|
13
|
+
A3FI0744PG1WYG,"000100039X","""Always Reading """"tkm""""""","[0, 0]","This is a timeless classic. Over the years I""ve given it as a gift more times than I can count, and will continue to do so. Addresses real life issues in a beautiful way and makes us reexamine our own attitude about how we see what happens in our lives. So easy to read over and over.",5.00,The Prophet,1390953600,"01 29, 2014"
|
|
14
|
+
A2XQ5LZHTD4AFT,"000100039X",Alaturka,"[7, 9]","A timeless classic. It is a very demanding and assuming title, but Gibran backs it up with some excellent style and content. If he had the means to publish it a century or two earlier, he could have inspired a new religion.From the mouth of an old man about to sail away to a far away destination, we hear the wisdom of life and all important aspects of it. It is a messege. A guide book. A Sufi sermon. Much is put in perspective without any hint of a dogma. There is much that hints at his birth place, Lebanon where many of the old prophets walked the Earth and where this book project first germinated most likely.Probably becuase it was written in English originally, the writing flows, it is pleasant to read, and the charcoal drawings of the author decorating the pages is a plus. I loved the cover.",5.00,A Modern Rumi,1033948800,"10 7, 2002"
|
|
15
|
+
A2LBBQHYLEHM7P,"000100039X","""Amazon Customer """"Full Frontal Nerdity""""""","[0, 0]","An amazing work. Realizing extensive use of Biblical imagery and sentence structure, "The Prophet" by Khalil Gibran is a literary classic. Influencing the Free Love movement of the 1960""s, Gibran""s master work explores themes of love, longing and loss.",5.00,A Modern Classic,1379808000,"09 22, 2013"
|
|
16
|
+
AENNW2G826191,"000100039X",Ashish A,"[1, 4]","Its a thin book, very readable and has interesting 1-2 page thoughts on various entities like anger, children, religion, speech, silence and its COOL.........reading. Ofcourse if one needs to imbibe the thoughts of the author, it has to be consumed slowly and perhaps revisited but leaves you pretty heady and clear about certain things.",3.00,Good Read,963446400,"07 13, 2000"
|
|
17
|
+
A2X4HE21JTAL98,"000100039X",Antiquarian,"[3, 5]","Anything I""ve read by Gibran is, in my mind, flawless. This, the most famous of his works, is no exception. It is simple, yet deep; honest and profound; moving and inspirational. Gibran""s work is one of a kind, and can be far more encouraging and moving than any self-help program or therapy or anything like that. The poetic style, the aphorisms, the parables, the almost biblical feel, are all just what over-worked, over-stressed, modern and spiritually starved worldly people need.",5.00,Flawless,1132099200,"11 16, 2005"
|
|
18
|
+
A3V1MKC2BVWY48,"000100039X",Alex Dawson,"[0, 0]","Reading this made my mind feel like a still pool of water, cool and quiet in a mossy grotto. It""s direct and simple wisdom has a depth of complexity that takes a quiet day to sink in, leaving you at peace. It is best to set time aside for it, relax, absorb, and let it softly clear your mind.",5.00,This book will bring you peace,1390780800,"01 27, 2014"
|
|
19
|
+
A1KQ80Y692CDOI,"000100039X",Atown,"[2, 9]","I read this about a year ago and can""t recall a great deal of the book. From what I do recall it was like a poem all the way through. While the writing was beautiful, I found it ambiguous and befuddled with meaning that I could not identify with. When Gibran speaks of God, I cannot identify because I have since abandoned those philosophies. It is thus difficult to revisit them in this book. I have the feeling a may have missed something great about this book. Indeed, I pulled wisdom from parts, but rather than go back and read it again, for now, perhaps I will move on to another of the many books out there that are enlightening and worth reading. Someday, I would like to read this again and dig deeper.",2.00,Eloquent,1206057600,"03 21, 2008"
|
|
20
|
+
AUTNO7VDY4H4A,"000100039X",Austin guy,"[0, 0]","Loved this book since first I read it, years gone by. Purchased this copy for a friend who has not ever read Gibran.",5.00,"A great book, buying it for a friend.",1371427200,"06 17, 2013"
|
|
21
|
+
A2WVHIRDMLM82E,"000100039X",Amazon Customer,"[0, 0]","This book has so much you can take out of it to use in your real life. Amazing, and one of my favorite reads of all time.",5.00,Amazing,1394928000,"03 16, 2014"
|
|
22
|
+
A2I35JB67U20C0,"000100039X",Amazon Customer,"[0, 0]","When I was in college in the 70""s this book had a revival and I did not read it then. Recently a friend (who is 90) and I were talking about work and she said: "work is love made visible," and told me it was from the Prophet. I though that was so beautiful I got the book and was not disappointed.You see, if you have ideas and you do not realize them, then they are nothing, and if your ideas do not come from love and joy, then they are bitter and what they produce will be bitter, but if they flow from love and joy, then their realization will be love and joy, thus work is love made visible.He says it WAY better that I do and says much more in just a few paragraphs. But as you can see from the example, what he says is not religious, but positive ways of looking at things. Since I rediscoverd the book I have given away many copies and everyone I have given it to sincerly thanked me.",5.00,Everyone should have this book,983318400,"02 28, 2001"
|
|
23
|
+
A12387207U8U24,"000100039X",Alex,"[0, 0]","As you read, Gibran""s poetry brings spiritual and visual beauty to life within you. Gibran is justly famous for rich metaphors that brilliantly highlight the pursuit of Truth and Goodness amidst all the darkness and light of human nature.",5.00,Graet Work,1206662400,"03 28, 2008"
|
|
24
|
+
A2S166WSCFIFP5,"000100039X","""adead_poet@hotmail.com """"adead_poet@hotmail.com""""""","[0, 2]","This is one my must have books. It is a masterpiece of spirituality. I""ll be the first to admit, its literary quality isn""t much. It is rather simplistically written, but the message behind it is so powerful that you have to read it. It will take you to enlightenment.",5.00,close to god,1071100800,"12 11, 2003"
|
|
25
|
+
A27ZH1AQORJ1L,"000100039X","""anybody else or """"amanuet""""""","[3, 3]","This book is everything that is simple, delicate, true, and beautiful.I have read few books so touching and enlightening; "The Prophet" is a true masterpiece that has that feeling of ancient wisdom in it. The wisdom of the text is gentle, yet insistent, it lets you understand things you""ve always known.My feelings defy description.",5.00,Enchanting,1066003200,"10 13, 2003"
|
|
26
|
+
ARDQ9KNB8K22N,"000100039X",Anwar,"[1, 1]","Cool book, I really like the quality of the production. Black clothbound with gold embossing and nice paper, looks to be cotton rag. I am proud to include it in my collection. Intrigueing story full of the sort of passion that does not cloud the mind or divert truth but instead is revealing and living. Very readable, the stories are short and highly economic so that one is likely to read for only a minute or two until something insightful is revealed. It is full of timeless truths which are of lasting value to the reader and inform life. The language and delivery is familiar yet of a quality that is penetrating in a similar way as it might be listening to a surmon by Jesus. I give it 5 stars. I considered giving only 4 stars because the format is fairly predictable but I have decided that this quality is actually a strength as one can pick up the book at any point and continue until the end...and then start over for that matter. Excellent for busy people or commuters!",5.00,"""""""The Prophet"""" is cool""",1329264000,"02 15, 2012"
|
|
@@ -14,5 +14,16 @@
|
|
|
14
14
|
"petal_length" : "float",
|
|
15
15
|
"petal_width" : "float",
|
|
16
16
|
"species": "integer"
|
|
17
|
+
},
|
|
18
|
+
"amazon_reviews_25": {
|
|
19
|
+
"rev_id": "VARCHAR(64000)",
|
|
20
|
+
"aid": "VARCHAR(64000)",
|
|
21
|
+
"rev_name": "VARCHAR(64000)",
|
|
22
|
+
"helpful": "VARCHAR(64000)",
|
|
23
|
+
"rev_text": "VARCHAR(64000)",
|
|
24
|
+
"rating": "DECIMAL(10,2)",
|
|
25
|
+
"prodsummary": "VARCHAR(64000)",
|
|
26
|
+
"unixrevtime": "BIGINT",
|
|
27
|
+
"revtime": "VARCHAR(64000)"
|
|
17
28
|
}
|
|
18
29
|
}
|
|
@@ -152,6 +152,22 @@
|
|
|
152
152
|
"item" : "varchar(20)",
|
|
153
153
|
"sku" : "integer",
|
|
154
154
|
"category" : "varchar(20)"
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
},
|
|
156
|
+
"medical_readings": {
|
|
157
|
+
"patient_id": "BIGINT",
|
|
158
|
+
"record_timestamp": "timestamp",
|
|
159
|
+
"glucose": "BIGINT",
|
|
160
|
+
"blood_pressure": "BIGINT",
|
|
161
|
+
"insulin": "BIGINT",
|
|
162
|
+
"diabetes_pedigree_function": "FLOAT",
|
|
163
|
+
"outcome": "BIGINT"
|
|
164
|
+
},
|
|
165
|
+
"patient_profile": {
|
|
166
|
+
"patient_id": "BIGINT",
|
|
167
|
+
"record_timestamp": "timestamp",
|
|
168
|
+
"pregnancies": "BIGINT",
|
|
169
|
+
"age": "BIGINT",
|
|
170
|
+
"bmi": "FLOAT",
|
|
171
|
+
"skin_thickness": "FLOAT"
|
|
172
|
+
}
|
|
157
173
|
}
|
|
@@ -23,7 +23,7 @@ def DataRobotPredict(modeldata=None, newdata=None, accumulate=None, model_output
|
|
|
23
23
|
Required Argument.
|
|
24
24
|
Specifies the name(s) of input teradataml DataFrame column(s) to
|
|
25
25
|
copy to the output.
|
|
26
|
-
Types: str OR list of Strings (str)
|
|
26
|
+
Types: str OR list of Strings (str) OR Feature OR list of Features
|
|
27
27
|
|
|
28
28
|
model_output_fields:
|
|
29
29
|
Optional Argument.
|
|
@@ -108,7 +108,7 @@ def DataRobotPredict(modeldata=None, newdata=None, accumulate=None, model_output
|
|
|
108
108
|
for each argument that accepts teradataml DataFrame as
|
|
109
109
|
input and can be accessed as:
|
|
110
110
|
* "<input_data_arg_name>_partition_column" accepts str or
|
|
111
|
-
list of str (Strings)
|
|
111
|
+
list of str (Strings) or PartitionKind
|
|
112
112
|
* "<input_data_arg_name>_hash_column" accepts str or list
|
|
113
113
|
of str (Strings)
|
|
114
114
|
* "<input_data_arg_name>_order_column" accepts str or list
|
|
@@ -24,7 +24,7 @@ def DataikuPredict(modeldata=None, newdata=None, accumulate=None, model_output_f
|
|
|
24
24
|
Specifies the name(s) of input teradataml DataFrame column(s) to
|
|
25
25
|
copy to the output. By default, the function copies all input
|
|
26
26
|
teradataml DataFrame columns to the output.
|
|
27
|
-
Types: str OR list of Strings (str)
|
|
27
|
+
Types: str OR list of Strings (str) OR Feature OR list of Features
|
|
28
28
|
|
|
29
29
|
model_output_fields:
|
|
30
30
|
Optional Argument.
|
|
@@ -86,6 +86,45 @@ def DataikuPredict(modeldata=None, newdata=None, accumulate=None, model_output_f
|
|
|
86
86
|
Default Value: False
|
|
87
87
|
Types: bool
|
|
88
88
|
|
|
89
|
+
**generic_arguments:
|
|
90
|
+
Specifies the generic keyword arguments SQLE functions accept. Below
|
|
91
|
+
are the generic keyword arguments:
|
|
92
|
+
persist:
|
|
93
|
+
Optional Argument.
|
|
94
|
+
Specifies whether to persist the results of the
|
|
95
|
+
function in a table or not. When set to True,
|
|
96
|
+
results are persisted in a table; otherwise,
|
|
97
|
+
results are garbage collected at the end of the
|
|
98
|
+
session.
|
|
99
|
+
Default Value: False
|
|
100
|
+
Types: bool
|
|
101
|
+
|
|
102
|
+
volatile:
|
|
103
|
+
Optional Argument.
|
|
104
|
+
Specifies whether to put the results of the
|
|
105
|
+
function in a volatile table or not. When set to
|
|
106
|
+
True, results are stored in a volatile table,
|
|
107
|
+
otherwise not.
|
|
108
|
+
Default Value: False
|
|
109
|
+
Types: bool
|
|
110
|
+
|
|
111
|
+
Function allows the user to partition, hash, order or local
|
|
112
|
+
order the input data. These generic arguments are available
|
|
113
|
+
for each argument that accepts teradataml DataFrame as
|
|
114
|
+
input and can be accessed as:
|
|
115
|
+
* "<input_data_arg_name>_partition_column" accepts str or
|
|
116
|
+
list of str (Strings) or PartitionKind
|
|
117
|
+
* "<input_data_arg_name>_hash_column" accepts str or list
|
|
118
|
+
of str (Strings)
|
|
119
|
+
* "<input_data_arg_name>_order_column" accepts str or list
|
|
120
|
+
of str (Strings)
|
|
121
|
+
* "local_order_<input_data_arg_name>" accepts boolean
|
|
122
|
+
Note:
|
|
123
|
+
These generic arguments are supported by teradataml if
|
|
124
|
+
the underlying SQL Engine function supports, else an
|
|
125
|
+
exception is raised.
|
|
126
|
+
|
|
127
|
+
|
|
89
128
|
RETURNS:
|
|
90
129
|
Instance of DataikuPredict.
|
|
91
130
|
Output teradataml DataFrame can be accessed using attribute
|
|
@@ -38,7 +38,7 @@ def H2OPredict(modeldata=None, newdata=None, accumulate=None, model_output_field
|
|
|
38
38
|
Required Argument.
|
|
39
39
|
Specifies the name(s) of input teradataml DataFrame column(s)
|
|
40
40
|
to copy to the output DataFrame.
|
|
41
|
-
Types: str OR list of Strings (str)
|
|
41
|
+
Types: str OR list of Strings (str) OR Feature OR list of Features
|
|
42
42
|
|
|
43
43
|
model_output_fields:
|
|
44
44
|
Optional Argument.
|
|
@@ -147,7 +147,7 @@ def H2OPredict(modeldata=None, newdata=None, accumulate=None, model_output_field
|
|
|
147
147
|
for each argument that accepts teradataml DataFrame as
|
|
148
148
|
input and can be accessed as:
|
|
149
149
|
* "<input_data_arg_name>_partition_column" accepts str or
|
|
150
|
-
list of str (Strings)
|
|
150
|
+
list of str (Strings) or PartitionKind
|
|
151
151
|
* "<input_data_arg_name>_hash_column" accepts str or list
|
|
152
152
|
of str (Strings)
|
|
153
153
|
* "<input_data_arg_name>_order_column" accepts str or list
|