The problem is in the way you are reading the csv file.
In the following passage:
csv_data = csv.reader('/Users/eduardoaandrad/Dropbox/Desenv/Script/csv/carga_teste.csv',delimiter=';')
The reported file is being interpreted as a string, literally, so its loop generates a completely different output than expected in the SQL statement.
See this isolated CSV reading snippet:
import csv
csv_data = csv.reader('carga_teste.csv',delimiter=';')
for row in csv_data:
print(type(row), row)
Even if the file does not exist, the code will run displaying the file name in the console, generating a list for each letter:
See online the result: https://repl.it/repls/WetShyRadius
To fix this situation, you should open the file with the function open
and the return of function open
will be the parameter for the reader
of csv
:
import csv
with open("carga_teste.csv") as csvFile:
csv_data = csv.reader(csvFile, delimiter=';')
for row in csv_data:
print(row)
See the difference online: https://repl.it/repls/DeadInnocentOutlier
I performed these corrections in the code and the data was correctly entered.
Documentation: https://docs.python.org/3/library/csv.html