# verwandte begriffe (a n d c g b x) ['030R'] Konferenz - Beziehung sql = "CREATE TABLE IF NOT EXISTS `dnb_topic_count` (`id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT," \ " `keyword` TEXT, count MEDIUMINT UNSIGNED, PRIMARY KEY(id)) " \ + "ENGINE=InnoDB DEFAULT CHARSET=utf8" cursor.execute(sql) connection.commit() print('create table dnb_topic_count') print('open file and read line by line') i = 0 with open('../export/topics.json') as f: data = json.load(f) kw = [] for key in util.seq_iter(data): kw.append([key, data[key]]) for k in kw: keyword = k[0] count = k[1] with connection.cursor() as cursor: # Create a new record i += 1 sql = "INSERT INTO `dnb_topic_count` (`keyword`, `count` ) " \ "VALUES (%s, %s)" try: cursor.execute(sql, (keyword, count)) except pymysql.err.InternalError: print('\n \n') print(entry)
" `toc` text, publisher text, primary key (id), index (year) )" \ + "ENGINE=InnoDB DEFAULT CHARSET=utf8" cursor.execute(sql) connection.commit() print('create table dnb_item') print('open file and read line by line') l = 0 with open('export/errorlog-reduced.txt', 'w+') as newFile: with open('export/bib-records-reduced.json') as f: for line in f: entry = json.loads(line) j = 0 for i in util.seq_iter(entry): j += 1 if j > 2: id_ = entry['003@'][0]['0'].lower() pub_year = '' try: entry['011E'] except KeyError: try: pub_year = entry['011@'][0]['a'] except KeyError: pass else: