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

Data Migration with incorrect values when values are out of data range instead of an error.

surapuramakhil opened this issue · comments

Describe the bug

range of int in MYSQL - -2147483648 to 2147483647
range of int in Sqlite - -9223372036854775808 to +9223372036854775807

Value in source DB - 10010000000000001
got value in target mysql db - 2147483647 instead of receiving an error asking me to correct

Expected behaviour
receiving an error asking me to correct (or) it should choose correct data type which can store that value

Actual result
got value in target mysql db - 2147483647

System Information

$ sqlite3mysql --version
| software               | version                                                           |
|------------------------|-------------------------------------------------------------------|
| sqlite3-to-mysql       | 2.1.7                                                             |
|                        |                                                                   |
| Operating System       | Linux 5.15.0-1037-kvm                                             |
| Python                 | CPython 3.10.12                                                   |
| MySQL                  | mysql  Ver 8.0.33-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu)) |
| SQLite                 | 3.37.2                                                            |
|                        |                                                                   |
| click                  | 8.1.7                                                             |
| mysql-connector-python | 8.3.0                                                             |
| pytimeparse2           | 1.7.1                                                             |
| simplejson             | 3.19.2                                                            |
| tabulate               | 0.9.0                                                             |
| tqdm                   | 4.66.2                                                            |

This command is only available on v1.3.6 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.

even tested with debug mode. No errors are thrown

The databases handle these datatypes differently and it was never my intention to automatically handle every edge case (like this one) with the tool.

You have 3 options:

  1. Use the switch --mysql-integer-type="BIGINT (19)" to override the default integer data type.
  2. Manually create the DDL in MySQL and then migrate.
  3. Submit a PR to handle this automatically.

Can you share instructions on how to perform 2nd Option. I tried that. code stated messing with schema So I have raised #105

Can you share instructions on how to perform 2nd Option. I tried that. code stated messing with schema So I have raised #105

I strongly suggest option 1.

Can you share instructions on how to perform 2nd Option. I tried that. code stated messing with schema So I have raised #105

I strongly suggest option 1.

Ah it is not just one column time there are other columns types which got effected. Number is around 6+

So that's why I have asked for 2

That flag will take care of the datatype, regardless of how many columns there are.

Ah you didn't get what I said its column types not column names. bug is filed for integer column type, there are other columns which were also effected like timestamp columns and text columns

there are other columns which were also effected like timestamp columns and text columns

For text you can use

  --mysql-string-type TEXT        MySQL default string field type. Defaults to
                                  VARCHAR(255).
  --mysql-text-type [MEDIUMTEXT|TEXT|TINYTEXT|LONGTEXT]
                                  MySQL default text field type. Defaults to
                                  TEXT.
  --mysql-charset TEXT            MySQL database and table character set
                                  [default: utf8mb4]

Please provide concrete examples with which I can replicate these issues that you are facing.