2016-10-04 101 views
-1

查詢結果我在Python代碼,希望從中得到的查詢結果,但得到的錯誤:獲得蟒蛇

AttributeError: 'Future' object has no attribute 'fetchone' 

這裏是我的代碼:

  domain = bid_request["site"]["domain"] 
      site = yield self.db.execute('SELECT "Id", "State", "LastAccess", "Domain", "RubricId", ' 
             '"IgnoreInInterests", "PriceCPM" ' 
             'FROM whis2011."RtbActiveSites" ' 
             'WHERE "Domain" = \'%s\' ' 
             'ORDER BY "Id" DESC limit 1;' % domain).fetchone() 

    self.add_header('Content-Type', 'text/html; charset=utf-8') 

      if len(site) > 0: ..... 

而且,我需要「網站「因爲你看到我會用後者。 我該如何解決它?

感謝

回答

0

這似乎如果我使用 「使用fetchall()」 而不是 「fetchone()」 這將是工作!