Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
marcelomendes opened this issue Nov 3, 2011 · 3 comments

Comments

@marcelomendes
Copy link

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
Copy link
Contributor

aaronsw commented Nov 3, 2011

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

@marcelomendes
Copy link
Author

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

@jeremyklein
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants