From owner-freebsd-python@freebsd.org Thu Feb 9 16:25:42 2017 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A5B7CD8B7F for ; Thu, 9 Feb 2017 16:25:42 +0000 (UTC) (envelope-from doug@safeport.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 077B011B7 for ; Thu, 9 Feb 2017 16:25:42 +0000 (UTC) (envelope-from doug@safeport.com) Received: by mailman.ysv.freebsd.org (Postfix) id 03EC0CD8B7E; Thu, 9 Feb 2017 16:25:42 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 039A5CD8B7D for ; Thu, 9 Feb 2017 16:25:42 +0000 (UTC) (envelope-from doug@safeport.com) Received: from bucksport.safeport.com (bucksport.safeport.com [198.74.231.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9FDB11B5 for ; Thu, 9 Feb 2017 16:25:41 +0000 (UTC) (envelope-from doug@safeport.com) Received: from bucksport.safeport.com (bucksport.safeport.com [198.74.231.101]) by bucksport.safeport.com (8.14.5/8.14.5) with ESMTP id v19GBi99061354; Thu, 9 Feb 2017 11:11:44 -0500 (EST) (envelope-from doug@safeport.com) Date: Thu, 9 Feb 2017 11:11:44 -0500 (EST) From: DTD To: Karl Young cc: python@FreeBSD.org Subject: Re: MySQLdb question In-Reply-To: <20170126230225.GV26386@mailboy.kipshouse.net> Message-ID: References: <20170126230225.GV26386@mailboy.kipshouse.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (bucksport.safeport.com [198.74.231.101]); Thu, 09 Feb 2017 11:11:44 -0500 (EST) X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2017 16:25:42 -0000 On Thu, 26 Jan 2017, Karl Young wrote: > DTD(doug@safeport.com)@2017.01.26 13:23:56 -0500: >> I am using py27-MySQLdb-1.2.5 (the default) for FreeBSD 10.3 >> >> cmd="update ipv4 set s8='%s',s16='%s',s24='%s' where ip='%s'" % (s8,s16,s24,row[0]) >> c.execute(cmd) > > When you say that it isn't working, I assume you mean it's not updating > any rows? To see if that's the case, you can assign the return from > execute and print the result, and print it out. > > numrows = c.execute(cmd) > print numrows > > Or use the rowcount attr of the cursor > > print c.rowcount > > If it's showing 0 rows, try running select where > > select * where ip='1.186.248.251 > > Is it possible you're connecting to a different host/db than you're > using for your manual SQL? Karl, the issue is InnoDB and perhaps MySQL changes in 5.6.34. Using the cli autocommit is on by default and using python it is not. A commit must be done after a series of updates. db.close apparently does not do a commit. This behavior is somewhat masked in other program as a select seems to cause the commit to be done. I don't know if db.close should do a commit or not. Thanks again for the response. Doug _____ Douglas Denault http://www.safeport.com doug@safeport.com Voice: 301-217-9220 Fax: 301-217-9277