Migrate from MySQL to PostgreSQL on Linux (Kubuntu)

前端 未结 4 1402
孤独总比滥情好
孤独总比滥情好 2020-12-29 07:43

A long time ago on a system far, far away...

Trying to migrate a database from MySQL to PostgreSQL. All the documentation I have read covers, in great detail, how

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 08:08

    Check out etlalchemy. It allows you migrate from MySQL to PostgreSQL, or between several other databases, in 4 lines of Python. You can read more about it here.

    To install: pip install etlalchemy

    To run:

    from etlalchemy import ETLAlchemySource, ETLAlchemyTarget
    # Migrate from MySQL to PostgreSQL
    src = ETLAlchemySource("mysql://user:passwd@hostname/dbname")
    tgt = ETLAlchemyTarget("postgresql://user:passwd@hostname/dbname",
                              drop_database=True)
    tgt.addSource(src)
    tgt.migrate()
    

提交回复
热议问题