Skip to content

Fix transferring composite primary keys when AUTOINCREMENT present #80

@tianzhuqiao

Description

@tianzhuqiao

Thanks for the great project. I am trying to convert the mysql database to sqlite. It works great, but it complains for one table that

ERROR    SQLite failed creating table abc: table "abc" has more than one primary key

Is it expected? I checked sqlite, looks like it shall support multiple key ?

The table looks like


mysql> describe abc;
+----------------+--------------------+------+-----+---------+----------------+
| Field          | Type               | Null | Key | Default | Extra          |
+----------------+--------------------+------+-----+---------+----------------+
| field1 | mediumint unsigned | NO   | PRI | NULL    | auto_increment |
| field2 | mediumint unsigned | NO   | PRI | NULL    |                |
| field3           | char(10)           | NO   | PRI | NULL    |                |
| field4           | char(50)           | YES  |     | -       |                |
| field5           | tinyint(1)         | NO   |     | 0       |                |
+----------------+--------------------+------+-----+---------+----------------+

System Information

$ mysql2sqlite --version
| software               | version                                                     |
|------------------------|-------------------------------------------------------------|
| mysql-to-sqlite3       | 2.2.0                                                       |
|                        |                                                             |
| Operating System       | Linux 5.14.0-460.el9.x86_64                                 |
| Python                 | CPython 3.9.19                                              |
| MySQL                  | mysql  Ver 8.0.36 for Linux on x86_64 (Source distribution) |
| SQLite                 | 3.45.3                                                      |
|                        |                                                             |
| click                  | 8.1.7                                                       |
| mysql-connector-python | 8.4.0                                                       |
| python-slugify         | 8.0.4                                                       |
| pytimeparse2           | 1.7.1                                                       |
| simplejson             | 3.19.2                                                      |
| tabulate               | 0.9.0                                                       |
| tqdm                   | 4.66.4     

This command is only available on v1.3.2 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, etc.).

Additional context
Add any other context about the problem here.

In case of errors please run the same command with --debug. This option is only available on v1.4.12 or greater.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions