mysql-to-sqlite3: Default column value not getting converted from mysql
Describe the bug The default column values don’t seem to get converted to sqlite. Here’s the command that was run to generate the output:
mysql2sqlite -f mydb.db -d mydb -u myuser --mysql-password mypwd -t dispatcher
Here’s the actual table schema in mysql 5.7:
CREATE TABLE `dispatcher` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`setid` int(11) NOT NULL DEFAULT '0',
`destination` varchar(192) NOT NULL DEFAULT '',
`flags` int(11) NOT NULL DEFAULT '0',
`priority` int(11) NOT NULL DEFAULT '0',
`attrs` varchar(128) NOT NULL DEFAULT '',
`description` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `description` (`description`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=595 DEFAULT CHARSET=latin1;
Expected behaviour
sqlite> .schema dispatcher
CREATE TABLE "dispatcher" (
"id" INTEGER NOT NULL,
"setid" INTEGER NOT NULL DEFAULT '0',
"destination" VARCHAR(192) NOT NULL DEFAULT '',
"flags" INTEGER NOT NULL DEFAULT '0',
"priority" INTEGER NOT NULL DEFAULT '0',
"attrs" VARCHAR(128) NOT NULL DEFAULT '',
"description" VARCHAR(64) NOT NULL DEFAULT '',
PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "dispatcher_description" ON "dispatcher" ("description");
Actual result
sqlite> .schema dispatcher
CREATE TABLE "dispatcher" (
"id" INTEGER NOT NULL,
"setid" INTEGER NOT NULL,
"destination" VARCHAR(192) NOT NULL,
"flags" INTEGER NOT NULL,
"priority" INTEGER NOT NULL,
"attrs" VARCHAR(128) NOT NULL,
"description" VARCHAR(64) NOT NULL,
PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "dispatcher_description" ON "dispatcher" ("description");
System Information
$ mysql2sqlite --version
| software | version |
|---|---|
| mysql-to-sqlite3 | 1.4.0 |
| Operating System | Linux 3.10.0-1160.2.2.el7.x86_64 |
| Python | CPython 2.7.5 |
| MySQL | mysql Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using EditLine wrapper |
| SQLite | 3.7.17 |
| click | 7.1.2 |
| mysql-connector-python | 8.0.23 |
| python-slugify | 5.0.0 |
| pytimeparse | 1.1.8 |
| simplejson | 3.17.2 |
| six | 1.9.0 |
| tabulate | 0.8.9 |
| tqdm | 4.61.1 |
BTW, thanks for this tool. It seems to work very well. I’ve tried others and they all failed to produce a production ready sqlite export but this one seems great 😃
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- :bug: Fix #16 — committed to techouse/mysql-to-sqlite3 by techouse 3 years ago
- :bug: Fix #16 — committed to techouse/mysql-to-sqlite3 by techouse 3 years ago
- :bug: Fix #16 — committed to techouse/mysql-to-sqlite3 by techouse 3 years ago
- :bug: Fix #16 — committed to techouse/mysql-to-sqlite3 by techouse 3 years ago
Wow quick fix! Really appreciate this!