增加 pre_dst_exec 配置,可以在目标库执行pre sql
diff --git a/v2convert.py b/v2convert.py
index 178aef9..d23a210 100755
--- a/v2convert.py
+++ b/v2convert.py
@@ -12,7 +12,7 @@
import re
-VERSION = "1.3"
+VERSION = "1.4"
SYSENCODING = locale.getdefaultlocale()[1]
if not SYSENCODING:
@@ -180,6 +180,14 @@
return False
self._src_db.commit()
+ if 'pre_dst_exec' in rule:
+ for statment in rule['pre_dst_exec']:
+ if not self._do_execute_sql(self._dst_db.cursor, statment):
+ print u"执行 pre_dst_exec 语句失败"
+ self._dst_db.rollback()
+ return False
+ self._dst_db.commit()
+
if not self._do_execute_sql(query_cursor, rule['src_sql']):
print u"查询原始数据失败"
return False