Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81329
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.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 | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.05; 'subject:Python': 0.06; 'utf-8': 0.07; 'string': 0.09; 'encode': 0.09; 'subject:2.7': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '(just': 0.16; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'logger': 0.16; 'sqlite': 0.16; 'unicode.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'byte': 0.24; 'tend': 0.24; 'unicode': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'switch': 0.26; 'primary': 0.26; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; 'message- id:@mail.gmail.com': 0.30; 'easier': 0.31; 'there.': 0.32; 'probably': 0.32; 'could': 0.34; 'knows': 0.35; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'are,': 0.36; 'doubt': 0.36; 'done': 0.36; "i'll": 0.36; 'being': 0.38; 'nov': 0.38; 'pm,': 0.38; 'that,': 0.38; 'anything': 0.39; 'manually': 0.60; 'solve': 0.60; 'you.': 0.62; 'foreign': 0.74; 'difference!': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=SIiB0x2zjV0xXUQY9pOHx20OAhQ7ztk/8pEbeKKlJ/c=; b=YUKPMV5nt+nYQLeQtFPTrGkhsycP2wKvbxhkPt0m99jw6XeizDFFz2/f4KnclxHzD/ rL4DwGSgaDibWjY0ZC2VXQzOpzE41CgYm5g5gZr4oWPhMARnehSaaaNfTtdNUD7HAhM+ PPOTvj+KNrm+qzBoNPcHhc517qx6JOqYAHJCWyCQ9V4VvfXu/G3+R1qXpUMonq1/TeKm A3BuJVHzdGbUTFBXkGWifC7vCrdDwL1rYoWDp5weVYx9nQ8DLXd8/yHlKGKeuGnKyjns uNsOWfpc/j67y01IGPr0Yyw62HR6cEmZI6jZD5LeX1OSw2dC3rIfb7xdyWQXj7HCzcF8 mvdA== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.136.92 with SMTP id k89mr12266849iod.43.1416721295653; Sat, 22 Nov 2014 21:41:35 -0800 (PST) |
| In-Reply-To | <54716987.7040301@gmail.com> |
| References | <ca987fb8-157d-4612-bafa-5da2da2920e0@googlegroups.com> <mailman.16153.1416709340.18130.python-list@python.org> <5d474a87-e2a5-43d3-b07c-4a1194880b4d@googlegroups.com> <54716987.7040301@gmail.com> |
| Date | Sun, 23 Nov 2014 16:41:35 +1100 |
| Subject | Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16159.1416721303.18130.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1416721303 news.xs4all.nl 2855 [2001:888:2000:d::a6]:50307 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81329 |
Show key headers only | View raw
On Sun, Nov 23, 2014 at 3:58 PM, Michael Torrie <torriem@gmail.com> 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 change my foreign key string to a unicode >> string. I'll be working on that... > > Or manually encode it to a UTF-8 byte string (just call .encode() on > it). Sqlite probably only knows about UTF-8 when it comes to unicode. Since it was a byte string sent to the database and a Unicode string coming back, the solution would be to .decode() the byte string. However, I doubt that's the issue; that's being done for you implicitly by the lower-level connections. Also, in Python 2: >>> u'testbh3' == 'testbh3' True So that's not your primary problem. You could try that, but I doubt it'll solve anything for you. Are you able to switch to Python 3, though? If you are, Unicode issues tend to be a lot easier to resolve there. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 18:11 -0800
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 13:22 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 19:54 -0800
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Michael Torrie <torriem@gmail.com> - 2014-11-22 21:58 -0700
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 16:41 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 22:08 -0800
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 17:32 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 22:46 -0800
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Christian Gollwitzer <auriocus@gmx.de> - 2014-11-23 10:55 +0100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert "Frank Millman" <frank@chagford.com> - 2014-11-23 10:21 +0200
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-23 17:29 -0800
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 19:31 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-11-23 11:40 +0200
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 20:53 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-23 13:01 -0500
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert "Frank Millman" <frank@chagford.com> - 2014-11-24 10:05 +0200
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-24 13:44 -0500
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-25 10:17 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert "Frank Millman" <frank@chagford.com> - 2014-11-25 07:31 +0200
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-25 17:40 +1100
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-23 11:58 -0500
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-23 18:22 -0800
Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-24 15:49 +1100
csiph-web