Re: [web2py] Re: Error db._adapter

2015-12-09 Thread Hector Chacon
good afternoon, I explain how to solve the problem in question, so that the method ".executesql" the DAL object fails with the message "'NoneType' object is not iterable" the problem is that when you run a stored procedure, the method attempts to obtain the return of the execution of the senten

Re: [web2py] Re: Error db._adapter

2013-02-27 Thread __pyslan__ - Ayslan Jenken
I understand ... It really is something to think about. In this case we would need an expert in database in general. At least we'd have to test with all databases supported by DAL currently. We should not forget too that we are talking about a particular situation . On Wed, Feb 27, 2013 at 1:01 P

Re: [web2py] Re: Error db._adapter

2013-02-27 Thread Massimo Di Pierro
Fascinating I wonder if this logic should be built-in into executesql somehow but I am not sure it it supported by all adapters and I am not sure how it could be done. On Wednesday, 27 February 2013 09:44:09 UTC-6, __pyslan__ wrote: > > For those interested, below the solution to the proble

Re: [web2py] Re: Error db._adapter

2013-02-27 Thread __pyslan__ - Ayslan Jenken
For those interested, below the solution to the problem: def users(): user_id = auth.user_id fields = [db.auth_user.generation, db.auth_user.id, db.auth_user.first_name] proc = 'CALL sp_recursive_start(' + str(user_id) + ');' raw_rows = db.executesql(proc, fields=fields) wh

Re: [web2py] Re: Error db._adapter

2013-02-26 Thread __pyslan__ - Ayslan Jenken
Ok. Thanks. On Tue, Feb 26, 2013 at 2:43 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Now we ruled out web2py completely in this. You need a MySQL expert. > > > On Tuesday, 26 February 2013 06:14:35 UTC-6, __pyslan__ wrote: > >> The result is the same error... >> >> I get the res

Re: [web2py] Re: Error db._adapter

2013-02-26 Thread Massimo Di Pierro
Now we ruled out web2py completely in this. You need a MySQL expert. On Tuesday, 26 February 2013 06:14:35 UTC-6, __pyslan__ wrote: > > The result is the same error... > > I get the result as (1), but the error is always thrown. > > > > > On Tue, Feb 26, 2013 at 2:25 AM, Massimo Di Pierro > > >

Re: [web2py] Re: Error db._adapter

2013-02-26 Thread __pyslan__ - Ayslan Jenken
The result is the same error... I get the result as (1), but the error is always thrown. On Tue, Feb 26, 2013 at 2:25 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Try: > > import MySQLdb > conn.MySQLdb.connect(db=db, >user=user, >

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Massimo Di Pierro
Try: import MySQLdb conn.MySQLdb.connect(db=db, user=user, passwd=passwd, host=host, port=port, charset=charset) curr = conn.cursor() curr.execute('CALL sp_recursive_start

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
Well, I downloaded mysql.connector from the link. I put it in the folder gluon.contrib. I put the code below in file dal.py: try: try: import contrib.mysql_connector as mysqlconn except ImportError: import mysql.connector DRIVERS.append('MySQL(

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
I have not the faintest idea how to do that, and this feature is essential for the project. I can not build a recursive function due to performance. With great respect I ask, should I give up web2py in this case? On Mon, Feb 25, 2013 at 2:28 PM, Niphlod wrote: > well, I doubt that workbench u

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Niphlod
well, I doubt that workbench uses a python dbapi. >From where I stand, you should try to make that work on the adapter (i.e. without web2py) and see if there it works in my pov, mysql returns different resultsets for that kind of stored proc: one is the result of the line inserted in a loop

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Massimo Di Pierro
The code below is equivalent to: sql> CALL sp_recursive_start(1); sql> ROLLBACK; web2py is not adding anything to it. This demonstrates that the problem is completely with the code in "sp_recursive_start". You are getting an OperationError from the database on rollback. My guess is that there

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
I got it: In [1]: fields = [db.auth_user.generation, db.auth_user.id, db.auth_user.first_name] In [2]: raw_rows = db.executesql('CALL sp_recursive_start(1);', fields=fields) In [3]: db.rollback() --- ProgrammingError

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Massimo Di Pierro
This is a database issue more than a web2py issue but I am interested to get to the bottom of it. Can you ty open a web2py shell $ python web2py.py -S yourapp -M >>> fields = [db.auth_user.generation, db.auth_user.id, db.auth_user. first_name] >>> raw_rows = db.executesql('CALL sp_recursive_sta

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
No, Massimo, is not ... With or without the try... except... the error is the same ... I've tried this several times. The code of gist: https://gist.github.com/pyslan/5007364 (without try... except...) print it on the terminal server: ERROR:web2py:Traceback (most recent call last): File "/hom

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread Massimo Di Pierro
This is causing the problem. What if you remove the try... except? What ticket do you get? try: raw_rows = db.executesql('CALL sp_recursive_start(1);', fields=fields) except Exception, e: print 'ERROR NOW:', e db.rollback() On Saturday, 23 February 2013 12:58:4

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread __pyslan__ - Ayslan Jenken
After reading this thread, as Anthony suggested, I tried this: import MySQLdb from gluon.dal import MySQLAdapter MySQLAdapter.driver = MySQLdb After that, even commenting this block of code I get the result correctly because the print rows, but

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread __pyslan__ - Ayslan Jenken
Please... What i have to close after db.executesql() ??? If I try do it: print len(db(db.auth_user).select(limitby=(0,1))) In: def users_test(): try: raw_rows = db.executesql('CALL sp_recursive_start(1);') except Exception, e: db.rollback() raise e fields

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread __pyslan__ - Ayslan Jenken
I commented the use of _adapter.parser, and the error no longer occurs, but the data of db.executesql('CALL sp_recursive_start(1);') bring nothing every other refresh. On Sat, Feb 23, 2013 at 1:36 PM, __pyslan__ - Ayslan Jenken < ayslan.pyt...@gmail.com> wrote: > Ok... I removed every try/except

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread __pyslan__ - Ayslan Jenken
Ok... I removed every try/except of my code to see the error logged by web2py. https://gist.github.com/pysI'm begginer in web2py...lan/5007364 The error occur every other refresh... 'NoneType' object is not iterable ... in this line: if db(db.auth_user

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread Massimo Di Pierro
Moreover because the true cause of the problem is in a try/except the actual error is not logged by web2py. On Saturday, 23 February 2013 09:46:22 UTC-6, Massimo Di Pierro wrote: > > Have you removed the db statements inside tryexcept...? That's the > cause of the problem. if a db command fa

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread Massimo Di Pierro
Have you removed the db statements inside tryexcept...? That's the cause of the problem. if a db command fails, the db may close connection and your driver raises an exception. Your code catches the exception and pretends to continue execution but the database is telling you the connection w

Re: [web2py] Re: Error db._adapter

2013-02-23 Thread __pyslan__ - Ayslan Jenken
Hello everybody, I have not found a solution yet ... Does anyone have any idea how I could do? Thanks... On Fri, Feb 22, 2013 at 9:33 AM, __pyslan__ - Ayslan Jenken < ayslan.pyt...@gmail.com> wrote: > Well... > > Sorry, but the information about the code comment is wrong... > > I uncomment

Re: [web2py] Re: Error db._adapter

2013-02-22 Thread __pyslan__ - Ayslan Jenken
Well... Sorry, but the information about the code comment is wrong... I uncomment the code block "if db(db.auth_user).isempty():" and the error not thrown. With or without the code block above, in the terminal server is shown the error: DEBUG: connect attempt 0, connection error: Traceback (mos

Re: [web2py] Re: Error db._adapter

2013-02-22 Thread __pyslan__ - Ayslan Jenken
Hello, Massimo. With this change is launched this error: Traceback (most recent call last): File "/ home/ctx/PROJECTS/WEB/web2py/gluon/main.py", line 632, in wsgibase BaseAdapter.close_all_instances ('rollback') File "/ home/ctx/PROJECTS/WEB/web2py/gluon/dal.py", line 543, in close_all

[web2py] Re: Error db._adapter

2013-02-21 Thread Massimo Di Pierro
Does it work if you replace db(db.auth_user).isempty(): with len(db(db.auth_user).select(limitby=(0,1))) * * *This is not a solution but can help me understand. * On Thursday, 21 February 2013 14:07:25 UTC-6, __pyslan__ wrote: > > Sorry... > > The error occur on line 3 of this file: > > https:/

Re: [web2py] Re: Error db._adapter

2013-02-21 Thread __pyslan__ - Ayslan Jenken
Hi, Niphlod. The rollback will be placed, no doubt. I had tests done without using db._adapter.parse and the error is the same. On Thu, Feb 21, 2013 at 5:21 PM, Niphlod wrote: > trying to give out some hints. seems that the first query you run after > calling the sp doesn't find a resultset.

[web2py] Re: Error db._adapter

2013-02-21 Thread Niphlod
trying to give out some hints. seems that the first query you run after calling the sp doesn't find a resultset. possible problems: - whenever raising an exception on db.executesql, always call db.rollback() to flush out the cursor - instead of using db._adapter.parse, just pass fields and colnam

[web2py] Re: Error db._adapter

2013-02-21 Thread __pyslan__ - Ayslan Jenken
Sorry... The error occur on line 3 of this file: https://gist.github.com/pyslan/5007722 On Thu, Feb 21, 2013 at 4:45 PM, __pyslan__ - Ayslan Jenken < ayslan.pyt...@gmail.com> wrote: > Hello, Erevybody! > > I am using MySQL on a project and created two procedures to perform a > recursion, becau