When I execute the following python code against my Redshift database the insert fails, even though the subquery operates correctly. I'm pretty sure this is some simple concept I'm missing here, but I don't know what it is. Any suggestions on how to make this work?
con_f = psycopg2.connect(dbname=dbname, host=host, port=port, user=user, password=password)
cur_f = con_f.cursor()
move_qry = 'insert into schema.' + target_table + ' (SELECT * from ' + staging_tbl + ');'
print(move_qry)
cur_f.execute(move_qry)
print(cur_f.query)
print(cur_f.statusmessage)
insert into schema.tbl_final (SELECT * from staging.tbl_final_tmp);
insert into schema.tbl_final (SELECT * from staging.tbl_final_tmp);
INSERT 0 6388714