def _get_all(self, server: Server, is_primary: int = None) -> List:
""" Internal helper method to fetch role and alias
"""
primary_in = "(0,1)"
if is_primary == 1:
primary_in = "(1)"
if is_primary == 0:
primary_in = "(0)"
self.cursor.execute(
self.query(
"SELECT role, alias FROM roles WHERE is_primary IN {0} AND server_id = %(server)s".format(primary_in)),
{"server": server.id})
rows = self.cursor.fetchall()
ret_list = []
for r in rows:
role, alias = r
ret_list.append((str(role), alias))
return ret_list
评论列表
文章目录