I am a newby to SQL and data management, your help is greatly appreciated.
Task:
- Extract from API vast amounts of data into Python DataFrame
- Handle some data errors
- Send in its entirety to SQL server using MS SQL Server Management Studio
Currently, I am having to .format every row of the dataframe individually to a SQL statement within a string and then execute it in SQL. As explained on the MS website:
This is extremely slow and is very prone to error due to the number of columns.
e.g.
sqlcreateconnection()
for page in api pages:
for item in pages:
sqlStatementList.append("exec [dbo].[SP_Transactions] '{1}','{2}','{3}','{4}','{5}','{6}','{7}'...
.format(col1,col2,col3....
sql_executelist(sqlStatementList)
Is there a faster way?
Thanks!!