I am trying to insert new data values into an existing table in Teradata from python. I was able to establish the connection but then it gave me this error: [Teradata database] (-2621) Bad character in format or data of df.columnX')
Below is the value I am trying to load in:
Column A Column B Column X
IH78 0.00 39
SK901 0.00 NaN
Code that I used (ref: Connecting Python with Teradata using Teradata module):
import teradata
import pandas as pd
import numpy as np
udaExec = teradata.UdaExec (appName="test", version="1.0", logConsole=False)
with udaExec.connect(method="odbc",system="DBName", username="UserName",
password="Password", driver="DriverName") as connect:
#We can divide our huge_df to small chuncks. E.g. 100 churchs
chunks_df = np.array_split(huge_df, 100)
#Import chuncks to Teradata
for i,_ in enumerate(chunks_df):
data = [tuple(x) for x in chuncks_df[i].to_records(index=False)]
connect.executemany("INSERT INTO DATABASE.TABLEWITH5COL values(?,?,?)",data,batch=True)
- type in python for Column X: Int32
- type in teradata for Column X: Integer
I can load the first line in with no issue at all but it is the second one that returns me an error message. Thank you all and any help would be appreciated!