|
if first.WhichOneof('response') == 'message': |
|
# if the first line is html tag like, |
|
# merge all return strings then render the html on notebook |
|
if re.match(r'<[a-z][\s\S]*>.*', first.message.message): |
|
resp_list = [first.message.message] |
|
for res in stream_response: |
|
if res.WhichOneof('response') == 'eoe': |
|
_LOGGER.info("end execute %s, spent: %d" % (res.eoe.sql, res.eoe.spent_time_seconds)) |
|
compound_message.add_html('\n'.join(resp_list), res) |
|
break |
|
resp_list.append(res.message.message) |
|
from IPython.core.display import display, HTML |
|
display(HTML('\n'.join(resp_list))) |
|
else: |
|
all_messages = [] |
|
all_messages.append(first.message.message) |
|
eoe = None |
|
for res in stream_response: |
|
if res.WhichOneof('response') == 'eoe': |
|
_LOGGER.info("end execute %s, spent: %d" % (res.eoe.sql, res.eoe.spent_time_seconds)) |
|
eoe = res |
|
break |
|
_LOGGER.debug(res.message.message) |
|
all_messages.append(res.message.message) |
|
compound_message.add_message('\n'.join(all_messages), eoe) |
From the above implementation, all the logs would be show in the Notebook at the end of sql program execution.
pysqlflow/sqlflow/client.py
Lines 126 to 150 in da0fffd
From the above implementation, all the logs would be show in the Notebook at the end of sql program execution.