为什么我的查询会出现 HY000 pyodbc 错误?
我的 Sybase 查询非常简单,例如。
select adjusted_weight from v_temp_idx_comp where ric_code='0005.HK' and index_ric_code='.HSI'
查询返回除一列之外的所有列的结果 ->调整后的权重。每当我在查询中包含此列时,都会收到以下错误
pyodbc.Error: 'HY000', 'The driver did not supply an error!')
adjusted_weight
为此表定义的列数据类型是数字,这是正确的。事实上,当我使用其他一些应用程序(使用其他驱动程序)运行此查询时,我得到的结果没有任何错误。仅当我使用 pyodbc 从 python 查询时才遇到问题。
我使用的是 Windows 7 机器,Python 版本 2.6.1 Sybase 驱动程序:{Adaptive Server Enterprise}
我的列有什么问题吗?我该如何解决这个问题?
My Sybase query is quite simple for eg.
select adjusted_weight from v_temp_idx_comp where ric_code='0005.HK' and index_ric_code='.HSI'
Query returns result for all columns except for one column -> adjusted_weight. Whenever I include this column in my query I get following error
pyodbc.Error: 'HY000', 'The driver did not supply an error!')
adjusted_weight
column data type defined for this table is numeric which is correct. In fact when I run this query using some other application (which uses other driver) I get results without any error. I have issue only when I query from python using pyodbc.
I am using windows 7 machine, python version 2.6.1 Sybase driver: {Adaptive Server Enterprise}
What is wrong with my column? How can I resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决了这个问题。问题出在我正在询问的观点上。其中一列的精度(使用某些操作自动计算)超出了 sybase 标准支持的精度。有些驱动程序可以在手术前处理它,但有些则不能。 Sybas 自己的驱动程序无法正确报告错误。
resolved this issue. the problem was in the view that i am querying. the precision of one of the columns (which is calculated automatically using some operation) is more than what is supported by sybase standards. Some drivers handle it preopery but some cannot. Sybas's own driver doesn't report error correctly.
当使用无法在arm cpu(例如mac M1)上运行的pyodbc的预编译版本时,也会引发此错误。这是解决方案:
该软件包没有为arm正确编译,您可以卸载,在我的例子中pyodb并重新安装。如果使用brew,它会像这样:
并在本地编译安装:
Also this error is thrown when using a precompiled version of pyodbc that is not working on arm cpu, like mac M1. Here is the solution:
The package is not compiled properly for arm,you can uninstall, in my case pyodbcand install it again. If using brew, it would be like this:
and install with compiling it locally: