/ 中小企業の社内IT担当者マイケルの備忘録 / blog

Dataset備忘

October 14, 2019

dataset.pyのような名前のファイルがあると,そのファイルを探してしまうので,attribusionエラーになる。
複数回,はまったので注意する。

公式
https://dataset.readthedocs.io/en/latest/quickstart.html

検索

あいまい検索をするときだけ,db['posts'].tabletableをつける(らしい)。
cは,カラムの意味と思われる。

db = dataset.connect(DB_URL)
table = db['posts'].table
stmt = table.select(table.c.title.like('%t%'))
results = db.query(stmt)
for result in results:
    print(result['title'])