techouse / mysql-to-sqlite3

Transfer data from MySQL to SQLite
https://techouse.github.io/mysql-to-sqlite3/
MIT License
217 stars 31 forks source link

:sparkles: Add support for MySQL character set introducers in DEFAULT clause #49

Closed techouse closed 1 year ago

techouse commented 1 year ago

Add support for Character Set Introducers.

Since SQLite does not support character set introducers inside DEFAULT clauses the workaround here is to simply drop them with a few exceptions (check the table below)

MySQL SQLite NOTE
DEFAULT(_utf8mb4'[]') DEFAULT '[]'  
DEFAULT(_latin1'abc') DEFAULT 'abc'  
DEFAULT(_binary'abc') DEFAULT 'abc'  
DEFAULT(_latin1 X'4D7953514C') DEFAULT x'4D7953514C' SQLite supports hexadecimal encoding using the x prefix
DEFAULT(_latin1 b'1000001') DEFAULT 'A' SQLIte does not support binary encoding so b'1000001' has to be encoded to 'A'

Addresses #48

codecov[bot] commented 1 year ago

Codecov Report

Merging #49 (23fd261) into master (75f4330) will decrease coverage by 2.50%. The diff coverage is 61.70%.

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
- Coverage   90.17%   87.68%   -2.50%     
==========================================
  Files           7        8       +1     
  Lines         509      552      +43     
==========================================
+ Hits          459      484      +25     
- Misses         50       68      +18     
Impacted Files Coverage Δ
mysql_to_sqlite3/transporter.py 89.40% <58.13%> (-4.90%) :arrow_down:
mysql_to_sqlite3/__init__.py 100.00% <100.00%> (ø)
mysql_to_sqlite3/mysql_utils.py 100.00% <100.00%> (ø)