carrotquest / django-clickhouse

This project's goal is to build Yandex ClickHouse database into Django project.
MIT License
103 stars 26 forks source link

Config question #10

Closed mcindea closed 4 years ago

mcindea commented 4 years ago

First of all thank you for all the work, you've done tremendous amount of dedication!

I want to ask a n00b question, I am new to Django, and I can't figure out how to set it up in settings.py since DATABASES and CLICKHOUSE_DATABASES are different, and I can't figure out the Django engine I should use. I've went through the PR with docs, but still couldn't figure it out. Can you please give me a hint?

Thank you!

M1ha-Shvn commented 4 years ago

Hi. First of all, DATABASES and CLICKHOUSE_DATABASES in django settings are not somehow connected to each other. DATABASES parameter configures databases, used with django QuerySet/Model system. It has engine attribute, which tells django what driver it should use for this connection (PostgreSQL, MySQL, Oracle etc). You can read more about it here. CLICKHOUSE_DATABASES is a parameter, introduced by this library. It determines connections, which can be used with this library QuerySet/ClickHouseModel system only. It's structure is very much like DATABASES. But attributes are different (they are described here):

Unlike django, ClickHouse Engine defines mechanics of each table work. You can read more about it here. In this library it is set as ClickHouseModel attribute.

M1ha-Shvn commented 4 years ago

I close issue, for no response. You may reopen issue, if you have more questions.