When I do a query with isql I get the following message and the query blocks.
The transaction log in database foo is almost full. Your transaction is being suspended until space is made available in the log.
When I do the same from Python:
cursor.execute(sql)
The query blocks, but I would like see this message.
I tried:
Sybase.set_debug(sys.stderr)
connection.debug = 1
I'm using:
EDIT: The question is, "How do I capture this warning message in the python program?"
Good question and I'm not sure I can completely answer it. Here are some ideas.
Sybase.py uses logging. Make sure you are using it. To "bump" the logging out I would do this:
import logging
logging.basicConfig(level = logging.INFO,
format = "%(asctime)s %(levelname)s [%(filename)s] (%(name)s) %(message)s",
datefmt = "%H:%M:%S", stream = sys.stdout)
log = logging.getLogger('sybase')
log.setLevel(logging.DEBUG)
And apparently (why is beyond me??) to get this working in Sybase.py you need to set a global DEBUG=True
(see line 38)
But then if we look at def execute
we can see (as you point out) that it's blocking. We'll that sort of answers your question. You aren't going to get anything back as it's blocking it. So how do you fix this - write a non-blocking excute method;) There is some hints in examples/timeout.py. Apparently someone else has run up on this but hasn't really fixed it.
I know this didn't probably help but I spent 15 minutes looking - I should at least tell you what I found.. You would think that execute
would give you some result
-- Wait what is the value of result in line 707??
while 1:
status, result = self._cmd.ct_results()
if status != CS_SUCCEED:
break
If status != CS_SUCCEED (which I'm assuming in your case is True) can you simply see what "result" is equal to? I wonder if they just failed raise the result as an exception?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With