当我尝试使用0000-00-00 00:00:00
查询包含sqlachemy
等日期的数据库时,我得到ValueError: year is out of range
。
这是db dump:
这是堆栈跟踪:
File "/home/rob/.virtualenvs/calif/lib/python3.5/site-packages/sqlalchemy/engine/result.py" in items
163. return [(key, self[key]) for key in self.keys()]
File "/home/rob/.virtualenvs/calif/lib/python3.5/site-packages/sqlalchemy/engine/result.py" in <listcomp>
163. return [(key, self[key]) for key in self.keys()]
File "/home/rob/.virtualenvs/calif/lib/python3.5/site-packages/sqlalchemy/engine/result.py" in __getitem__
90. return processor(self._row[index])
File "/home/rob/.virtualenvs/calif/lib/python3.5/site-packages/sqlalchemy/processors.py" in process
48. return type_(*list(map(int, m.groups(0))))
Exception Type: ValueError at /
Exception Value: year is out of range
这是正常的吗? sqlalchemy可以读这样的日期吗?这是python的限制吗?有没有解决方法来保持日期不变(不转换为无)?
答案 0 :(得分:0)
通过IRC上的inklesspen
获得答案:Python datetime representation has minimum year and it's 1