Closed dimittal closed 1 year ago
Yes, JSON is supported from v1.0.3.
Try ommitting CLICKHOUSE_PORT
in your DB setting or set CLICKHOUSE_PORT
to 9000. Clickhouse driver use clickhouse native protocol to communicate with clickhouse server, default port is 9000.
Thanks. I made that change and now I am seeing this error:
django.db.utils.OperationalError: Code: 209. (<clickhouse_host>:9000)
It seems that your clickhouse server is not running correctly. Try following this stackoverflow post
I am connecting to the cloud version of clickhouse and able to connect to it using the clickhouse_connect module on port 8443. But not when I put it as a DATABASE as use this module.
Sorry, I have no experience with clickhouse cloud.
In the clickhouse cloud quick start, it says secure connection should be used. Try this DB setting:
DATABASES = {
'clickhouse': {
'ENGINE': 'clickhouse_backend.backend',
'NAME': 'Demo cluster',
'HOST': env.str("CLICKHOUSE_HOST", default='localhost'),
'PORT': 9440,
'USER': env.str("CLICKHOUSE_USERNAME", default='default'),
'PASSWORD': env.str("CLICKHOUSE_PASSWORD", default=''),
'OPTIONS': {
'secure': True,
'settings': {
'allow_experimental_object_type': 1
}
}
}
}
If this still does not work, please contact your sevice provider.
Thanks. This helped and worked.
Hi, I am just starting on using Clickhouse with Django and found this. Seems like a life saviour. I tried to set it up to connect with my clickhouse cloud DB on my macbook. I have already have an AWS RDS instance and its replica that I am connecting to.
I added this in my DATABASES: 'clickhouse': { 'ENGINE': 'clickhouse_backend.backend', 'NAME': 'Demo cluster', 'HOST': env.str("CLICKHOUSE_HOST", default='localhost'), 'PORT': env.int("CLICKHOUSE_PORT", default=8443), 'USER': env.str("CLICKHOUSE_USERNAME", default='default'), 'PASSWORD': env.str("CLICKHOUSE_PASSWORD", default=''), 'TEST': { 'fake_transaction': True } }
I am getting this error:
django.db.utils.OperationalError: Code: 210. Connection reset by peer
I am on: Django==4.1.4 clickhouse-connect==0.6.3 clickhouse-driver==0.2.6 clickhouse-pool==0.5.3 django-clickhouse-backend==1.0.3
and on: Python 3.10.9
Any guidance on how to bypass this?