MinifoldPython 的各种数据源查询模块

联合创作 · 2023-09-28 11:15

Minifold 是一个 Python 模块,用来与各种数据源(如 CSV, LDAP, SQL, twitter 等)交互,可对数据进行查询、合并和聚合,就像一个数据库操作一样。


Minifold 要求最低 Python 3 的支持。


Debian, Ubuntu 安装.



sudo apt-get update
sudo apt-get install git python3 python3-pycountry python3-ldap3 python3-setuptools python3-urllib3 python3-tweepy python3-xmltodict

安装 minifold



mkdir ~/git
cd ~/git
git clone https://github.com/nokia/minifold
cd minifold
sudo python3 ./setup.py install

测试



python3
>>> import minifold

代码示例:


直观查询



from minifold.query import Query, ACTION_GET

q_institution = Query(
action = ACTION_GET,
object = "institutions",
attributes = [],
filters = BinaryPredicate("institution_id", "==", 3)
)

LDAP 查询:



from minifold.query import Query, ACTION_GET

q_ldap = Query(
action = ACTION_GET,
object = "ou=users,dc=lincs,dc=fr",
attributes = ["uid", "sn", "givenName", "departmentNumber"],
filters = BinaryPredicate("sn", "==", "Mathieu")
)

 

浏览 22
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报