Calling simple procedure raises ProgrammingError: (2014, "Commands out of sync; you can't run this command now") #115

Open
marcelomendes opened this Issue Nov 3, 2011 · 3 comments

Comments

Projects
None yet
3 participants
@marcelomendes

I'm having this issue while trying to call a procedure that performs a procedure simple select

import web
db = web.database(dbn='mysql', db='mydata', user='dbuser', pw='foo')
db.query("call sp_myprocedure")
627 if not self.ctx.transactions:
--> 628 self.ctx.commit()
629 return out
630

/usr/lib/pymodules/python2.7/web/db.pyc in commit(unload)
502 def commit(unload=True):
503 # do db commit and release the connection if pooling is enabled.

--> 504 ctx.db.commit()
505 if unload and self.has_pooling:
506 self._unload_context(self._ctx)

ProgrammingError: (2014, "Commands out of sync; you can't run this command now")

After googling around I found that this has to do with a open cursor not being closed or so. I can call this procedure normaly from mysql prompt or from MySQLdb python module. What is the correct way of calling procedures with web.py db api?

@aaronsw

This comment has been minimized.

Show comment
Hide comment
@aaronsw

aaronsw Nov 3, 2011

Contributor

I think you probably want to do it from within a with web.transaction():
block.

Contributor

aaronsw commented Nov 3, 2011

I think you probably want to do it from within a with web.transaction():
block.

@marcelomendes

This comment has been minimized.

Show comment
Hide comment
@marcelomendes

marcelomendes Nov 3, 2011

Hi, thanks for the quick reply, I'll check it out :)

Hi, thanks for the quick reply, I'll check it out :)

@jeremyklein

This comment has been minimized.

Show comment
Hide comment
@jeremyklein

jeremyklein Apr 2, 2015

This issue appears to be closed. @marcelomendes can you close this ticket?

This issue appears to be closed. @marcelomendes can you close this ticket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment