Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 4:31 PM, Frank Millman wrote: > > "Dennis Lee Bieber" wrote in message > news:lrr67al6ppa852agu9rq2dstqtue17i...@4ax.com... >> We must have a different impression of what a "schema" consists of. As >> I learned it, the "schema" basically came down to the statements definin

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:lrr67al6ppa852agu9rq2dstqtue17i...@4ax.com... > On Mon, 24 Nov 2014 10:05:11 +0200, "Frank Millman" > declaimed the following: > >> >>Originally I supported two databases - PostgreSQL and Sql Server. They >>both >>have a concept called 'schemas', which

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 5:44 AM, Dennis Lee Bieber wrote: > On Mon, 24 Nov 2014 10:05:11 +0200, "Frank Millman" > declaimed the following: > >>I will explain why such a feature would have been useful for me. >> >>My accounting system handles multiple companies. I needed to figure out a >>way to k

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:8d747a5biq4rc559tvgju088508bp0o...@4ax.com... > On Sun, 23 Nov 2014 10:21:48 +0200, "Frank Millman" > declaimed the following: > >> >> >>The default is for sqlite3 to ignore foreign key contraints. >> [...] >> >>Unfortunately it has a limitation, which

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 1:22 PM, llanitedave wrote: > I recreated the table and put the foreign key reference directly into the > field definition: > > "of_borehole TEXT NOT NULL REFERENCES borehole," > > This is a valid alternative according to the SQLite3 docs, if you don't > explicitly define

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread llanitedave
On Saturday, November 22, 2014 6:11:22 PM UTC-8, llanitedave wrote: > I've built a database in SQLite3 to be embedded into a python application > using wxPython 2.8.12 and Python 2.7.6. I'm using Sqliteman to manage the > database directly and make changes to the structure when necessary. > > O

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread llanitedave
On Sunday, November 23, 2014 12:22:30 AM UTC-8, Frank Millman wrote: > "Chris Angelico" wrote in message > news:captjjmp4y5zowwn5yftjutko4h5jvtqlantwqepa6b35xnd...@mail.gmail.com... > > > > Entirely possible. I never did track down the actual cause of the > > SQLite3 issues my students were havin

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Christian Gollwitzer
Am 23.11.14 07:32, schrieb Chris Angelico: did a sequence of commands which ought to have failed, but didn't. Let's see if I can recreate this: rosuav@sikorsky:~$ sqlite3 SQLite version 3.7.13 2012-06-11 02:05:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> c

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 8:40 PM, Jussi Piitulainen wrote: > Chris Angelico writes: >> On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: >> >> > To enable them, add the following - >> > >> > pragma foreign_keys = on; >> > >> > It works for me. >> >> Thanks, I went poking around briefly but didn

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Jussi Piitulainen
Chris Angelico writes: > On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: > > > To enable them, add the following - > > > > pragma foreign_keys = on; > > > > It works for me. > > Thanks, I went poking around briefly but didn't find that pragma. I didn't notice a pointer to the relevant docum

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: > "Chris Angelico" wrote in message > news:captjjmp4y5zowwn5yftjutko4h5jvtqlantwqepa6b35xnd...@mail.gmail.com... >> >> Entirely possible. I never did track down the actual cause of the >> SQLite3 issues my students were having; though I suspec

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmp4y5zowwn5yftjutko4h5jvtqlantwqepa6b35xnd...@mail.gmail.com... > > Entirely possible. I never did track down the actual cause of the > SQLite3 issues my students were having; though I suspect it's not > purely a Python API issue. I tried to demonstra

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread llanitedave
On Saturday, November 22, 2014 10:32:30 PM UTC-8, Chris Angelico wrote: > On Sun, Nov 23, 2014 at 5:08 PM, llanitedave wrote: > > The application was working "correctly" earlier (meaning that I could enter > > and retrieve data with it; being a strictly user application it didn't > > allow delete

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread Chris Angelico
On Sun, Nov 23, 2014 at 5:08 PM, llanitedave wrote: > The application was working "correctly" earlier (meaning that I could enter > and retrieve data with it; being a strictly user application it didn't allow > deletes from the GUI), and then I discovered (while cleaning up the user > documenta

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread llanitedave
On Saturday, November 22, 2014 9:41:55 PM UTC-8, Chris Angelico wrote: > On Sun, Nov 23, 2014 at 3:58 PM, Michael Torrie wrote: > > On 11/22/2014 08:54 PM, llanitedave wrote: > > Well that DID make a difference! I used the %r marker, and the logger > > line gave me back: > >> "INFO:Related borehol

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread Chris Angelico
On Sun, Nov 23, 2014 at 3:58 PM, Michael Torrie wrote: > On 11/22/2014 08:54 PM, llanitedave wrote: > Well that DID make a difference! I used the %r marker, and the logger > line gave me back: >> "INFO:Related borehole_id is u'testbh3', of_borehole is 'testbh3'" >> >> So it looks like I need to c

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread Michael Torrie
On 11/22/2014 08:54 PM, llanitedave wrote: Well that DID make a difference! I used the %r marker, and the logger line gave me back: > "INFO:Related borehole_id is u'testbh3', of_borehole is 'testbh3'" > > So it looks like I need to change my foreign key string to a unicode > string. I'll be work

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread llanitedave
On Saturday, November 22, 2014 6:22:32 PM UTC-8, Chris Angelico wrote: > On Sun, Nov 23, 2014 at 1:11 PM, llanitedave wrote: > > logging.info("Related borehole_id is %s, of_borehole is %s", relatedbh, > > runfields[1]) > > > > In this case, the displayed data from both is identical -- the logging

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-22 Thread Chris Angelico
On Sun, Nov 23, 2014 at 1:11 PM, llanitedave wrote: > logging.info("Related borehole_id is %s, of_borehole is %s", relatedbh, > runfields[1]) > > In this case, the displayed data from both is identical -- the logging line > comes back as: > INFO:Related borehole_id is testbh3, of_borehole is tes