作者:mobiledu2502899797 | 来源:互联网 | 2023-07-17 10:08
通过psycopg2与数据库进行连接,发现可以进行查询操作:
sql = """select * from oms.cus_questions WHERE que_no = '20170606174216'"""
查询到的结果:
[['20170606174216', '1000', '1220', None, None, None, '1002', None, None, None, '提现到账查询', '未到账', None, None, None, None, False, datetime.datetime(2017, 6, 6, 17, 42, 7, 7293, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=480, name=None)), None, datetime.datetime(2017, 6, 6, 17, 42, 7, 7293, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=480, name=None)), None]]
修改主键值,将上面查询的结果,再次插入数据库,修改sql:
sql = """insert into oms.cus_questions("que_no", "loan_no", "usr_id", "phone_no", "ctif_id_no", "usr_name", "que_type", "que_status", "flow_no", "do_usr_id", "que_title", "que_description", "que_solution", "que_doing_tm", "crt_done_tm", "que_ower_id", "is_deleted", "crt_tm", "crt_usr", "last_upd_tm", "last_upd_usr") values('20170606174216', '1000', '1220', None, None, None, '1002', None, None, None, '提现到账查询', '未到账', None, None, None, None, False, datetime.datetime(2017, 6, 6, 17, 42, 7, 7293, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=480, name=None)), None, datetime.datetime(2017, 6, 6, 17, 42, 7, 7293, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=480, name=None)), None) """
报错:
psycopg2.ProgrammingError: 错误: 字段 "none" 不存在
LINE 1: ...d_usr") VALUES ('20270606174216', '1000', '1220', None, None...