如何在pymysql中截断分区

时间:2018-11-19 14:10:17

标签: python mysql pymysql

import pymysql
conn = pymysql.connect(host = DB_HOST,
                      port = DB_PORT,
                      user = DB_USER,
                      password = DB_PASSWD,
                      db = DB_DATABASE
                      )
cur = conn.cursor()
sql=''
try:
    sql = "alter table t_data_video_daily truncate partition p_20181117"
    print sql
    cur.execute(sql)
    conn.commit()
except  BaseException,e:
    print '%s,exception:%s '  % (sql,str(e))
    exit(1)
else:
    print '%s run ok'  % (sql)

然后我遇到错误:

alter table t_data_video_daily truncate partition p_20181117,exception:(1399, u'XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state')

如何完成全球交易? pymysql不支持吗?帮助,谢谢。

0 个答案:

没有答案