2016-10-04 103 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()” 这将是工作!