Python Forum
Import data from excel to Teradata
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import data from excel to Teradata
#1
Hello,

I am trying to import data from excel file into teradata table. I can connect to teradata and read the excel file but i was wondering how can i import the data from excel to table

This is what i have for now. Code is reading the excel file and creating the table.

import pandas as pd
import numpy as np
import datetime
import pyodbc
import os.path, time
import platform
import glob
import codecs
import csv
from pathlib import Path
import tkinter as tk
from tkinter import filedialog
import teradata

df = pd.read_excel (r'C:\Users\sss\Documents\Adjustments.xls', sheet_name='Adjustments')

print (df)

host,username,password = 't33.serv.hhh.com','user', 'password'
#Make a connection
udaExec = teradata.UdaExec (appName="test", version="1.0", logConsole=False)


with udaExec.connect(method="odbc",system=host, username=username,
                            password=password, driver="Teradata Database ODBC Driver 16.20") as connect:

    
    query1="DROP TABLE astertest.Adjustments"

 
with udaExec.connect(method="odbc",system=host, username=username,
                            password=password, driver="Teradata Database ODBC Driver 16.20") as connect:
    connect.execute("DROP TABLE astertest.Adjustments;")
    connect.commit()
    connect.execute("CREATE TABLE astertest.Adjustments (col1 varchar(100), col2 varchar(100), col3 varchar(100))")
    connect.commit()
Reply
#2
see: https://community.teradata.com/t5/Databa...light/true#
Reply
#3
Hi Larz,

the link you provided explain how to do it using SQLA. I want to do this using python
Reply
#4
Does anyone have solution how data from python can be imported to Teradata?

Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Copy data from Excel and paste into Discord (Midjourney) Joe_Wright 4 2,034 Jun-06-2023, 05:49 PM
Last Post: rajeshgk
  Plot a pandas data fram via pyqtgraph with an modul import and qt designer widget Nietzsche 0 841 May-29-2023, 02:42 PM
Last Post: Nietzsche
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,813 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,089 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Python 3.11 data import question love0715 2 806 Mar-05-2023, 06:50 PM
Last Post: snippsat
  Import XML file directly into Excel spreadsheet demdej 0 837 Jan-24-2023, 02:48 PM
Last Post: demdej
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 1,874 Dec-12-2022, 08:22 PM
Last Post: jh67
  Trying to Get Arduino sensor data over to excel using Python. eh5713 1 1,702 Dec-01-2022, 01:52 PM
Last Post: deanhystad
  Appending a row of data in an MS Excel file azizrasul 3 1,171 Nov-06-2022, 05:17 PM
Last Post: azizrasul
  Moving data from one Excel to another and finding maximum profit azizrasul 7 1,462 Oct-06-2022, 06:13 PM
Last Post: azizrasul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020