'Lite' Databases (Re: sqlite3 and dates)

Chris Angelico rosuav at gmail.com
Thu Feb 19 10:19:18 EST 2015


On Fri, Feb 20, 2015 at 2:04 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>> This saves the SQL processor from recompiling the SQL into internal
>> byte-code every time.  It's handy if you know a given query will run
>> multiple times with the same "shape" parameters.  It's not essential,
>> and some optimize away the need, but many back-end interfaces support
>> it.
>>
>> -tkc
>>
>
> Is this
> https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.executemany an
> equivalent?

That's a different feature, and also useful. Personally, I've never
used executemany() for anything other than INSERT statements, though I
can imagine using it equally for UPDATE. It's useful only when you
have a bulk lot to do all at once; you can't take advantage of it to
repeat a common and complex query. Imagine you run a web server that
shows some statistical information about your session, on every page;
this may require a complex query, which you could retain from one page
request to another. But that only matters to performance.

ChrisA



More information about the Python-list mailing list