Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95540

Re: Every character of a string becomes a binding

Path csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'that?': 0.05; 'bindings': 0.09; 'incorrect': 0.09; 'message-id:@4ax.com': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'tuple': 0.09; 'value.': 0.15; '52,': 0.16; "?',": 0.16; 'expects': 0.16; 'iterable)': 0.16; 'iterable,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:> 20': 0.16; 'url.': 0.16; 'url:home': 0.18; 'creates': 0.18; '2015': 0.20; 'aug': 0.20; 'select': 0.23; '(most': 0.24; 'header:X-Complaints-To:1': 0.26; 'fri,': 0.27; 'parameters': 0.27; '+0200,': 0.27; 'code': 0.30; 'table': 0.32; 'statement': 0.32; 'problem': 0.33; 'equal': 0.34; 'file': 0.34; 'asking': 0.35; 'item': 0.35; 'there': 0.36; 'urls': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'expect': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'field': 0.60; 'skip:u 10': 0.61; 'show': 0.62; 'information': 0.63; 'records': 0.70; 'cecil': 0.84; 'westerhof': 0.84; 'dennis': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Every character of a string becomes a binding
Date Fri, 21 Aug 2015 20:47:13 -0400
Organization IISS Elusive Unicorn
References <871tewppdr.fsf@Equus.decebal.nl>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-68-178-61.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.6.1440204449.17298.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1440204449 news.xs4all.nl 23796 [2001:888:2000:d::a6]:40784
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95540

Show key headers only | View raw


On Fri, 21 Aug 2015 18:39:28 +0200, Cecil Westerhof <Cecil@decebal.nl>
declaimed the following:

>I have the following with sqlite3:
>urls = c.execute('SELECT URL FROM LINKS WHERE URL = ?', url).fetchall()
>
	Well, for one complication... You are asking for the very information
you are providing...

	select URL field
	where the URL field is equal to some value.

	What do you really expect from that? If the table has multiple records
with the same URL value, you will get multiple copies of the same URL.


>But this gives:
>Traceback (most recent call last):
>  File "./createDB.py", line 52, in <module>
>    urls = c.execute('SELECT URL FROM LINKS WHERE URL = ?', url).fetchall()
>sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 40 supplied.

	So show us the code that creates "url"...

	Though I suspect the problem is that "url" is an iterable, and the
DB-API expects the parameters to be provided IN an iterable.

	Try using 
		... where URL=?', (url,) )
to make it a tuple (an iterable) with one item inside it.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Every character of a string becomes a binding Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 18:39 +0200
  Re: Every character of a string becomes a binding Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-08-21 11:50 -0500
    Re: Every character of a string becomes a binding Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 19:04 +0200
      Re: Every character of a string becomes a binding Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-08-22 11:45 +0200
  Re: Every character of a string becomes a binding John Gordon <gordon@panix.com> - 2015-08-21 17:02 +0000
  Re: Every character of a string becomes a binding Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-21 20:47 -0400
  Re: Every character of a string becomes a binding Chris Angelico <rosuav@gmail.com> - 2015-08-22 11:03 +1000

csiph-web