{"id":18419692,"url":"https://github.com/teradata/techbytes-using-python-with-vantage","last_synced_at":"2025-04-13T09:14:38.049Z","repository":{"id":146378416,"uuid":"371434313","full_name":"Teradata/techbytes-using-python-with-vantage","owner":"Teradata","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-08T16:10:08.000Z","size":26848,"stargazers_count":4,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T09:14:17.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Teradata.png","metadata":{"files":{"readme":"README-TBv2_Py.txt","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-27T16:15:18.000Z","updated_at":"2023-09-18T10:42:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"4363fe14-f8b6-4eb8-8671-ce7d55553266","html_url":"https://github.com/Teradata/techbytes-using-python-with-vantage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teradata%2Ftechbytes-using-python-with-vantage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teradata%2Ftechbytes-using-python-with-vantage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teradata%2Ftechbytes-using-python-with-vantage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teradata%2Ftechbytes-using-python-with-vantage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Teradata","download_url":"https://codeload.github.com/Teradata/techbytes-using-python-with-vantage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248688550,"owners_count":21145766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T04:17:56.159Z","updated_at":"2025-04-13T09:14:38.022Z","avatar_url":"https://github.com/Teradata.png","language":"HTML","readme":"Teradata TechBytes series: Using Python with Teradata Vantage\nVersion 2.0\n\n--------------------------------------------------------------------------------\nREADME-TBv2_Py:\nREADME file for Using Python with Teradata Vantage TechBytes Series ZIP bundle\nCopyright (c) 2021 by Teradata\nLicensed under BSD; see \"license.txt\" file in the bundle root folder.\n================================================================================\n\n\n1. General Introduction\n--------------------------------------------------------------------------------\n\nThe Using Python with Teradata Vantage TechBytes is a demo series in 4 parts\nthat demonstrates Python analytic capabilities in Teradata Vantage via the\nTeradata Package for Python teradataml.\nThe demo utilizes a core use case to predict the propensity of a financial\nservices customer base to open a credit card account. The demo comprises of\nthe following parts:\n- Part 1 has an Introduction, information about connecting to a Vantage Advanced\n  SQL Engine Database with teradataml, and exhibits some basic operations.\n- Part 2 demonstrates Data Exploration and Transformations, and how to build\n  an Analytic Data Set (ADS).\n- Part 3 demonstrates Modeling with Vantage Analytic Functions and the Model\n  Cataloging feature.\n- Part 4 In-Database scripting with the SCRIPT Table Operator and the teradataml\n\tMap functions.\n\nThe present Version 2.0 of this TechBytes series covers features in the Teradata\nClient Package for Python up to teradataml v.17.0.0.3.\n\nThe Using Python with Teradata Vantage TechBytes series videos are available\non the Teradata YouTube channel. The present file is part of a bundle that\noffers the entire code for Parts 1-4 together with the necessary input data\nso that you can reproduce the demo analyses.\n\nTo reproduce Using Python with Teradata Vantage TechBytes series demo analyses\nwith the present bundle, you will need the following:\na. A Python interpreter (minimum supported version is 3.5.0) installed on a\n   client machine with the ability to install add-on libraries from one of the\n   language's repositories.\nb. Software to view and edit the accompanying Python notebooks in this demo.\nc. The Teradata Package for Python teradataml, which is available on the PyPI\n   repository.\nd. Access to a Teradata Vantage system that to the very minimum carries the\n   Advanced SQL Engine Database 16.20.16.01 or later versions.\n   - To execute the demo Part 3 in its entirety, the target Vantage\n     system must also feature a Machine Learning Engine component, too.\n   - To execute the demo Part 4, the target Vantage system must be equipped\n     with the \"teradata-python\" and \"teradata-python-addons\" packages.\nAdditional details and any case-specific requirements are provided as needed\nin the demo files.\n\n\n2. Information\n--------------------------------------------------------------------------------\n\nThis compressed container holds synthetic data and accompanies the \"Using\nPython with Teradata Vantage\" TechBytes demo so you can try out hands-on\nthe code examples across the aforementioned parts of this TechBytes demo.\n\nThe demo files are Python notebooks with the code, HTML printouts of completed\ncode execution, short presentations about each demo part, and the demo data.\nThe notebooks are anonymized; that is, you need to replace the names of target\nsystems, databases, and file paths as needed to execute the code on your\nhardware. The HTML printouts illustrate sample code execution with results for\nreference.\n\nThe demo data is a collection of 3 data sets in the Inputs/Data/ folder, namely:\n- Accounts\n- Customer\n- Transactions\nthat you will need to upload to your target Vantage system Advanced SQL Engine\nbefore you can run the TechBytes examples.\n- The data are provided in the following comma-separated CSV files:\n  \"Accounts.csv\"         ( 1.2 MB)\n  \"Customer.csv\"         ( 0.4 MB)\n  \"Transactions.csv.zip\" (24.1 MB; contains \"Transactions.csv\" of size 78.3 MB)\n- Before taking any further action, uncompress the archive file named\n  \"Transactions.csv.zip\" to extract the data file \"Transactions.csv\".\n- Each data file corresponds to one table.\n- The first row in each data file is a header. The data start in the second row.\nYou can upload the datasets to the target system in any way that is most\nconvenient for you. Two commonly used techniques you can try are the following:\n\nUpload option 1: Use the Teradata Studio software (available from the website\nhttp://downloads.teradata.com).\na. Launch the software, and establish a connection to the target Vantage\n   system.\nb. Then navigate in the left pane to the desired database where you wish\n   to create the new tables from the data sets.\nc. Click on the database name to expand the list of objects in it.\nd. Right-click on the \"Tables\" in the desired target database, and select\n   \"Teradata\" \u003e \"Data Transfer\".\n   1. This action will launch a Data Transfer Wizard window. Use the\n      \"External File\" source option that uses the Smart Load utility, and\n      click on the \"Launch\" button.\n   2. The window will switch to an \"Import Data\" window where you will need\n      to navigate to the input data file location on your computer.\n   3. Ensure the \"Column Labels in First Row\" button is checked.\n   4. Specify \"Comma\" under \"File Options\" \u003e \"Column Delimiter\".\n   5. Specify \"None\" under \"File Options\" \u003e \"Character String Delimiter\".\n   6. Specify \"Unix, Linux, Mac OS X v10.0 and above (LF)\" under\n      \"File Options\" \u003e \"Line Separator\". If the software should suggest\n      selecting a different option, then proceed to do so.\n   7. Push the \"Finish\" button in the bottom.\ne. The following screen is the \"Table Column Data Types\". It displays a sample\n   of the data and their interpreted types in the manner Teradata Studio plans\n   to import them in the database. Use the information in the following\n   Section 3 \"Table DDL details for the data\" to make any changes as needed\n   on this screen. For instance, upon importing the \"Accounts.csv\" data set,\n   the following steps were taken:\n   1. The Primary Index filed needed to be set to \"Unique\".\n   2. The table type specification (set/multiset) can be specified as desired.\n   3. The \"acct_nbr\" column was interpreted as BIGINT type by Teradata Studio.\n      By clicking in the type field, a Column Type Dialog pop-up window\n      launches, where the column type can be explicitly modified. In our case,\n      the \"acct_nbr\" column type needed to be changed to VARCHAR with arguments\n      \"Size\" set to the value 18, and \"Character Set\" set to \"Latin\". Also,\n      per the specification in Section 3 below, the \"Primary Index\" button\n      was checked for the \"acct_nbr\" column, too. When done, close the Column\n      Type Dialog window by pushing the \"OK\" button to return to the \"Table\n      Column Data Types\" screen. Repeat the present step as necessary for all\n      columns in the table.\n   When done, push the \"Next\" button in the bottom of the \"Table Column Data\n   Types\" screen.\nf. The following \"SQL Preview\" screen displays a preview of the table DDL based\n   on your preceding input. Ensure this preview matches the specifications\n   provided in Section 3 \"Table DDL details for the data\" below.\ng. Push the \"Finish\" button. This will confirm for you that the table has been\n   created in the target database, and the pop-up wizard window closes.\nh. The data upload begins automatically. Wait until the upload is complete.\n   The uploading protocol is JDBC-based, so you can expect relatively slow\n   uploads. Regardless, the uploads are expected to be quite fast the small\n   datasets of this demo, except maybe for the rather larger \"Transactions.csv\"\n   dataset.\ni. The table schemas will be interpreted automatically. After the upload,\n   verify in Teradata Studio that the tables are present in the desired\n   destination locations.\n\nUpload option 2: Use the Fastload utility.\nIf your client is equipped with the Teradata Fastload utility, then you can use\nthe fastload script files that accompany the data files in the present bundle\nto efficiently upload the data in the CSV files to a target Vantage system\nAdvanced SQL Engine. Please read the fastload script files in the Inputs/Data/\nfolder for detailed instructions about using them.\nNote: A \"Customer2.fastload\" fastload script is also provided to create a copy\n      of the \"Customer\" table, by uploading the same data in the \"Customer.csv\"\n      file to a table \"Customer2\". Use this fastload script, too, if you would\n      like to replicate the operations in Part 1 of the present demo.\n\n\n3. Table DDL details for the data\n--------------------------------------------------------------------------------\n\n- Accounts table DDL, based on the data in the \"Accounts.csv\" file\n\nCREATE SET TABLE Accounts ,FALLBACK ,\n     NO BEFORE JOURNAL,\n     NO AFTER JOURNAL,\n     CHECKSUM = DEFAULT,\n     DEFAULT MERGEBLOCKRATIO,\n     MAP = TD_MAP1\n     (\n      acct_nbr VARCHAR(18) CHARACTER SET LATIN NOT CASESPECIFIC,\n      cust_id INTEGER,\n      acct_type CHAR(2) CHARACTER SET LATIN NOT CASESPECIFIC,\n      account_active CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,\n      acct_start_date DATE FORMAT 'YY/MM/DD',\n      starting_balance DECIMAL(11,3),\n      ending_balance DECIMAL(11,3))\nUNIQUE PRIMARY INDEX ( acct_nbr );\n\n\n- Customer table DDL, based on the data in the \"Customer.csv\" file.\n  A corresponding DDL is used to create the set table Customer2, too.\n\nCREATE SET TABLE Customer ,FALLBACK ,\n     NO BEFORE JOURNAL,\n     NO AFTER JOURNAL,\n     CHECKSUM = DEFAULT,\n     DEFAULT MERGEBLOCKRATIO,\n     MAP = TD_MAP1\n     (\n      cust_id INTEGER,\n      income DECIMAL(15,1),\n      age INTEGER,\n      years_with_bank INTEGER,\n      nbr_children INTEGER,\n      gender CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,\n      marital_status CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,\n      postal_code CHAR(5) CHARACTER SET LATIN NOT CASESPECIFIC,\n      state_code CHAR(2) CHARACTER SET LATIN NOT CASESPECIFIC)\nUNIQUE PRIMARY INDEX ( cust_id );\n\n\n- Transactions table DDL, based on the data in the \"Accounts.csv\" file\n\nCREATE SET TABLE Transactions ,FALLBACK ,\n     NO BEFORE JOURNAL,\n     NO AFTER JOURNAL,\n     CHECKSUM = DEFAULT,\n     DEFAULT MERGEBLOCKRATIO,\n     MAP = TD_MAP1\n     (\n      tran_id INTEGER,\n      acct_nbr VARCHAR(18) CHARACTER SET LATIN NOT CASESPECIFIC,\n      tran_amt DECIMAL(9,2),\n      principal_amt DECIMAL(15,2),\n      interest_amt DECIMAL(11,3),\n      new_balance DECIMAL(9,2),\n      tran_date DATE FORMAT 'YY/MM/DD',\n      tran_time INTEGER,\n      channel CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,\n      tran_code CHAR(2) CHARACTER SET LATIN NOT CASESPECIFIC)\nUNIQUE PRIMARY INDEX ( tran_id ,acct_nbr );\n\n\n4. Changelog\n--------------------------------------------------------------------------------\n\nVersion    Date            Notes\n2.0        May 2021        Overhauled version for Python\n1.1        April 2020      Revised code demos with updated libraries features\n1.0        October 2019    First release (as \"R and Python TechBytes\")\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteradata%2Ftechbytes-using-python-with-vantage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteradata%2Ftechbytes-using-python-with-vantage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteradata%2Ftechbytes-using-python-with-vantage/lists"}