process data as stream.
Project description
原理说明
编程主要要到了生成器,各个类用for循环从上游抽取数据,用yield给下游提供数据。通过改写or规则,将各个组建组合起来。
参考项目
整体思路主要参考了这个项目:https://github.com/sandabuliu/python-stream。
安装
>>> pip install file-stream
使用
写数据到数据库。
from file_stream.executor.source import Memory from file_stream.executor.writer import MysqlWriter office_base_config = { 'host': "", 'user': "", 'passwd': '', 'database': '', 'charset': '', } datas = [{'f_cuid': 'id2', 'f_sentence_no': 1, 'f_pos_no': 1, 'f_neg_no': 0, 'f_nu_no': 0}, {'f_cuid': 'id3', 'f_sentence_no': 3, 'f_pos_no': 2, 'f_neg_no': 1, 'f_nu_no': 0}, {'f_cuid': 'id1', 'f_sentence_no': 1, 'f_pos_no': 1, 'f_neg_no': 0, 'f_nu_no': 0}, {'f_cuid': 'id4', 'f_sentence_no': 1, 'f_pos_no': 1, 'f_neg_no': 0, 'f_nu_no': 0}, ] reader = Memory(datas) p = reader | MysqlWriter(office_base_config, 't_report_info') p.output()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
file_stream-0.0.3.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for file_stream-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be396ac12f25552e9af2419ff35016618d108a01ebbc551e6e154b676aa81c3e |
|
MD5 | 7f36b06bd7fc9a75eb064c9daea9a746 |
|
BLAKE2b-256 | cea21d448469d2fa7ca94395b4a435726e7e5538c4e3c5ca29d2793e34746889 |