I am new to python and I can't seem to figure out why I am getting this error. It is telling me I have too many parameters however the table has 8 columns, and I pass it 8 parameters. What is going on? Could this error be misleading and the real problem is the fact that I am trying to pass in values that could be None or could be of type Boolean using %s?
Here is the code snippet
db.cursor().execute("CREATE TABLE temp_clean_mp_duplicates (id bigint, distinctid character varying(255), created timestamp without time zone, email character varying(255), created_exist boolean, email_exist boolean, user_exist boolean, distinct_id_found boolean, CONSTRAINT temp_clean_mp_duplicates_pkey PRIMARY KEY(id));")
mp_email = None
email_exist = False
if "$email" in mp_properties :
mp_email = mp_properties["$email"]
email_exist = True
mp_distinct_id = result["$distinct_id"]
db_cursor.execute("SELECT u.id, u.email, udm.distinctid, u.sessionId FROM users as u,user_distinctid_map as udm where u.id = udm.user_id and udm.distinctid = %s and lower(email) = lower(%s)", (mp_distinct_id,mp_email,))
distinct_id_found = True
if db_cursor.rowcount == 0 :
distinct_id_found = False
created = None
created_exist = False
if "$created" in mp_properties :
created = mp_properties["$created"]
created_exist = True
db_cursor.execute("SELECT u.id, u.email, u.sessionId FROM users as u where lower(u.email) = lower(%s)", (mp_email,))
user_id = 0
user_exist = False
if db_cursor.rowcount > 0 :
user_id = db_cursor.fetchone()[0]
user_exist = True
db.cursor().execute("INSERT INTO temp_clean_mp_duplicates (id, distinctid, created, email) VALUES (%s,%s,%s,%s,%s,%s,%s,%s);", (user_id, mp_distinct_id, created, mp_email, created_exist, email_exist, user_exist, distinct_id_found))