Jul-18-2017, 02:54 AM
(This post was last modified: Jul-18-2017, 02:55 AM by olgethorpe.)
Hi there all
I am using the psycopg2 module for postgresql and I keep receiving an error in my SQL statement saying there is a syntax error at or near "INSERT INTO. I've stared at it forever and I just can't seem to find it, maybe someone can help me? Thanks!
The connection is working fine between the database, and dates is a list of dates also autocommit is set to True
I am using the psycopg2 module for postgresql and I keep receiving an error in my SQL statement saying there is a syntax error at or near "INSERT INTO. I've stared at it forever and I just can't seem to find it, maybe someone can help me? Thanks!
The connection is working fine between the database, and dates is a list of dates also autocommit is set to True
def addToDatabase(self, dates):
.
.
.
sql = """INSERT INTO "%s" ("Date") VALUES(%s);"""
for date in range(0, len(dates)):
data = (ticker, dates[date])
cursor.execute(sql, data)
.
.
.
