I read into a dataframe from an Excel file of 71k rows (via pandas.read_excel()) and then want to insert it into a database on a local SQL Server via turbodbc.
Code:
query = 'INSERT INTO сonnTable (ID, SiteRootID, ElementID, ElementType, Username, URL, DateTime, Type, Source, SourceName, Details, AppID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
cursor.executemany(query, [df.index.values+1, df['SiteID'].values, df['ElementID'].values,df['ElementType'].values,df['UserID'].values,df['Location'].values,df['DateTimeGMT'].values,df['Event'].values,df['Source'].values,df['SourceName'].values,df['EventData'].values,df['AppID'].values])
When I execute the query, it throws out the following error:
turbodbc.exceptions.DatabaseError: Invalid number of parameters (expected 12, got 71625)
Where's the cause of this error? I'm a newbie and this is my 1st attempt to perform such a task.