What is the best way to replicate MySQL DB structure to SQLite DB?

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
Yogi Yang
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 15.03.2008, 08:20

What is the best way to replicate MySQL DB structure to SQLite DB?

Post by Yogi Yang »

Hello,

Are there any possibilities of being able to replicate the structure of a remote MySQL database to a local SQLite database?

TIA
--
Yogi Yang
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: What is the best way to replicate MySQL DB structure to SQLite DB?

Post by marsupilami »

No - you would have to write something like this yourself. Read the MySQL structure using a ZSQLMetaData object and then generate SQLite statements for creating database objects.
Yogi Yang
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 15.03.2008, 08:20

Re: What is the best way to replicate MySQL DB structure to SQLite DB?

Post by Yogi Yang »

Thanks for the hint.

I will try that out.
--
Yogi Yang
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 797
Joined: 18.11.2018, 17:37
Location: Hungary

Re: What is the best way to replicate MySQL DB structure to SQLite DB?

Post by aehimself »

Zeos itself will not provide you a component which dumps and recreates database layouts. As Jan said you can manually achieve this by using TZMetaData - just list all fields, indexes, constraints, etc.
You'll have to manually convert field types and assemble the create script in a syntax the target RDBMS accepts, though.

There are DB converter tools out in the wild but my personal experience is that
1, Even between major RDBMSes (I tried Microsoft's own MySQL -> MSSQL) the conversion is complicated, slow and sometimes unreliable
2, None of the usable ones are free
So while you can give a shot to look for a tool, I highly doubt you'll find one.

What you have to consider - does it really worth to put your time creating such a tool? I never tried but sounds complex to me. When I was in this situation it was easier to recreate the schema by hand and set up a Zeos script to copy the data.
I'd be really happy though if a free, easy to use multi-database migrator would exist. Especially if it's built upon Zeos :)
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Post Reply