You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating the report as html the following error occurs:
Traceback (most recent call last):
File "test_ingestion_xmls.py", line 1564, in
sqltap.report(statistics, "report.html", report_format="html")
File "/usr/local/lib/python3.4/dist-packages/sqltap/sqltap.py", line 534, in report
result = reporter.report()
File "/usr/local/lib/python3.4/dist-packages/sqltap/sqltap.py", line 381, in report
f.write(content)
TypeError: must be str, not bytes
Casting content as str makes visible the error:
KeyError: 'ingestion_duration'
/usr/local/lib/python3.4/dist-packages/sqltap/templates/html.mako, line 145:
% for idx, query in enumerate(reversed(group.queries)):
<trclass="${'hidden' if idx >= 3 else ''}"><td>${'%.3f' % query.duration}</td>
% for param_name in params:
<td>${query.params[param_name]}</td> ## Here it seems to be the issue
% endfor
<td>${'%d' % query.rowcount}</td><td>${'%d' % query.params_id}</td></tr>
% endfor
This parameter is never used so I don't really understand why it is trying to use it.
Workaround to fix the issue
% for idx, query in enumerate(reversed(group.queries)):
<trclass="${'hidden' if idx >= 3 else ''}"><td>${'%.3f' % query.duration}</td>
% for param_name in params:
% if param_name in query.params: ## Enters only if key exists
<td>${query.params[param_name]}</td>
% endif
% endfor
<td>${'%d' % query.rowcount}</td><td>${'%d' % query.params_id}</td></tr>
% endfor
So, now it is accessing the parameters if they are available.
The text was updated successfully, but these errors were encountered:
When generating the report as html the following error occurs:
Traceback (most recent call last):
File "test_ingestion_xmls.py", line 1564, in
sqltap.report(statistics, "report.html", report_format="html")
File "/usr/local/lib/python3.4/dist-packages/sqltap/sqltap.py", line 534, in report
result = reporter.report()
File "/usr/local/lib/python3.4/dist-packages/sqltap/sqltap.py", line 381, in report
f.write(content)
TypeError: must be str, not bytes
Casting content as str makes visible the error:
KeyError: 'ingestion_duration'
/usr/local/lib/python3.4/dist-packages/sqltap/templates/html.mako, line 145:
This parameter is never used so I don't really understand why it is trying to use it.
Workaround to fix the issue
So, now it is accessing the parameters if they are available.
The text was updated successfully, but these errors were encountered: