# Django KCK
Django KCK is data orchestration for Django. It can be used for:
* scheduled data imports from remote sources
* ensuring each data product kept fresh, either by updating at a regular
interval or when there is a change in source data on upon which it
depends
* preparing complex data products in advance of a likely request
* simplifying and optimizing complex data flows
The development pattern Django KCK encourages for data products
emphasizes compartmentalization and simplification over complexity,
cached data with configurable refresh routines over real-time
computation, and common-sense optimizations over sprawling distributed
parallelism.
## History
Django KCK is a simplified version of KCK that targets the Django
environment exclusively. It also uses PostgreSQL as the cache backend,
instead of Cassandra.
## Quick Install
## Basic Usage
```
# myapp/primers.py
from kck import Primer
class TitleListPrimer(Primer):
key = 'title_list'
parameters = [
{"name": "id", "from_str": int}
]
def compute(self, key):
param_dict = self.key_to_param_dict(key)
results = [{ 'title': lkp_title(id) } for id in param_dict['id_list']]
return results
```
```
# myapp/views.py
from kck import Cache
from django.http import JsonResponse
def first_data_product_view(request, author_id):
cache = Cache.get_instance()
title_list = cache.get(f'title_list/{author_id}')
return JsonResponse(title_list)
```
## Theory
Essentially, Django KCK is a lazy-loading cache. Instead of warming the
cache in advance, Django KCK lets a developer tell the cache how to
prime itself in the event of a cache miss.
If we don't warm the cache in advance and we ask the cache for a data
product that depends on a hundred other data products in the cache, each
of which either gathers or computes data from other sources, then this
design will only generate or request the data that is absolutely
necessary for the computation. In this way, Django KCK is able to do
the last amount of work possible to accomplish the task.
To further expedite the process or building derivative data products,
Django KCK includes mechanisms that allow for periodic or triggered
updates of data upon which a data product depends, such that it will be
immediately available when a request is made.
It also makes it possible to "augment" derivative data products with
new information so that, for workloads that can take advantage of the
optimization, a data product can be updated in place, without
regenerating the product in its entirety. Where it works, this approach
can turn minutes of computation into milliseconds.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共22个文件
py:12个
txt:5个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:django-kck-0.0.26.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
django-kck-0.0.26.tar.gz (22个子文件)
django-kck-0.0.26
MANIFEST.in 0B
PKG-INFO 4KB
setup.cfg 38B
django_kck
models.py 1007B
apps.py 94B
test.py 951B
primer.py 0B
factories.py 452B
hints.py 4KB
__init__.py 0B
parameters.py 335B
cache.py 13KB
exceptions.py 46B
process.py 1KB
setup.py 2KB
django_kck.egg-info
PKG-INFO 4KB
requires.txt 118B
SOURCES.txt 475B
entry_points.txt 20B
top_level.txt 11B
dependency_links.txt 1B
README.md 3KB
共 22 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功