diff --git a/db-setup.py b/db-setup.py index 765496f..d0e7cb1 100644 --- a/db-setup.py +++ b/db-setup.py @@ -139,7 +139,7 @@ print("Creating table...") db = feeds_db db_user = feeds_db_user table = "feeds" -sql = "create table "+table+" (link varchar(200) PRIMARY KEY)" +sql = "create table "+table+" (id varchar(200) PRIMARY KEY, link varchar(250))" create_table(db, db_user, table, sql) ##################################### diff --git a/mastofeeds.py b/mastofeeds.py index 4b6e8c1..15fc0ee 100644 --- a/mastofeeds.py +++ b/mastofeeds.py @@ -75,7 +75,7 @@ for entry in newsfeeds.entries: cur = conn.cursor() - cur.execute('select link from feeds where link=(%s)', (link,)) + cur.execute('select id from feeds where id=(%s)', (id,)) row = cur.fetchone() if row == None: @@ -109,7 +109,7 @@ for entry in newsfeeds.entries: ######################################################### - insert_line = 'INSERT INTO feeds(link) VALUES (%s)' + insert_line = 'INSERT INTO feeds(id, link) VALUES (%s, %s)' conn = None @@ -119,7 +119,7 @@ for entry in newsfeeds.entries: cur = conn.cursor() - cur.execute(insert_line, (link,)) + cur.execute(insert_line, (id, link,)) conn.commit()