b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

将SQLite3迁移到MySQL的迅速快捷办法?

电脑杂谈  发布时间:2019-08-16 01:07:50  来源:网络整理

sqlite3 mysql_mysql sqlite3_sqlite3 下载

这是一个python插件,基于Shalmanese的答案和Alex martelli在翻译Perl到Python的一些帮助我正在制做社区维基mysql sqlite3mysql sqlite3,所以请随意编辑和闭环,只要它不会破坏系统(谢天谢地我们可以回滚) - 这很难看还是很有效像如此使用(假设脚本被读取dump_for_mysql。py:sqlite3 sample。db 。dump | python dump_for_mysql。py > dump。sql然后你可以导出到mysql中提醒 - 您需要手动添加外键约束,因为sqlite实际上不支持这些这是插件:#!/usr/bin/env pythonimport reimport fileinputdef this_line_is_useless(line):    useless_es = [        'BEGIN TRANSACTION',        'COMMIT',        'sqlite_sequence',        'CREATE UNIQUE INDEX',        'PRAGMA foreign_keys=OFF',    ]    for useless in useless_es:        if re。

search(useless, line):            return Truedef has_primary_key(line):    return bool(re。search(r'PRIMARY KEY', line))searching_for_end = Falsefor line in fileinput。input():    if this_line_is_useless(line):        continue    # this line was necessary because '');    # would be converted to \'); which isn't appropriate    if re。

mysql sqlite3_sqlite3 下载_sqlite3 mysql

match(r"。*, ''\);", line):        line = re。sub(r"''\);", r'``);', line)    if re。match(r'^CREATE TABLE。*', line):        searching_for_end = True    m = re。

search('CREATE TABLE "?(\w*)"?(。*)', line)    if m:        name, sub = m。groups()        line = "DROP TABLE IF EXISTS %(name)s;\nCREATE TABLE IF NOT EXISTS `%(name)s`%(sub)s\n"        line = line % dict(name=name, sub=sub)    else:        m = re。

mysql sqlite3_sqlite3 下载_sqlite3 mysql

search('INSERT INTO "(\w*)"(。*)', line)        if m:            line = 'INSERT INTO %s%s\n' % m。groups()            line = line。

replace('"', r'\"')            line = line。replace('"', "'")    line = re。sub(r"([^'])'t'(。)", "\1THIS_IS_TRUE\2", line)    line = line。replace('THIS_IS_TRUE', '1')    line = re。

sqlite3 mysql_sqlite3 下载_mysql sqlite3

sub(r"([^'])'f'(。)", "\1THIS_IS_FALSE\2", line)    line = line。replace('THIS_IS_FALSE', '')    # Add auto_increment if it is not there since sqlite auto_increments ALL    # primary keys    if searching_for_end:        if re。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-119390-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...