mysqlworkview.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:wikilinks 作者: trovdimi 项目源码 文件源码
def retrieve_all_internal_transitions_counts(self):
        """retrieves all internal links transitions from the wikipeida clickstream_derived that are an internal 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 clickstream_derived WHERE link_type_derived=%s;', ("internal-link",))
            result = self._cursor.fetchall()
            for row in result:
                link = {}
                link['from'] = row[0]
                link['to'] = row[1]
                link['counts']=row[2]
                links.append(link)
        except MySQLdb.Error, e:
            logging.error('error retrieving unique links %s (%d)' % (e.args[1], e.args[0]))
        return links
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号