[web2py] Re: Error in SQLTABLE in pymysql

2011-05-19 Thread SergeyPo
Maybe on Linux it works better but for me the worst thing is memory
leak. Python can not handle more than 1 Gig of RAM, and my process
reaches this limit after several hours of processing. Speed loss is
also very apparent.

On 18 май, 22:48, Vasile Ermicioi  wrote:
> I also use dal (outside web2py) with pymysql and have no problems,
> 100 000+ of products are updated daily with new data from ebay
>
> so I am interested to know if pymysql is buggy or not, and when this bug can
> appear


Re: [web2py] Re: Error in SQLTABLE in pymysql

2011-05-18 Thread Vasile Ermicioi
I also use dal (outside web2py) with pymysql and have no problems,
100 000+ of products are updated daily with new data from ebay

so I am interested to know if pymysql is buggy or not, and when this bug can
appear


[web2py] Re: Error in SQLTABLE in pymysql

2011-05-18 Thread Massimo Di Pierro
import mysqldb
from dal import MySQLAdapter
MySQLAdapter.driver = mysqldb

On May 18, 7:51 am, SergeyPo  wrote:
> Vasile,
>
> I am using Python 2.5 on Windows XP,
> MySQL mysql  Ver 14.14 Distrib 5.1.32, for Win32 (ia32)
> InnoDB engine, UTF-8 encoding
>
> I have large database with lots of data, hard to reproduce here.
> Application works fine on web2py version 1.86.2 and works with many
> small errors in web2py 1.95, about 3 times slower.
> For benchmarking I use my own app which includes heavy offline process
> that I call with
> python web2py.py -S advantage -M -R applications/advantage/modules/
> preparer.py
>
> It takes 12 hours under 1.95 (pymysql) and 4 hours under 1.86
> I am also watching on memory in task manager...
>
> I am experienced developer but I don't have time to dig in third party
> modules like pymysql, esp. that I know that before the whole thing
> worked much better.
>
> Thank you!
> Sergey
>
> On 16 май, 17:19, Vasile Ermicioi  wrote:
>
>
>
>
>
>
>
> > and python version please (needed for benchmarking)
>
> > pymysql also have the advantage to run on top of jython and pypy with no
> > efforts
> > and I guess that on top of pypy it will have much better performance


[web2py] Re: Error in SQLTABLE in pymysql

2011-05-18 Thread SergeyPo
Vasile,

I am using Python 2.5 on Windows XP,
MySQL mysql  Ver 14.14 Distrib 5.1.32, for Win32 (ia32)
InnoDB engine, UTF-8 encoding

I have large database with lots of data, hard to reproduce here.
Application works fine on web2py version 1.86.2 and works with many
small errors in web2py 1.95, about 3 times slower.
For benchmarking I use my own app which includes heavy offline process
that I call with
python web2py.py -S advantage -M -R applications/advantage/modules/
preparer.py

It takes 12 hours under 1.95 (pymysql) and 4 hours under 1.86
I am also watching on memory in task manager...

I am experienced developer but I don't have time to dig in third party
modules like pymysql, esp. that I know that before the whole thing
worked much better.

Thank you!
Sergey

On 16 май, 17:19, Vasile Ermicioi  wrote:
> and python version please (needed for benchmarking)
>
> pymysql also have the advantage to run on top of jython and pypy with no
> efforts
> and I guess that on top of pypy it will have much better performance


Re: [web2py] Re: Error in SQLTABLE in pymysql

2011-05-16 Thread Vasile Ermicioi
and python version please (needed for benchmarking)

pymysql also have the advantage to run on top of jython and pypy with no
efforts
and I guess that on top of pypy it will have much better performance


Re: [web2py] Re: Error in SQLTABLE in pymysql

2011-05-16 Thread Vasile Ermicioi
what benchmark do you use ?

also please provide some more information so I can reproduce your error
- what are other tables structure?
- what data do you have?
- Mysql version ans schema type (MyISAM or InnoDB)


[web2py] Re: Error in SQLTABLE in pymysql

2011-05-16 Thread SergeyPo
Massimo!

I was wrong to say that pymysql is 20% slower. It is 3 times slower
than mysqldb, and does huge memory leak (both facts for Windows XP).
Mysql is so popular that you should treat it as priority! Please
consider switching back to mysqldb or at least making this user-
selectable easily.

Best regards,
Sergey Podlesny

On 16 май, 15:00, SergeyPo  wrote:
> I get the following error when call SQL table, when I have reference
> fields in my data table.
> E.g.:
>
> db.define_table('alarms',
>     SQLField('function_name', 'string', length=64),
>     SQLField('created_at', 'datetime',
> default=datetime.datetime.now()),
>     SQLField('header', db.headers),
>     SQLField('time_based', db.time_based, required=False),
>     SQLField('komment', 'string', length=255),
>     SQLField('ack_at', 'datetime', default=None, notnull=False),
>     SQLField('detail', db.details, required=False),
>     SQLField('investigation', db.investigations),
>     SQLField('internals', 'text'),
> )
> alarms_rs = db(eval(terms)).select( orderby=alarms_orderby,
>
> limitby=session.alarms_limitby,
>                                         )
> print alarms_rs #prints query results into console window, no errors
> at this point
> alarms_tbl = SQLTABLE(alarms_rs,
>                     _class='sortable',
>                     headers=headers_dict,
>                     truncate = 200,
>                     orderby=True)
>
> At this point error occures for the field SQLField('investigation',
> db.investigations).
> Here is a traceback:
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 181, in restricted
>     exec ccode in environment
>   File "C:/web2py/applications/advantage/controllers/alarms.py", line
> 842, in 
>   File "C:\web2py\gluon\globals.py", line 133, in 
>     self._caller = lambda f: f()
>   File "C:\web2py\gluon\tools.py", line 2335, in f
>     return action(*a, **b)
>   File "C:/web2py/applications/advantage/controllers/alarms.py", line
> 137, in alarms_table
>     orderby=True)
>   File "C:\web2py\gluon\sqlhtml.py", line 1366, in __init__
>     elif linkto and hasattr(field._table,'_primarykey') and fieldname
> in field._table._primarykey:
>   File "C:\web2py\gluon\dal.py", line 3457, in repr_ref
>     def repr_ref(id, r=referenced, f=ff): return f(r, id)
>   File "C:\web2py\gluon\dal.py", line 3426, in ff
>     row=r(id)
>   File "C:\web2py\gluon\dal.py", line 4387, in __call__
>     record = self._db(self.id == key).select(limitby=(0,1)).first()
>   File "C:\web2py\gluon\dal.py", line 5164, in select
>     return self.db._adapter.select(self.query,fields,attributes)
>   File "C:\web2py\gluon\dal.py", line 1077, in select
>     rows = response(sql)
>   File "C:\web2py\gluon\dal.py", line 1067, in response
>     self.execute(sql)
>   File "C:\web2py\gluon\dal.py", line 1152, in execute
>     return self.log_execute(*a, **b)
>   File "C:\web2py\gluon\dal.py", line 1147, in log_execute
>     ret = self.cursor.execute(*a,**b)
>   File "C:\web2py\gluon\contrib\pymysql\cursors.py", line 108, in
> execute
>     self.errorhandler(self, exc, value)
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 182, in
> defaulterrorhandler
>     raise Error(errorclass, errorvalue)
> Error: (, AssertionError('Protocol
> error, expecting EOF',))
>
> I tried to workaround by adding format to 'investigations' table, set
> represent=None to fields in question, this won't help. If
> db.alarms.investigation field is empty (None) error does not occur.
> MySQL console lets me select the record in investigations field, there
> are no problems with data.
>
> Looks like pymysql gives so many problems, won't it be better to go
> back to dbmysql? pymysql works 20% slower on my PC, application admin
> is not working on Windows and Debian installations since web2py
> version 1.92 (I reported on this usergroup)... why so many problems
> with contrib module?