Multiple database support in django

后端 未结 10 2126
囚心锁ツ
囚心锁ツ 2020-12-31 11:44

From some forum I came to know that Multiple database support is added in Django at lower level, but the higher level apis are not added yet.

Can anyone please tell

10条回答
  •  抹茶落季
    2020-12-31 12:21

    If you read a few of the many (many) threads on this subject in django-dev, you will see that what looks straightforward, isn't. If you pick a single use case, then it looks easy, but as soon as you start to generalize in any way you start to run into trouble.

    To use the above-referenced thread as an example, when you say "multiple databases", which of the following are you talking about?

    • All DB on the same machine under the same engine.
    • All DB on same machine, different engines (E.g. MySQL + PostgreSQL)
    • One Master DB with N read-only slaves on different machines.
    • Sharding of tables across multiple DB servers.

    Will you need:

    • Foreign keys across DBs
    • JOINs across machines and/or engines
    • etc. etc.

    One of the problems with a slick ORM like Django's is that it hides all of those messy details under a nice paint job. To continue to do that, but to then add in any of the above, is Not Easy (tm).

提交回复
热议问题