def total_categorias(): with closing(con()) as connection, closing(connection.cursor()) as cursor: cursor.execute(sql_total) total = row_to_dict(cursor.description, cursor.fetchone()) return total['total']
def localizar(id_categoria): with closing(con()) as connection, closing(connection.cursor()) as cursor: cursor.execute(sql_localizar, (id_categoria, )) return row_to_dict(cursor.description, cursor.fetchone())