# majipoor
**Github**: [GitHub - wesen/majipoor: Sync mysql to postgresql](https://github.com/wesen/majipoor)
This is my idea of writing a small, no-nonsense version of [[pgchameleon]] in order to sync and replicate a [[MySQL]] database to [[PostgreSQL]].
The main idea is to be 100% focused on doing replication for a data warehouse, which means being as permissive and lenient as possible. It's better for invalid data to be synchronized that rejected.
## Structure
Majipoor should:
- have a very simple configuration file
- be easily deployable and monitorable
- introspect existing schema and create lenient version of destination [[Databases]] [[Data Schemas]]
- be fast even for big amounts of data
- listen to the mysql binlog to do streaming replication
- be unintrusive to the normal database operation
I started potentially on the wrong foot by focusing on building [my own MySQL parser](https://github.com/wesen/majipoor/tree/main/lib/mysql) for the binlog, because while `INSERT` statements get normalized, `ALTER` and `UPDATE` and everything else doesn't. I only later realized that MySQL parser already exist in golang:
- [tidb/parser at master · pingcap/tidb · GitHub](https://github.com/pingcap/tidb/tree/master/parser)
## Related links
Here are a few interesting [[golang]] [[MySQL]] projects.
This has quite a few documents about its implementation, which might come in handy.
- [GitHub - nooncall/shazam: mysql proxy and platform](https://github-com.translate.goog/nooncall/shazam?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp#%E7%AE%80%E4%BB%8B) (translated from chinese)
- [GitHub - XiaoMi/soar: SQL Optimizer And Rewriter](https://github-com.translate.goog/XiaoMi/soar?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp)
This next project to manage [[MySQL]] [[Schema Migration]] is interesting because it comes with some really nice [[Information Dashboards|dashboards]]. It would be great for majipoor to actually come with its own overview and log and monitoring page (once standard monitoring and metrics is implemented, for example targetting [[Prometheus]] or [[rollbar]], like [[pgchameleon]] does).
![[Idea - majipoor - no nonsense mysql to postgresql replication-1657030884872.jpeg]]
- [GitHub - bytebase/bytebase: Safe database schema change and version control tool for teams. Public demo: https://demo.bytebase.com](https://github.com/bytebase/bytebase)
Actually, quite a few interesting applications can be done with a [[SQL]] parser, as you can use [[SQL]] as a [[Domain Specific Language]] and transform it to completely different outputs:
This project for example compiles a [[SQL]] program to a [[Argo workflow]] running on [[Kubernetes]]. It supports not only [[MySQL]], but a wide variety of database systems and [[Machine Learning]] toolkits.
- [GitHub - sql-machine-learning/sqlflow: Brings SQL and AI together.](https://github.com/sql-machine-learning/sqlflow)