def retrieve_all_unique_links(self):
"""retrieves all links. These are the network edges
@return a list of dictionaries holding the following keys:
'from': the source article id
'to': the target article id
"""
links = []
try:
self._cursor.execute('SELECT * FROM unique_links;')
result = self._cursor.fetchall()
for row in result:
link = {}
link['from'] = row[0]
link['to'] = row[1]
links.append(link)
except MySQLdb.Error, e:
logging.error('error retrieving unique links %s (%d)' % (e.args[1], e.args[0]))
return links
评论列表
文章目录