Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64594
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| 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; '-----------': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; "'from": 0.16; '23,': 0.16; 'collections': 0.16; 'dict': 0.16; 'iterable,': 0.16; 'pairs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'sequence.': 0.16; 'subclass': 0.16; 'subject:sqlite3': 0.16; 'there!': 0.16; 'tuple': 0.16; 'userdict': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'replacing': 0.19; 'work,': 0.20; '>>>': 0.22; 'example': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'subject:problem': 0.24; 'fairly': 0.24; 'fine': 0.24; 'looks': 0.24; 'skip:" 30': 0.26; 'pass': 0.26; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'url:bugs': 0.29; 'am,': 0.29; 'raise': 0.29; 'keyerror:': 0.31; 'file': 0.32; 'class': 0.32; 'url:python': 0.33; '(most': 0.33; 'table': 0.34; 'could': 0.34; 'subject: (': 0.35; 'subject:with': 0.35; 'equal': 0.35; 'but': 0.35; 'skip:" 50': 0.36; 'url:org': 0.36; 'january': 0.37; 'list': 0.37; 'clear': 0.37; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'called': 0.40; 'received:173': 0.61; 'skip:n 10': 0.64; 'yes': 0.68; 'age': 0.80; 'age)': 0.84; 'dict.': 0.84; 'received:fios.verizon.net': 0.84; 'works!': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: sqlite3 docbug (was problem with sqlite3) |
| Date | Thu, 23 Jan 2014 05:43:26 -0500 |
| References | <52e07f45$0$3631$426a34cc@news.free.fr> <mailman.5864.1390446316.18130.python-list@python.org> <d8243c7c-8d9c-4ef6-8842-2fe856633a4e@googlegroups.com> <mailman.5870.1390452106.18130.python-list@python.org> <1f13ee0c-5cb5-4627-9f38-2058a8235083@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <1f13ee0c-5cb5-4627-9f38-2058a8235083@googlegroups.com> |
| 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.5881.1390473818.18130.python-list@python.org> (permalink) |
| Lines | 58 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1390473818 news.xs4all.nl 2883 [2001:888:2000:d::a6]:47450 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64594 |
Show key headers only | View raw
On 1/23/2014 12:35 AM, Rustom Mody wrote:
> On Thursday, January 23, 2014 10:11:42 AM UTC+5:30, Chris Angelico wrote:
>> I think it's fairly clear from the example that it has to be either a
>> tuple or a dict. Looks fine to me.
>
> yes 'from the example' and only from there!
'parameters' is a single parameter, which could be called 'seq_dict'.
Let(seq_dict) must equal the number of replacements. A dict with extra
pairs raises.
A list instead of a tuple does work, but not an iterable, so 'sequence'.
A dict subclass works, but a UserDict is treated as a sequence.
-----------
import sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table people (name_last, age)")
who = "Yeltsin"
age = 72
s = (who, age)
d = {'who':who, 'age':age}
class D(dict): pass
dD = D(d)
from collections import UserDict
dU = UserDict(d)
# This is the qmark style:
cur.execute("insert into people values (?, ?)", s)
# And this is the named style:
cur.execute("select * from people where name_last=:who and age=:age", dU)
print(cur.fetchone())
--------------
>>>
Traceback (most recent call last):
File "C:\Programs\Python34\tem.py", line 23, in <module>
cur.execute("select * from people where name_last=:who and
age=:age", dU)
File "C:\Programs\Python34\lib\collections\__init__.py", line 883, in
__getitem__
raise KeyError(key)
KeyError: 0
Replacing dU in the last call with s works!
http://bugs.python.org/issue20364
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
problem with sqlite3: cannot use < in a SQL query with (?) lgabiot <lgabiot@hotmail.com> - 2014-01-23 03:32 +0100
Re: problem with sqlite3: cannot use < in a SQL query with (?) lgabiot <lgabiot@hotmail.com> - 2014-01-23 03:34 +0100
Re: problem with sqlite3: cannot use < in a SQL query with (?) Chris Angelico <rosuav@gmail.com> - 2014-01-23 13:42 +1100
Re: problem with sqlite3: cannot use < in a SQL query with (?) bob gailer <bgailer@gmail.com> - 2014-01-22 21:51 -0500
Re: problem with sqlite3: cannot use < in a SQL query with (?) bob gailer <bgailer@gmail.com> - 2014-01-22 21:51 -0500
Re: problem with sqlite3: cannot use < in a SQL query with (?) Tim Chase <python.list@tim.thechases.com> - 2014-01-22 21:05 -0600
sqlite3 docbug (was problem with sqlite3) Rustom Mody <rustompmody@gmail.com> - 2014-01-22 20:33 -0800
Re: sqlite3 docbug (was problem with sqlite3) Rustom Mody <rustompmody@gmail.com> - 2014-01-22 20:37 -0800
Re: sqlite3 docbug (was problem with sqlite3) Chris Angelico <rosuav@gmail.com> - 2014-01-23 15:41 +1100
Re: sqlite3 docbug (was problem with sqlite3) Rustom Mody <rustompmody@gmail.com> - 2014-01-22 21:35 -0800
Re: sqlite3 docbug (was problem with sqlite3) Chris Angelico <rosuav@gmail.com> - 2014-01-23 16:42 +1100
Re: sqlite3 docbug (was problem with sqlite3) lgabiot <lgabiot@hotmail.com> - 2014-01-23 08:37 +0100
Re: sqlite3 docbug (was problem with sqlite3) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-23 09:04 +0000
Re: sqlite3 docbug (was problem with sqlite3) lgabiot <lgabiot@hotmail.com> - 2014-01-23 10:45 +0100
Re: sqlite3 docbug (was problem with sqlite3) Rustom Mody <rustompmody@gmail.com> - 2014-01-23 02:23 -0800
Re: sqlite3 docbug (was problem with sqlite3) lgabiot <laurent.gabiot@gmail.com> - 2014-01-23 10:45 +0100
Re: sqlite3 docbug (was problem with sqlite3) lgabiot <laurent.gabiot@gmail.com> - 2014-01-23 08:37 +0100
Re: sqlite3 docbug (was problem with sqlite3) Terry Reedy <tjreedy@udel.edu> - 2014-01-23 05:43 -0500
Re: sqlite3 docbug (was problem with sqlite3) Rustom Mody <rustompmody@gmail.com> - 2014-01-23 07:00 -0800
Re: sqlite3 docbug (was problem with sqlite3) Tim Chase <python.list@tim.thechases.com> - 2014-01-23 06:36 -0600
Re: sqlite3 docbug (was problem with sqlite3) Terry Reedy <tjreedy@udel.edu> - 2014-01-23 20:03 -0500
Re: sqlite3 docbug (was problem with sqlite3) Asaf Las <roegltd@gmail.com> - 2014-01-22 23:18 -0800
Re: sqlite3 docbug (was problem with sqlite3) Chris Angelico <rosuav@gmail.com> - 2014-01-23 18:47 +1100
csiph-web