Say we have an SQL statement that needs to be executed only with parameters before executing from the database. For example:
sql = ''' SELECT id, price, date_out FROM sold_items WHERE date_out BETWEEN ? AND ? ''' database_cursor.execute(sql, (start_date, end_date))
How to get a line that has been parsed and executed ?, something like this:
SELECT id, price, date_out FROM sold_items WHERE date_out BETWEEN 2010-12-05 AND 2011-12-01
In this simple case, this is not very important, but I have other SQL expressions much more complicated, and for debugging purposes I would like to execute them myself in my SQL manager and check the results.
Thanks in advance
python sql sqlite3
bgusach
source share