Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'column': 0.07; 'tom': 0.07; 'python': 0.09; '(although': 0.09; 'executes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Why': 0.09; 'ignore': 0.13; 'dec': 0.15; '%s,': 0.16; '(%s,': 0.16; 'bindings,': 0.16; 'columns': 0.16; 'presume': 0.16; 'pulls': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'specific,': 0.16; 'settings': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'specifies': 0.17; 'specify': 0.17; 'either.': 0.22; 'work,': 0.22; 'errors': 0.23; 'originally': 0.23; "i've": 0.23; 'tried': 0.25; 'values': 0.26; 'header:X-Complaints-To:1': 0.28; 'actual': 0.28; 'chris': 0.28; 'noticed': 0.28; '"no': 0.29; 'aims': 0.29; 'interactions': 0.29; 'statements': 0.29; 'writes:': 0.29; "i'm": 0.29; 'worked': 0.30; 'filled': 0.30; 'primary': 0.30; "aren't": 0.33; 'like:': 0.33; 'null': 0.33; 'oracle': 0.33; 'url:home': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'pm,': 0.35; 'table': 0.35; 'subject:?': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'depends': 0.36; "didn't": 0.36; 'charset:us- ascii': 0.36; 'does': 0.37; 'being': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'john': 0.60; 'first': 0.61; 'subject:This': 0.78; 'actually,': 0.84; 'dennis': 0.91; 'was:': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Why Doesn't This MySQL Statement Execute? Date: Wed, 19 Dec 2012 00:40:36 -0500 Organization: > Bestiaria Support Staff < References: <50d0f4c7$0$6952$e4fe514c@news2.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-24-60.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355895615 news.xs4all.nl 6842 [2001:888:2000:d::a6]:56169 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35089 On Wed, 19 Dec 2012 15:49:41 +1100, Chris Angelico declaimed the following in gmane.comp.python.general: > On Wed, Dec 19, 2012 at 2:57 PM, John Gordon wrote: > > In Tom Borkin writes: > > > >> Actually, what I originally had was: > >> cursor.execute("""insert into interactions values(Null, %s, "Call Back", > >> %s)""", (i_id, date_plus_2)) > >> and that didn't work, either. I tried your variation like: > >> cursor.execute("""insert into interactions values(Null, %s, "Call Back", > >> %s)""" % (i_id, date_plus_2)) > >> and no cigar :( > >> Tom > > > > Have you tried using single-quotes around Call Back, instead of > > double quotes? I've noticed that SQL statements prefer single-quoted > > strings (although that may be Oracle specific, as that's all I've really > > worked with). > > The SQL standard specifies single quotes, but MySQL and the SQL > standard aren't always on speaking terms. It depends on the MySQL > settings as to whether "asdf" means 'asdf' or means a column named > asdf. > > But if that's what the problem is, there ought to be an exception > coming back, surely? I'm not familiar with the Python MySQL bindings, > but that's what I would expect. What, specifically, does "no cigar" > mean? It executes without errors but does nothing? It purchases a gun, > aims at your shoe, and pulls the trigger? > Well... off the wall... I'm going to presume the first field -- the Null -- is for a primary key (autoincrement)... What happens if you change the SQL to actually specify the columns being filled AND you ignore the primary key/Null entry? And since I don't like hard-coding the SQL... cursor.execute("""insert into interactions (someID, action, somedate) values (%s, %s, %s)""", (i_id, "Call Back", date_plus_2) ) Of course you need to use the actual table column names... -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/