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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Fri, 21 Aug 2015 18:39:28 +0200, Cecil Westerhof 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 > 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/