【发布时间】:2015-02-18 12:29:01
【问题描述】:
我正在尝试使用 mysql-python 从“foo”表中获取“bar_ids”。为此,我收到以下错误,并且只收到几个 bar_id。如何在没有警告错误的情况下正确获取此信息?
我的表格如下图:
create table foo (foo_id int, bar_id int, foo_name varchar(255))
我的查询和错误:
foo_ids = 16600, 16602, 16607, 16609, 16611, 16613
警告:第 1 行的“bar_id”列的数据被截断
cursor.execute("""select bar_id from foo where foo_id in (%s)""", (foo_ids,))
警告:截断不正确的 DOUBLE 值:'16600、16602、16607、16609、16611、16613'
cursor.execute("""select bar_id from foo where foo_id in (%s)""", (foo_ids,))
【问题讨论】:
-
谢谢! @cwallenpoole
标签: python mysql mysql-python