Re: Database statements via python but database left intact

2013-10-06 Thread Piet van Oostrum
Νίκος Αλεξόπουλος writes: > i will use con.commit() from now and on because yesterdays i lost 3 > hours trying to identify what was wrong with my MySQL statements in > python and it turned out to be for no good reason. That shows how important it is to study the software that you are using, and

Re: Database statements via python but database left intact

2013-10-06 Thread Νίκος Αλεξόπουλος
Στις 6/10/2013 6:52 μμ, ο/η Adam Tauno Williams έγραψε: Are you sure that you're committing your changes (either by having autocommit set or using an explicit con.commit() call)? http://geert.vanderkelen.org/dont-forget-the-commit-in-mysql/ I dont think that is the issue, because up until now i

Re: Database statements via python but database left intact

2013-10-06 Thread Adam Tauno Williams
>>> Are you sure that you're committing your changes (either by having >>> autocommit set or using an explicit con.commit() call)? >>> http://geert.vanderkelen.org/dont-forget-the-commit-in-mysql/ >> I dont think that is the issue, because up until now i never used >commit and >> all transaction we

Re: Database statements via python but database left intact

2013-10-06 Thread Νίκος Αλεξόπουλος
Στις 6/10/2013 12:45 πμ, ο/η Zero Piraeus έγραψε: : On Sun, Oct 06, 2013 at 12:02:14AM +0300, Νίκος Αλεξόπουλος wrote: I neved had though of than an engine type could make so much mess. MyISAM is the way to go then for my web development? Why InnoDB failed to execute the queries? Because you

Re: Database statements via python but database left intact

2013-10-06 Thread Adam Tauno Williams
>I neved had though of than an engine type could make so much mess. Because your app and how it is written is broken. >MyISAM is the way to go then for my web development? >Why InnoDB failed to execute the queries? No, nothing failed. Your app is broken. You are depending on auto commit - and

Re: Database statements via python but database left intact

2013-10-06 Thread Zero Piraeus
: On Sun, Oct 06, 2013 at 12:02:14AM +0300, Νίκος Αλεξόπουλος wrote: > I neved had though of than an engine type could make so much mess. > MyISAM is the way to go then for my web development? > Why InnoDB failed to execute the queries? Because you didn't commit. MyISAM doesn't support transactio

Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-06 Thread Roy Smith
In article , Chris Angelico wrote: > I would hope that an absence of libpq could simply result in a > courteous exception when the module's imported, but maybe that'd be > hard to implement. It works fine. I've had this in production for a while: # Psycopg2 is only needed for a single hacky l

Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-06 Thread Chris Angelico
On Sun, Oct 6, 2013 at 8:10 PM, Chris “Kwpolska” Warrick wrote: > It would require Postgres around people’s (or at least packagers’) > systems, and it often gets messy when we have such requirements. I would hope that an absence of libpq could simply result in a courteous exception when the modul

Re: Database statements via python but database left intact

2013-10-06 Thread Chris “Kwpolska” Warrick
On Sun, Oct 6, 2013 at 1:36 PM, rusi wrote: > On Sunday, October 6, 2013 2:35:24 PM UTC+5:30, Chris “Kwpolska” Warrick > wrote: >> So, instead of this, maybe we should work on getting psycopg2 to the >> top result on Googling “python sql”, or even “python mysql” with an >> anti-MySQL ad? (like vi

Re: Database statements via python but database left intact

2013-10-06 Thread rusi
On Sunday, October 6, 2013 2:35:24 PM UTC+5:30, Chris “Kwpolska” Warrick wrote: > So, instead of this, maybe we should work on getting psycopg2 to the > top result on Googling “python sql”, or even “python mysql” with an > anti-MySQL ad? (like vim was doing some time ago on Googling “emacs”) Do yo

Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-06 Thread Chris “Kwpolska” Warrick
Reposting what I said in the other thread: On Sun, Oct 6, 2013 at 12:51 AM, Chris Angelico wrote: > On Sun, Oct 6, 2013 at 8:39 AM, Ned Batchelder wrote: >> Now is a good time to go read about transactions, and committing, and the >> difference between MyISAM and InnoDB. Please don't ask more a

Re: Database statements via python but database left intact

2013-10-06 Thread Chris “Kwpolska” Warrick
On Sun, Oct 6, 2013 at 12:51 AM, Chris Angelico wrote: > On Sun, Oct 6, 2013 at 8:39 AM, Ned Batchelder wrote: >> Now is a good time to go read about transactions, and committing, and the >> difference between MyISAM and InnoDB. Please don't ask more about it here. > > It's because of threads li

Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-05 Thread Dan Sommers
On Sun, 06 Oct 2013 12:19:13 +1100, Chris Angelico wrote: > On Sun, Oct 6, 2013 at 12:05 PM, Ben Finney wrote: [ ... ] >> With a separately-installed, far more complex database engine like >> MySQL or PostgreSQL, the Python bindings will only work if they are >> compiled against the correct clie

Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-05 Thread Chris Angelico
On Sun, Oct 6, 2013 at 12:05 PM, Ben Finney wrote: > The Python bindings for MySQL or PostgreSQL, or even SQLite, are tied to > extension libraries for the specific database engine. > > With SQLite this is not a problem for Python's release management, > because Python's release includes the entir

Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-05 Thread Ben Finney
Chris Angelico writes: > It's because of threads like this that I would really like Python to > nudge people towards something stronger than MySQL. Would it kill > Python to incorporate PostgreSQL bindings automatically? I'm not sure what would count as “kill Python”. It would certainly make the

Re: Database statements via python but database left intact

2013-10-05 Thread Chris Angelico
On Sun, Oct 6, 2013 at 8:39 AM, Ned Batchelder wrote: > Now is a good time to go read about transactions, and committing, and the > difference between MyISAM and InnoDB. Please don't ask more about it here. It's because of threads like this that I would really like Python to nudge people towards

Re: Database statements via python but database left intact

2013-10-05 Thread Ned Batchelder
On 10/5/13 5:02 PM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 11:31 μμ, ο/η Ian Kelly έγραψε: Well, have you changed anything in your database configuration? Whether MySQL uses transactions or not depends on which storage engine is being used. I suggest running a test insert with and without comm

Re: Database statements via python but database left intact

2013-10-05 Thread Νίκος Αλεξόπουλος
Στις 5/10/2013 11:31 μμ, ο/η Ian Kelly έγραψε: Well, have you changed anything in your database configuration? Whether MySQL uses transactions or not depends on which storage engine is being used. I suggest running a test insert with and without commit to check whether you actually need it or no

Re: Database statements via python but database left intact

2013-10-05 Thread Ian Kelly
On Sat, Oct 5, 2013 at 1:36 PM, Νίκος Αλεξόπουλος wrote: > Στις 5/10/2013 10:29 μμ, ο/η Zero Piraeus έγραψε: >> >> : >> >> On Sat, Oct 05, 2013 at 10:16:46PM +0300, Νίκος Αλεξόπουλος wrote: >>> >>> Excuse me for asking again today, but i see no error in the >>> following code, yes no isertion or u

Re: Database statements via python but database left intact

2013-10-05 Thread Νίκος Αλεξόπουλος
Στις 5/10/2013 10:29 μμ, ο/η Zero Piraeus έγραψε: : On Sat, Oct 05, 2013 at 10:16:46PM +0300, Νίκος Αλεξόπουλος wrote: Excuse me for asking again today, but i see no error in the following code, yes no isertion or update happens into the database: [...] When this code runs i check instantly m

Re: Database statements via python but database left intact

2013-10-05 Thread Zero Piraeus
: On Sat, Oct 05, 2013 at 10:16:46PM +0300, Νίκος Αλεξόπουλος wrote: > Excuse me for asking again today, but i see no error in the > following code, yes no isertion or update happens into the database: > > [...] > > When this code runs i check instantly my database via PHPMyAdmin and > i see tha

Re: Database statements via python but database left intact

2013-10-05 Thread Νίκος Αλεξόπουλος
Actually the whole code is this: # = # DATABASE INSERTS - # = if cooki

Database statements via python but database left intact

2013-10-05 Thread Νίκος Αλεξόπουλος
Excuse me for asking again today, but i see no error in the following code, yes no isertion or update happens into the database: try: # locate the ID of the page's URL cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only