Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.straub-nv.de!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; '"the': 0.07; 'enabled.': 0.07; 'subject:sqlite3': 0.07; 'python': 0.09; 'defined.': 0.09; 'effect.': 0.09; 'method:': 0.09; 'separately': 0.09; 'sqlite': 0.09; '2.7': 0.13; 'library': 0.15; "'0',": 0.16; '(either': 0.16; 'downstream': 0.16; 'placeholder': 0.16; 'received:10.20.15.4': 0.16; 'received:66.96.186': 0.16; 'received:bosmailscan04.eigbox.net': 0.16; 'run.': 0.16; 'sqlite3': 0.16; 'wrote:': 0.17; 'compilation': 0.17; 'app': 0.19; 'variable': 0.20; 'file.': 0.20; 'trying': 0.21; 'enabled,': 0.22; 'keys': 0.22; 'cc:2**0': 0.23; '>': 0.23; 'monday,': 0.23; 'tables': 0.23; "haven't": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'compiled': 0.27; 'embedded': 0.27; 'older': 0.27; 'change,': 0.27; 'fine': 0.28; 'run': 0.28; '"the': 0.29; 'skip:& 10': 0.29; "i'm": 0.29; 'connection': 0.30; 'worked': 0.30; 'returned': 0.30; 'code': 0.31; 'file': 0.32; "skip:' 20": 0.32; 'print': 0.32; 'getting': 0.33; 'goes': 0.33; 'says': 0.33; 'skip:s 30': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'changed': 0.34; 'open': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'closing': 0.36; 'received:71': 0.36; 'test': 0.36; 'charset:us- ascii': 0.36; 'does': 0.37; 'url:rec-html40': 0.37; 'being': 0.37; 'previous': 0.37; 'subject:: ': 0.38; 'received:10': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'application': 0.40; 'end': 0.40; 'close': 0.63; 'times': 0.63; 'more': 0.63; 'connection,': 0.71; 'foreign': 0.72; 'url:dtd': 0.81; '2013': 0.84; 'descriptive': 0.84; 'received:10.20.18.15': 0.84; 'received:bosauthsmtp15.eigbox.net': 0.84; 'relate': 0.91; 'url:strict': 0.91 X-Authority-Analysis: v=2.0 cv=Rt9H3VaK c=1 sm=1 a=pdEiMVOOVNxYamtqANSCLg==:17 a=spKFjZujUncA:10 a=2Cs5qbXtQ68A:10 a=OmMKortqy18A:10 a=tTExfe6FAAAA:8 a=AJtiB85TdlMA:10 a=O1-IUBWeIakdaR485kgA:9 a=CjuIK1q_8ugA:10 a=SSmOFEACAAAA:8 a=_W_S_7VecoQA:10 a=frz4AuCg-hUA:10 a=Zf6nbR9tPJNkBhIU:21 a=6thTdk0GfRoQwv0zj4iWMg==:117 X-EN-OrigOutIP: 10.20.18.15 X-EN-IMPSID: oGwF1k00W0KWaAJ01GwFoV From: inq1ltd To: python-list@python.org Subject: Re: sqlite3 puzzle Date: Tue, 15 Jan 2013 11:54:42 -0500 User-Agent: KMail/4.7.2 (Linux/2.6.37.6-24-desktop; KDE/4.7.2; i686; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart1520396.WHmZDTHptq" Content-Transfer-Encoding: 7Bit X-EN-UserInfo: ea107384e720a598200e9790e8ca8002:9d89a6cbd5a73a41b134431a25286195 X-EN-AuthUser: inq1ltd@inqvista.com Sender: inq1ltd X-EN-OrigIP: 71.246.157.16 X-EN-OrigHost: pool-71-246-157-16.rich.east.verizon.net Cc: llanitedave X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 131 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358270827 news.xs4all.nl 6899 [2001:888:2000:d::a6]:60987 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36863 --nextPart1520396.WHmZDTHptq Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Monday, January 14, 2013 11:09:28 PM llanitedave wrote: > I'm trying to get an application working in Python 2.7 and wx.Python which > contains an embedded sqlite3 file. There are a few tables with foreign > keys defined. In looking at the sqlite3 documentation, it says > > "Assuming the library is compiled with foreign key constraints enabled, it > must still be enabled by the application at runtime, using the PRAGMA > foreign_keys command." It goes on to say that foreign keys must be enabled > separately for each connection, which is fine as my app has only one. > > So I put the following test code in my initialization method: > > # open database file > self.geologger_db = sqlite3.connect('geologger.mgc') > self.db_cursor = self.geologger_db.cursor() > self.foreign_key_status = self.db_cursor.execute("PRAGMA foreign_keys = > ON") self.foreign_key_status = self.foreign_key_status.fetchone() > > print self.foreign_key_status > > I ran this several times while I was arranging the downstream queries, and > each time it returned '(1,)', which means foreign keys is enabled. > > But I was using a variable named 'cmd1' as a placeholder until I changed the > name to the more descriptive 'self.foreign_key_status'. Since I made the > name change, however, the code only returns 'None'. Reverting to the > previous variable name has no effect. > > Yes, I'm closing the connection with self.db_cursor.close() at the end of > each run. > > According to the sqlite3 website, getting no return value, not even a '0', > means that "the version of SQLite you are using does not support foreign > keys (either because it is older than 3.6.19 or because it was compiled > with SQLITE_OMIT_FOREIGN_KEY or SQLITE_OMIT_TRIGGER defined)." > > How can that be a compilation issue when it worked previously? Does this > somehow relate to it being a Python plugin instance? > > I'm very confused. I haven't run this myself but after self.foreign_key_status.fetchone() try : self.geologger_db.commit() then close the db jimonlinux --nextPart1520396.WHmZDTHptq Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="us-ascii"

On Monday, January 14, 2013 11:09:28 PM llanitedave wrote:

> I'm trying to get an application working in Python 2.7 and wx.Python which

> contains an embedded sqlite3 file. There are a few tables with foreign

> keys defined. In looking at the sqlite3 documentation, it says

>

> "Assuming the library is compiled with foreign key constraints enabled, it

> must still be enabled by the application at runtime, using the PRAGMA

> foreign_keys command." It goes on to say that foreign keys must be enabled

> separately for each connection, which is fine as my app has only one.

>

> So I put the following test code in my initialization method:

>

> # open database file

> self.geologger_db = sqlite3.connect('geologger.mgc')

> self.db_cursor = self.geologger_db.cursor()

> self.foreign_key_status = self.db_cursor.execute("PRAGMA foreign_keys =

> ON") self.foreign_key_status = self.foreign_key_status.fetchone()

>

> print self.foreign_key_status

>

> I ran this several times while I was arranging the downstream queries, and

> each time it returned '(1,)', which means foreign keys is enabled.

>

> But I was using a variable named 'cmd1' as a placeholder until I changed the

> name to the more descriptive 'self.foreign_key_status'. Since I made the

> name change, however, the code only returns 'None'. Reverting to the

> previous variable name has no effect.

>

> Yes, I'm closing the connection with self.db_cursor.close() at the end of

> each run.

>

> According to the sqlite3 website, getting no return value, not even a '0',

> means that "the version of SQLite you are using does not support foreign

> keys (either because it is older than 3.6.19 or because it was compiled

> with SQLITE_OMIT_FOREIGN_KEY or SQLITE_OMIT_TRIGGER defined)."

>

> How can that be a compilation issue when it worked previously? Does this

> somehow relate to it being a Python plugin instance?

>

> I'm very confused.

 

I haven't run this myself but after

 

self.foreign_key_status.fetchone()

 

try :

self.geologger_db.commit()

 

then close the db

 

jimonlinux

 

 

 

 

 

 

 

--nextPart1520396.WHmZDTHptq--