3.6 KiB
Configuration
Library configuration is made in settings.py. All parameters start with CLICKHOUSE_
prefix.
Prefix can be changed using CLICKHOUSE_SETTINGS_PREFIX
parameter.
CLICKHOUSE_SETTINGS_PREFIX
Defaults to: 'CLICKHOUSE_'
You can change CLICKHOUSE_
prefix in settings using this parameter to anything your like.
CLICKHOUSE_DATABASES
Defaults to: {}
A dictionary, defining databases in django-like style.
Key is an alias to communicate with this database in connections and using.
Value is a configuration dict with parameters:
- infi.clickhouse_orm database parameters
migrate: bool
- indicates if this database should be migrated. See migrations.
Example:
CLICKHOUSE_DATABASES = {
'default': {
'db_name': 'test',
'username': 'default',
'password': ''
},
'reader': {
'db_name': 'read_only',
'username': 'reader',
'readonly': True,
'password': ''
}
}
CLICKHOUSE_DEFAULT_DB_ALIAS
Defaults to: 'default'
A database alias to use in QuerySets if direct using is not specified.
CLICKHOUSE_SYNC_STORAGE
Defaults to: 'django_clickhouse.storages.RedisStorage'
An intermediate storage class to use. Can be a string or class.
CLICKHOUSE_REDIS_CONFIG
Default to: None
Redis configuration for RedisStorage.
If given, should be a dictionary of parameters to pass to redis-py.
Example:
CLICKHOUSE_REDIS_CONFIG = {
'host': '127.0.0.1',
'port': 6379,
'db': 8,
'socket_timeout': 10
}
CLICKHOUSE_SYNC_BATCH_SIZE
Defaults to: 10000
Maximum number of operations, fetched by sync process from intermediate storage per sync) round.
CLICKHOUSE_SYNC_DELAY
Defaults to: 5
A delay in seconds between two sync rounds start.
CLICKHOUSE_MODELS_MODULE
Defaults to: 'clickhouse_models'
Module name inside django app,
where ClickHouseModel classes are search during migrations.
CLICKHOUSE_DATABASE_ROUTER
Defaults to: 'django_clickhouse.routers.DefaultRouter'
A dotted path to class, representing database router.
CLICKHOUSE_MIGRATIONS_PACKAGE
Defaults to: 'clickhouse_migrations'
A python package name inside django app,
where migration files are searched.
CLICKHOUSE_MIGRATION_HISTORY_MODEL
Defaults to: 'django_clickhouse.migrations.MigrationHistory'
A dotted name of a ClickHouseModel subclass (including module path),
representing MigrationHistory model.
CLICKHOUSE_MIGRATE_WITH_DEFAULT_DB
Defaults to: True
A boolean flag enabling automatic ClickHouse migration,
when you call migrate
on default
database.
CLICKHOUSE_STATSD_PREFIX
Defaults to: clickhouse
A prefix in statsd added to each library metric. See monitoring.
CLICKHOUSE_CELERY_QUEUE
Defaults to: 'celery'
A name of a queue, used by celery to plan library sync tasks.