MinifoldPython 的各種數據源查詢模塊
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")
)
評論
圖片
表情
