Changes between Version 2 and Version 3 of SqLiteToMySql
- Timestamp:
- May 5, 2007, 12:14:34 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SqLiteToMySql
v2 v3 35 35 cat trac.mysql.sql trac.sqlite.sql.dataonly > trac.sql 36 36 }}} 37 38 ---- 39 40 An alternatice to the cleansql above (that works a bit better): 41 {{{ 42 43 $ cat cleansql.py 44 #!/usr/bin/env python 45 46 import sys 47 import re 48 49 file = sys.stdin.read() 50 file = re.sub(r'(CREATE (TABLE|INDEX)[^;]*|COMMIT|BEGIN TRANSACTION);', '', file) 51 file = re.sub(r'INSERT INTO "([^"]+)"', lambda m: 'INSERT INTO `%s`' % m.groups(1), file) 52 sys.stdout.write(file) 53 54 $ cat trac.sqlite.sql | ./cleansql.py > trac.sqlite.sql.dataonly 55 }}}