python/烧瓶查询返回正确数量的单元格的空表格

发布于 2025-01-25 15:36:13 字数 92 浏览 4 评论 0 原文

我正在做这个Python烧瓶项目。

当我执行查询时,结果网页显示了带有正确数量的行,列和单元格的结果表,但所有单元格都是空的。

[删除代码]

I'm doing this python flask project.

When I'm executing a query, the resulting webpage shows the resulting table with the correct number of rows and columns and cells but all the cells are empty.

[removed code]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅忆 2025-02-01 15:36:13

通过请求 dictcursor ,结果似乎应该按表列为表列名称键入,就像在此处的文件顶部的测试用例中一样:https://github.com/PyMySQL/PyMySQL/blob/main/pymysql/tests/test_DictCursor. py

在这种情况下,您需要将登录器从索引更改为列名,例如 {{item [0]}} {{item [item [item ['colname']}}

By requesting DictCursor as you are, it seems the results should be coming as dicts keyed by table column names, as in the test cases at the top of the file here: https://github.com/PyMySQL/PyMySQL/blob/main/pymysql/tests/test_DictCursor.py

In that case you need to change your accessors from indexes to column names, e.g. {{item[0]}} to {{item['colname']}}.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文