1. /************************************************************************
  2. * Warning: Data truncated for column 'AirPress' at row 1
  3. * 说明:
  4. * 最近往MySQL中存入数据时,总是看到这个Warning,花点时间来找一下原因。
  5. *
  6. * 2016-10-20 深圳 南山平山村 曾剑锋
  7. ***********************************************************************/
  8.  
  9. 一、参考文档:
  10. python float类型转string类型,要求精度不能丢失!!!
  11. http://bbs.csdn.net/topics/390236828
  12.  
  13. 二、原因解析:
  14. . MySQL中对应的字段中采用类型是:decimal(,);
  15. . Python中对应的字段采用float类型;
  16. . float类型变量直接通过str()函数存入MySQL字段中会出现类似如下警告:
  17. Warning: Data truncated for column 'AirPress' at row
  18. . 将[str()]函数换成["%.4f" % 变量名]就可避免;
  19. . 原因是str()转换出来float类型数据精度大于4,造成数据被truncated

Warning: Data truncated for column 'AirPress' at row 1的更多相关文章

  1. Warning: Data truncated for column 'xxxx' at row 1

    The problem was that I changed the column's length only in the program.I had to do either change the ...

  2. mysql Out of range value adjusted for column导致Warning(1265)Data truncated for column 'column_name' at row 1

    今天下午,我们的一个开发来找我,说线上有个环境报了"Warning(1265)Data truncated for column 'column_name' at row 1",定 ...

  3. mysql 由decimal 引起的 Warning: Data truncated for column

    今天在使用python 库mysqldb的rawsql的时候遇到一个问题(其实并不是mysqlbean引起的) cls.raw_sql('update {table} set available_am ...

  4. mysql导入文件出现Data truncated for column 'xxx' at row 1的原因

    mysql导入文件的时候很容易出现"Data truncated for column 'xxx' at row x",其中字符串里的xxx和x是指具体的列和行数. 有时候,这是因 ...

  5. java.sql.SQLException: Data truncated for column 'lastSeason' at row 1

    在使用项目将数据存储到 datetime 的字段 ,抛出了这个异常 而我是使用Java.util.Date 存储过去的 解决代码如下: Date date = new Date(); demo.set ...

  6. java.sql.SQLException: Data truncated for column 'seat_number' at row 1

    项目中try catch 出现这种情况,就去检查下数据库列类型和项目中实体类的id类型是否一致.数据库id是int类型的,项目实体类是String类型的,项目save功能无法保存,导致了我的这个异常.

  7. [MySQL学习]STRICT_ALL_TABLES相应的OUT of RANGE VALUE FOR COLUMN和DATA truncated FOR COLUMN

    版权声明:声明:本文档能够转载,须署名原作者. 作者:无为 qq:490073687 周祥兴 zhou.xiangxing210@163.com https://blog.csdn.net/Rooki ...

  8. MySQL中 Data truncated for column 'xxx'解决方法

    DATA truncated FOR COLUMN 'description' AT ROW 1 1.错误再现 表中存在null字段 此时,修改表中某字段为主键 2.解决方法 不允许数据库中出现nul ...

  9. Data truncated for column xxx

    对于字段XXX,数据发生截断.原因是:字段的取值,不满足约束条件.比如下面的情况: 原来的字段取值为null,现在约束字段not null,就会报错Data truncated for column ...

随机推荐

  1. struts2视频学习笔记 22-23(基于XML配置方式实现对action的所有方法及部分方法进行校验)

    课时22 基于XML配置方式实现对action的所有方法进行校验   使用基于XML配置方式实现输入校验时,Action也需要继承ActionSupport,并且提供校验文件,校验文件和action类 ...

  2. Eclipse 反编译器

    Help-->Install New SoftWare 贴上反编译地址:http://opensource.cpupk.com/decompiler/update/ 选择add,一路向北,起飞.

  3. [转]Perfmon - Windows 自带系统监测工具

    以下内容转自:http://blog.csdn.net/oscar999/article/details/7918385 ---------------------------分割线--------- ...

  4. linux 查看僵尸进程

    top -b -i -n 1 查看僵死进程命令 ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' 查看apache 当前进程数 ps -ef | grep ht ...

  5. Graphical installers are not supported by the vm

    http://www-01.ibm.com/support/docview.wss?uid=swg21462180 Technote (troubleshooting) Problem(Abstrac ...

  6. mark 一下

    Android资源管理框架(Asset Manager)简要介绍和学习计划 http://www.cnblogs.com/hjtdlx/p/4332060.html

  7. 复利计算4.0单元测试(c语言)

    ——————————复利计算程序单元测试报告—————————— ————————————4.0 单元测试—————————————— ————————————————要求—————————————— ...

  8. CodeForces 86D(Yandex.Algorithm 2011 Round 2)

    思路:莫队算法,离线操作,将所有询问的左端点进行分块(分成sqrt(n) 块每块sqrt(n)个),用左端点的块号进行排序小的在前,块号相等的,右端点小的在前面. 这样要是两个相邻的查询在同一块内左端 ...

  9. validator

    http://rickharrison.github.io/validate.js/validate.js rules: 'required|callback_check_password' vali ...

  10. SQL学习心得(转)

    http://www.cnblogs.com/lyhabc/p/3732942.html