第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

getAll什么都不返回?重新思考數(shù)據(jù)庫

getAll什么都不返回?重新思考數(shù)據(jù)庫

慕的地6264312 2021-03-29 12:44:48
我正在嘗試從數(shù)據(jù)庫中讀取數(shù)據(jù)庫中消息的不同“線程”,但是每次嘗試時(shí),我都會(huì)返回一個(gè)空數(shù)組,這使我認(rèn)為請求所有線程時(shí)出了點(diǎn)問題使用get_all命令。像這樣從數(shù)據(jù)庫請求是正確的嗎?根本沒有錯(cuò)誤,所以我很困惑,因?yàn)樗鼞?yīng)該返回消息的線程。def threads(cls, clinic_id, db={}):    """Threads    Returns the unique list of threads in the SMS log    Arguments:        clinic_id {uint} -- The unique ID of the clinic        db {dict} -- Optional DB info    Returns:        list    """    # Get the info    dInfo = cls.info(db)    # Connect to the server    with connect_with(dInfo['server']) as oCon:        # Request all threads        itRes = r \            .db(dInfo['db']) \            .table(dInfo['tree']._name) \            .get_all([clinic_id, r.minval], [clinic_id, r.maxval], index="clinic_number") \            .pluck(['number']) \            .default(None) \            .distinct() \            .run(oCon)        # Return the list of numbers        return [d['number'] for d in itRes]
查看完整描述

1 回答

?
慕標(biāo)5832272

TA貢獻(xiàn)1966條經(jīng)驗(yàn) 獲得超4個(gè)贊

假設(shè)您有一個(gè)clinic_id名為clinic_number的二級索引,則語法可能應(yīng)該是:

.get_all(clinic_id, index="clinic_number")

除非您想獲得一個(gè)范圍,否則可能應(yīng)該使用該范圍.between()。

也不確定您傳遞的那個(gè)奇怪的數(shù)組參數(shù)應(yīng)該是什么意思。

請注意,您需要一個(gè)輔助索引才能使該查詢工作,否則,您需要使用.filter,但是這會(huì)強(qiáng)制執(zhí)行非常不理想的表掃描。


查看完整回答
反對 回復(fù) 2021-04-27
  • 1 回答
  • 0 關(guān)注
  • 165 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)