import sqlite3
conn = sqlite3.connect('../Dropbox/mbcat/mbcat.sqlite3')
curs = conn.cursor()
table = curs.execute("select release, sortstring, artist, title, date, country, label, catno, barcode, asin, format, sortformat, datetime(min_date, 'unixepoch', 'localtime') from (select d.release, min(d.date) as min_date, r.sortstring, r.artist, r.title, r.date, r.country, r.label, r.catno, r.barcode, r.asin, r.format, r.sortformat from added_dates as d inner join releases as r on r.id = d.release group by release) order by sortstring").fetchall()
table_ids = [x[0] for x in table]
rel_ids = [x[0] for x in curs.execute('select id from releases').fetchall()]
import sqlite3 conn = sqlite3.connect('../Dropbox/mbcat/mbcat.sqlite3') curs = conn.cursor() table = curs.execute("select release, sortstring, artist, title, date, country, label, catno, barcode, asin, format, sortformat, datetime(min_date, 'unixepoch', 'localtime') from (select d.release, min(d.date) as min_date, r.sortstring, r.artist, r.title, r.date, r.country, r.label, r.catno, r.barcode, r.asin, r.format, r.sortformat from added_dates as d inner join releases as r on r.id = d.release group by release) order by sortstring").fetchall()
table_ids = [x[0] for x in table] rel_ids = [x[0] for x in curs.execute('select id from releases').fetchall()]
set(rel_ids) - set(table_ids)
{u'7bf61d18-8c80-3402-b0f6-dc1ecc4506eb', u'b805e4f2-8ddc-31c8-a5bb-81aa6b6b289f'}
These were releases that had no added date associated. This shouldn't happen, but I should implement a workaround.