techouse / sqlite3-to-mysql

Transfer data from SQLite to MySQL

Home Page:https://techouse.github.io/sqlite3-to-mysql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to skip duplicate index creation if key name already exists

franfabrizio opened this issue · comments

Is your feature request related to a problem? Please describe.

We use this tool as part of a workflow that exports a database from MySQL -> Sqlite and then later re-imports that database back from Sqlite -> the same MySQL database. When it does so, it detects that all of the indices it is trying to create already exist, so it creates duplicate indices with a "_1" suffix using the duplicate key name functionality on lines 512-520 of transporter.py. We intend to iterate through this workflow many times, so this problem will compound itself further over time.

Describe the solution you'd like

An option to skip index creation if an index of the same name already exists would be one possible solution. There may be better approaches I haven't considered.

Hi 👋

Nice to see that this tool is being used in a workflow as well 😁

Can be done.

I'll try and get it done over the weekend.

I added this CLI option which should address your use-case.

-W, --ignore-duplicate-keys     Ignore duplicate keys. The default behavior
                                  is to create new ones with a numerical
                                  suffix, e.g. 'exising_key' ->
                                  'existing_key_1'