Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'one?': 0.05; 'fails.': 0.09; 'if,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'emanuele': 0.16; 'hits': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'syntax,': 0.16; 'duplicate': 0.17; 'statement': 0.23; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.28; 'chris': 0.28; 'writes:': 0.29; 'that.': 0.30; 'error': 0.30; 'to:addr:python-list': 0.33; 'returning': 0.35; 'said,': 0.35; 'received:org': 0.36; 'does': 0.37; 'two': 0.37; 'previous': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'different': 0.63; 'gave': 0.65; '8bit%:40': 0.65; '8bit%:43': 0.65; 'skip:\xe2 10': 0.66; 'quando': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lele Gaifax Subject: Re: mysql solution Date: Thu, 24 Jan 2013 14:37:24 +0100 Organization: Nautilus Entertainments References: <88306c73-dfa2-44e1-ab0c-d90dba05be1c@googlegroups.com> <774065a6-3d15-4cff-88d8-7f822ed1c0b0@googlegroups.com> <25438e79-de00-463d-9ae3-7ea63e282e4a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 78-134-78-49.v4.ngi.it User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:pKGNepUY1KOSY4zxiSel0DVGo0k= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359034659 news.xs4all.nl 6849 [2001:888:2000:d::a6]:46953 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37589 Ferrous Cranus writes: > The following statement fails. > > [code] > cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) RETURNING (pin) > ON DUPLICATE KEY UPDATE hits = hits + 1''', (htmlpage, 1) ) > [/code] How? What's the error message/traceback? If, as Chris said, MySQL does not support the “RETURNING” syntax, you cannot use that. I gave two different solutions in my previous message, did you try the “simplest” one? ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. lele@metapensiero.it | -- Fortunato Depero, 1929.