executemany statement with a subquery
Posted by: Robert Koziol
Date: October 06, 2012 10:28AM
I have to insert many rows into DB with some nested select subquery.
I tried something like that:
eventsFlat = 
eventsFlat.append((event.id1, event.id2, event.league, event.date, event.type, event.subtype, event.period))
"""INSERT INTO events (mainevent_id, eventtype_id, eventsubtype_id, period_id) VALUES
((select id from mainevents where first_competitor_id=%s and second_competitor_id=%s and league_id=%s and event_date=%s), %s, %s, %s)""",
All I got is the error:
TypeError('not all arguments converted during string formatting',)
Is this possible to use executemany to insert rows but with some select subquery included in?
Edited 1 time(s). Last edit at 10/06/2012 11:36AM by Robert Koziol.