Python Forum
write csv data into teradata table - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: write csv data into teradata table (/thread-16055.html)



write csv data into teradata table - sandy - Feb-13-2019

Hi All,
I am writing csv data into Teradata table:
Using below code .. and getting error..

import csv
with open(r"C:\Users\sandy\Desktop\venmo_output1.CSV",'r')as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        #print(row['TRAN_STMT_DESC'],row['Sum(tran_amt)'], row['Sum(tran_cnt)'])
        curs.execute(""""INSERT INTO PYTHON_LKP(TRAN_STMT_DESC,tran_amt, tran_cnt )VALUES(?,?,?)""",row)
here goes my error:
Error:
ProgrammingError: ('42000', '[42000] [Teradata][ODBC Teradata Driver][Teradata Database] String not terminated before end of text. (-3760) (SQLPrepare)')
My csv file generated from python using to_csv function.
data is like this in csv file :
Output:
TRAN_STMT_DESC tran_amt tran_cnt VENMO 100 1 VENMO 30 1 VENMO 8 1
please can any one help me on this

thanks