with o.execute_sql("select * from table_name where a='01234556'").open_reader() as reader:
for record in reader:
print(record)
Traceback (most recent call last): File "D:/Python36/odps/venv/dataworks/odps111.py", line 42, in for record in reader: File "D:\Python36\odps\venv\lib\site-packages\odps\models\instance.py", line 823, in iter for record in self.read(): File "D:\Python36\odps\venv\lib\site-packages\odps\models\instance.py", line 846, in read for record in reader[::step]: File "D:\Python36\odps\venv\lib\site-packages\odps\readers.py", line 88, in _iter record = next(self) File "D:\Python36\odps\venv\lib\site-packages\odps\tunnel\io\reader.py", line 206, in next record = self.read() File "D:\Python36\odps\venv\lib\site-packages\odps\tunnel\io\reader.py", line 200, in read record[i] = self._read_field(self._columns[i].type) File "D:\Python36\odps\venv\lib\site-packages\odps\types.py", line 447, in setitem self._set(key, value) File "D:\Python36\odps\venv\lib\site-packages\odps\types.py", line 423, in _set val = validate_value(value, data_type) File "D:\Python36\odps\venv\lib\site-packages\odps\types.py", line 1454, in validate_value res = data_type.validate_composite_values(value) File "D:\Python36\odps\venv\lib\site-packages\odps\types.py", line 1087, in validate_composite_values self.validate_value(value) File "D:\Python36\odps\venv\lib\site-packages\odps\types.py", line 1058, in validate_value scaled_val = val.quantize(to_scale, _decimal.ROUND_HALF_UP) decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]
Process finished with exit code 1
可以使用双引号将字段名括起来,例如:
SELECT "0fieldname" FROM table_name;
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
MaxCompute(原ODPS)是一项面向分析的大数据计算服务,它以Serverless架构提供快速、全托管的在线数据仓库服务,消除传统数据平台在资源扩展性和弹性方面的限制,最小化用户运维投入,使您经济并高效的分析处理海量数据。