Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'case.': 0.05; 'debug': 0.05; 'diff': 0.05; 'subject:sqlite3': 0.07; 'python': 0.09; 'before.': 0.09; 'bzr': 0.09; 'to:addr:comp.lang.python': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.10; 'suggest': 0.11; '(when': 0.16; 'command,': 0.16; 'fine.': 0.16; 'on"': 0.16; 'url:sqlite': 0.16; 'variable.': 0.16; 'wrote:': 0.17; 'working.': 0.17; 'obviously': 0.18; 'memory': 0.18; 'variable': 0.20; 'changes': 0.20; 'putting': 0.20; 'written': 0.20; 'keys': 0.22; "i'd": 0.22; '15,': 0.23; "i've": 0.23; 'seems': 0.23; 'idea': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'thanks!': 0.26; 'compiled': 0.27; 'far,': 0.29; 'mind,': 0.29; 'url:mailman': 0.29; 'source': 0.29; "i'm": 0.29; 'worked': 0.30; 'returned': 0.30; 'seconds': 0.30; 'code': 0.31; 'url:python': 0.32; 'file': 0.32; 'could': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'getting': 0.33; 'skip:s 30': 0.33; 'curious': 0.33; 'turns': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'robert': 0.35; 'open': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; "didn't": 0.36; 'useful': 0.36; 'should': 0.36; 'too': 0.36; 'possible': 0.37; 'execute': 0.37; 'does': 0.37; 'why': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'object': 0.38; 'nothing': 0.38; 'sure': 0.38; 'called': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'url:mail': 0.40; 'skip:u 10': 0.60; 'first': 0.61; 'late.': 0.65; 'talking': 0.66; 'home': 0.66; 'foreign': 0.72; 'day': 0.73; '2013': 0.84; 'about,': 0.84; 'address!': 0.84; 'difference.': 0.84; 'glad': 0.86; 'can!': 0.91 Newsgroups: comp.lang.python Date: Tue, 15 Jan 2013 14:46:12 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.162.99.34; posting-account=aw7wEQoAAACnaP8vftI9MyiC9NfXNJyr References: <2fce91ea-374c-4f55-9e53-fe4032c2f5fd@googlegroups.com> <8d9daaa7-091c-4810-85d2-0a7b03838441@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 66.162.99.34 MIME-Version: 1.0 Subject: Re: sqlite3 puzzle From: llanitedave To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: llanitedave , python-list 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: , Message-ID: Lines: 144 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358289981 news.xs4all.nl 6881 [2001:888:2000:d::a6]:60781 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36872 Yabut I'm talking about changes I'd made 30 seconds before to code I'd written 5 minutes before. My short-term memory is nothing to write home about, even if I could remember my mailing address! On Tuesday, January 15, 2013 2:27:28 PM UTC-8, Rob Day wrote: > Glad I could help! > > > > > > Using a local source control system like git, bzr or hg is really > > useful in situations like these - it's far, far easier to debug issues > > of the form "I made changes and now it's broken" when you can do `git > > diff yesterday's-version today's-version` and see exactly what the > > changes were. > > > > > > On 15 January 2013 20:29, llanitedave wrote: > > > On Tuesday, January 15, 2013 9:13:13 AM UTC-8, Rob Day wrote: > > >> On 15 January 2013 15:51, llanitedave wrote: > > >> > > >> > Thanks for the suggestion, Rob, but that didn't make any difference. I've never had an issue with putting the execute object into a variable and calling "fetch" on that variable. > > >> > > >> > > > >> > > >> > I can accept reality if it turns out that foreign keys simply isn't enabled on the Python distribution of sqlite, although I don't know why that should be the case. I'm just curious as to why it worked at first and then stopped working. > > >> > > >> > > >> > > >> Well - you might be able to accept that, but I'm not sure I can! If it > > >> > > >> was working before, it must be compiled in, and so it must be possible > > >> > > >> to make it work again. > > >> > > >> > > >> > > >> http://www.sqlite.org/foreignkeys.html#fk_enable seems to suggest that > > >> > > >> "PRAGMA foreign_keys = ON" never returns anything, and it's only > > >> > > >> "PRAGMA foreign_keys" which returns 0, 1 or None (when unsupported). > > >> > > >> With that in mind, does the following code work? > > >> > > >> > > >> > > >> # open database file > > >> > > >> > > >> > > >> self.geologger_db = sqlite3.connect('geologger.mgc') > > >> > > >> self.db_cursor = self.geologger_db.cursor() > > >> > > >> self.db_cursor.execute("PRAGMA foreign_keys = ON") > > >> > > >> self.db_cursor.execute("PRAGMA foreign_keys") > > >> > > >> print self.db_cursor.fetchone() > > > > > > "http://www.sqlite.org/foreignkeys.html#fk_enable seems to suggest that "PRAGMA foreign_keys = ON" never returns anything, and it's only "PRAGMA foreign_keys" which returns 0, 1 or None (when unsupported)." > > > > > > That was it, exactly, Rob. I don't know where I got the idea that I was getting a '1' from the 'ON' command, although I was sure that I'd seen it. But once I just called "foreign_key" it returned just fine. > > > > > > Ummm... Obviously I was up fiddling around too late. Yeah, that's it. > > > > > > > > > Thanks! It's solved now. > > > -- > > > http://mail.python.org/mailman/listinfo/python-list > > > > > > > > -- > > Robert K. Day > > robert.day@merton.oxon.org