Hi, I'm a bit stuck on this "INSERT INTO" syntax error. I have no idea why it's not working actually... I've tried changing column types to char but that didn't work. I've gone a bit blind looking at it, but hopefully you can set me right. With the '#'d out lines instead the file does work.
What am I missing? Thanks Andy #!/usr/bin/python import psycopg2 import sys def main(): db = psycopg2.connect( host = 'localhost', database = 'gisdb', user = 'postgres', password = '######' ) cursor = db.cursor() cursor.execute("DROP TABLE IF EXISTS tubecross") cursor_to.execute("CREATE TABLE tubecross (id serial PRIMARY KEY, station_code char, SAJ interval, SPB interval, SOQ interval);") #cursor.execute("CREATE TABLE tubecross (id serial PRIMARY KEY, num integer, data varchar);") #cursor.execute("INSERT INTO tubecross (num, data) VALUES (%s, %s)",(900, "9abc'def")) cursor_to.execute("INSERT INTO tubecross (station_code, SAJ, SPB, SOQ) VALUES (%s, %s, %s, %s)",(SAJ, 00:00, 00:22, 00:27)) db.commit() if __name__ == "__main__": main() -- http://mail.python.org/mailman/listinfo/python-list