示例#1
0
 def populate_temp_table(self, cursor: connection.cursor,
                         temp_table: TempTableName) -> None:
     sql_template = "INSERT INTO {0} SELECT * FROM ({1}) AS {0}_contents;"
     with Timer(f"Populate '{temp_table.value}'"):
         cursor.execute(
             sql_template.format(temp_table.value,
                                 TEMP_TABLE_CONTENTS[temp_table]))
示例#2
0
文件: views.py 项目: zy964c/zulip
def dictfetchall(cursor: connection.cursor) -> List[Dict[str, Any]]:
    "Returns all rows from a cursor as a dict"
    desc = cursor.description
    return [
        dict(list(zip([col[0] for col in desc], row)))
        for row in cursor.fetchall()
    ]
示例#3
0
文件: views.py 项目: 284928489/zulip
def dictfetchall(cursor: connection.cursor) -> List[Dict[str, Any]]:
    "Returns all rows from a cursor as a dict"
    desc = cursor.description
    return [
        dict(list(zip([col[0] for col in desc], row)))
        for row in cursor.fetchall()
    ]