On Thursday, September 6, 2012 10:38:29 AM UTC-4, Mike Girard wrote:
>
> 1. Is there a way to pass in parameters to the sql, in accordance with the
> psycopg2 recommendation? I don't see anything in the docstring about that.
> Does it matter?
The db.executesql() method takes a "placeholders" argument, which can be a
list, tuple, or dictionary of positional or named parameters to be filled
in the query. This is the first thing mentioned in the docstring.
> 2. Do the sql execution times reported by the toolbar include anything
> besides the execution time of the actual database query? Queries executed
> through web2py are taking 3 times longer or more than the same queries
> executed through PGadmin. They seem to be equally fast using psycopg2 via
> the python command line.
>
Here's the code:
t0 = time.time()
ret = self.cursor.execute(*a, **b)
self.db._timings.append((command,time.time()-t0))
So, looks like it's just the database execution time (going through the
Python driver) . Not sure why it would differ from the command line.
Anthony
--