Re: [Tutor] sqlite3 does it support limit in a delete clause?

2013-02-21 Thread eryksun
On Thu, Feb 21, 2013 at 8:47 PM, Jim Byrnes wrote: > cur.execute("delete from pwds where Account='xMe' limit 1") If you need a alternate way to limit the delete, try the following, for which the limit is on a select query: cur.execute(''' delete from pwds where rowid in (

Re: [Tutor] sqlite3 does it support limit in a delete clause?

2013-02-21 Thread eryksun
On Thu, Feb 21, 2013 at 10:41 PM, eryksun wrote: > >>> from ctypes import * > >>> import _sqlite3 > >>> lib = CDLL(_sqlite3.__file__) > > >>> lib.sqlite3_compileoption_used( > ... "ENABLE_UPDATE_DELETE_LIMIT") > 1 A simpler way using a SQL function: http://www.sqlite.

Re: [Tutor] sqlite3 does it support limit in a delete clause?

2013-02-21 Thread eryksun
On Thu, Feb 21, 2013 at 8:47 PM, Jim Byrnes wrote: > ubuntu 12.04 python 2.7 > > Does sqlite3 in this version of python support a delete with a limit? It's enabled via the compilation option SQLITE_ENABLE_UPDATE_DELETE_LIMIT: http://www.sqlite.org/compile.html/#enable_update_delete_limit This i

[Tutor] sqlite3 does it support limit in a delete clause?

2013-02-21 Thread Jim Byrnes
ubuntu 12.04 python 2.7 Does sqlite3 in this version of python support a delete with a limit? >>> cur.execute("delete from pwds where Account='xMe' limit 1") Traceback (most recent call last): File "", line 1, in sqlite3.OperationalError: near "limit": syntax error >>> >>> cur.execute("delete

[Tutor] Setting log directory from a command line argument

2013-02-21 Thread Michael O'Leary
I have added logging to a Python program I have been working on by putting this in the module's __init__.py file: ## import logging logger = logging.getLogger('ranking_factors') formatter = logging.Formatter('[%(asctime)s] %(levelname)s in %(module)s:%(funcName)s@%(lineno)s => %(message)s'

Re: [Tutor] distance between cities matrix

2013-02-21 Thread Danny Yoo
> Consider the (20x20) array of numbers here(I wrote all of the numbers in > my program). Lets say this represents a matrix A of distances (in > kilometers) between cities. Note that A is symmetric A(i,j) = A(j,i) and all > its diagonal elements are zero. Suppose Vladimir from city i and Petra from

Re: [Tutor] distance between cities matrix

2013-02-21 Thread Dave Angel
On 02/21/2013 07:16 AM, Mara Kelly wrote: Hi everyone, Here is the question I was given...Consider the (20x20) array of numbers here(I wrote all of the numbers in my program). Lets say this represents a matrix A of distances (in kilometers) between cities. Note that A is symmetric A(i,j) = A(j,

Re: [Tutor] distance between cities matrix

2013-02-21 Thread Alan Gauld
On 21/02/13 12:16, Mara Kelly wrote: Consider the (20x20) array of numbers here matrix A of distances (in kilometers) between cities. Note that A is symmetric A(i,j) = A(j,i) and all its diagonal elements are zero. Suppose Vladimir from city i and Petra from city j want to meet up in some t

[Tutor] distance between cities matrix

2013-02-21 Thread Mara Kelly
Hi everyone, Here is the question I was given...Consider the (20x20) array of numbers here(I wrote all of the numbers in my program). Lets say this represents a matrix A of distances (in kilometers) between cities. Note that A is symmetric A(i,j) = A(j,i) and all its diagonal elements are zero.