本文整理匯總了Python中models.DAO.DAO.select_by方法的典型用法代碼示例。如果您正苦於以下問題:Python DAO.select_by方法的具體用法?Python DAO.select_by怎麽用?Python DAO.select_by使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.DAO.DAO
的用法示例。
在下文中一共展示了DAO.select_by方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: select_tales_other_creator
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_tales_other_creator(user_id, viewer_id, rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
'''
SELECT DISTINCT
tale_id, tale_title, tale_description,
tale_category, tale_creator, tale_license,
tale_star_count, tale_follow_count,
tale_contribution_request_count, tale_creation_datetime
FROM anaddventure.tale INNER JOIN anaddventure.contribution_request ON
contribution_request_system_user_id = (%s) AND
tale_creator != contribution_request_system_user_id AND
tale_id = contribution_request_tale_id AND
(
tale_category = 1 OR
(
(
SELECT COUNT(*) FROM anaddventure.invitation WHERE
invitation_creator = tale_creator AND
invitation_invited = contribution_request_system_user_id
) > 0 AND
(
SELECT COUNT(*) FROM anaddventure.invitation WHERE
invitation_creator = tale_creator AND
invitation_invited = (%s)
) > 0
)
)
ORDER BY tale_star_count DESC
''',
(user_id, viewer_id),
rows
)
)
示例2: select_viewable_by_creator_id_and_viewer_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_viewable_by_creator_id_and_viewer_id(
creator_id, viewer_id, rows = None
):
return Tale._construct_tale_objects(
DAO.select_by(
'''
SELECT DISTINCT
tale_id, tale_title, tale_description,
tale_category, tale_creator, tale_license,
tale_star_count, tale_follow_count,
tale_contribution_request_count, tale_creation_datetime
FROM anaddventure.tale INNER JOIN anaddventure.invitation ON
tale_creator = (%s) AND
(
tale_category = 1 OR
(
invitation_creator = tale_creator AND
invitation_invited = (%s) AND
invitation_tale_id = tale_id
) OR
tale_creator = (%s)
)
ORDER BY tale_star_count DESC
''',
(creator_id, viewer_id, viewer_id),
rows
)
)
示例3: select_top_ten_order_by_star_count
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_top_ten_order_by_star_count():
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale WHERE tale_category = 1 ORDER BY tale_star_count DESC LIMIT 5",
()
)
)
示例4: select_all
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_all(rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale",
(),
rows
)
)
示例5: select_by_creator_id_and_full_title
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_creator_id_and_full_title(creator_id, title, rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale WHERE tale_creator = (%s) AND tale_title ILIKE (%s)",
(creator_id, title),
rows
)
)
示例6: select_by_license_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_license_id(license_id, rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale WHERE tale_license = (%s)",
(license_id, ),
rows
)
)
示例7: select_by_creator_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_creator_id(creator_id, rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale WHERE tale_creator = (%s)",
(creator_id, ),
rows
)
)
示例8: select_by_category
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_category(category = '', rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale WHERE tale_category = (%s)",
(category, ),
rows
)
)
示例9: select_count_by_title
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_count_by_title(title = '', rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT COUNT(tale_id) FROM anaddventure.tale WHERE tale_title ILIKE (%s)",
('%' + title + '%', ),
rows
)
)
示例10: select_by_full_title
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_full_title(title = '', rows = None):
return Tale._construct_tale_objects(
DAO.select_by(
"SELECT * FROM anaddventure.tale WHERE tale_title ILIKE (%s)",
(title, ),
rows
)
)
示例11: select_all
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_all(rows = None):
return License._construct_license_objects(
DAO.select_by(
"SELECT * FROM anaddventure.license",
(),
rows
)
)
示例12: select_by_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_id(id, rows = None):
return Password_Change_Requests._construct_password_change_request_objects(
DAO.select_by(
"SELECT * FROM anaddventure.password_change_requests WHERE password_change_requests_id LIKE (%s)",
(hashlib.sha256(id.encode('utf-8')).hexdigest(), ),
rows
)
)
示例13: select_by_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_id(id, rows = None):
return License._construct_license_objects(
DAO.select_by(
"SELECT * FROM anaddventure.license WHERE license_id = (%s)",
(id, ),
rows
)
)
示例14: select_by_previous_chapter_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_previous_chapter_id(previous_chapter_id, rows = None):
return Chapter._construct_chapter_objects(
DAO.select_by(
"SELECT * FROM anaddventure.chapter WHERE chapter_previous_chapter = (%s)",
(previous_chapter_id, ),
rows
)
)
示例15: select_by_tale_id_and_previous_chapter_id
# 需要導入模塊: from models.DAO import DAO [as 別名]
# 或者: from models.DAO.DAO import select_by [as 別名]
def select_by_tale_id_and_previous_chapter_id(tale_id, previous_chapter_id, rows = None):
return Chapter._construct_chapter_objects(
DAO.select_by(
"SELECT * FROM anaddventure.chapter WHERE chapter_tale_id = (%s) AND chapter_previous_chapter = (%s)",
(tale_id, previous_chapter_id),
rows
)
)