最近在工作遇到数据库中存的数据类型是: decimal(14,4)

遇到的问题是:

当我使用python 读取到内存中时,总是带着 decimal字符, 再写入其它mysql表中时,数据类型为int型,导致数据入库不成功.

import pymysql# 创建数据库连接con = pymysql.connect()sql = '''selectcreated_timefrom schma.tableLIMIT 10'''try:  cur = con.cursor(cursor=pymysql.cursors.DictCursor)  cur.execute(sql)except Exception as e: print(e)else: data = cur.fetchall()finally: cur.close() con.close()for d in data: created_time = d.get('created_time') print(created_time)
selectcast(created_time as signed) AS created_time from schma.table

更多相关文章

  1. MySQL系列多表连接查询92及99语法示例详解教程
  2. Linux下MYSQL 5.7 找回root密码的问题(亲测可用)
  3. MySQL 什么时候使用INNER JOIN 或 LEFT JOIN
  4. android从服务器下载文件(php+apache+win7+MySql)
  5. 【有图】android通过jdbc连接mysql(附文件)
  6. Android开发 数据库操作
  7. android中的数据库操作
  8. android 通过php 连接 mysql
  9. android通过php连接mysql数据库!!!!

随机推荐

  1. 最新eclipse中android插件安装下载地址
  2. Android带返回值的窗口跳转
  3. android edittext 去边框 去下划线
  4. Android全透明Activity示例
  5. appium測試中验证toast的正确性
  6. Android压缩
  7. 代码中如何设置TextView为不可见
  8. Android判断当前线程是否是主线程的方法
  9. Android(安卓)OpenGL ES(八)----纹理编程
  10. android-passwordsafe - Android Passwor