本文整理汇总了Python中model.Model.fetch_one方法的典型用法代码示例。如果您正苦于以下问题:Python Model.fetch_one方法的具体用法?Python Model.fetch_one怎么用?Python Model.fetch_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Model
的用法示例。
在下文中一共展示了Model.fetch_one方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_fav_page
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import fetch_one [as 别名]
def get_fav_page(self):
query = """SELECT COUNT(i.cat) AS total
FROM customer_trade ct LEFT JOIN item i ON (ct.item_id=i.item_id)
WHERE i.cat IS NOT NULL AND ct.buyer_nick=%s
"""
total = Model.fetch_one(query, self.nick)["total"]
return (total / 50) + 1
示例2: get_rate_total
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import fetch_one [as 别名]
def get_rate_total(self):
query = """
SELECT CAST(SUM(total) AS SIGNED) total
FROM
(SELECT COUNT(*) total
FROM rate_list T1
WHERE uid='{0}'
UNION
SELECT
COUNT(*) total
FROM rate_list_past T1
WHERE uid='{0}') r""".format(
self.get_uid()
)
total = Model.fetch_one(query).total
return total
示例3: get_uid
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import fetch_one [as 别名]
def get_uid(self):
query = "SELECT uid FROM customer WHERE nick=%s"
row = Model.fetch_one(query, self.nick)
return row.uid