con = sqlite3.connect(':MEMORY:')
con.execute(
    """CREATE TABLE ABCD (A TEXT NOT NULL,
                                  B TEXT NOT NULL,
                                  C TEXT NOT NULL,
                                  D TEXT NOT NULL,
                                  PRIMARY KEY (A, B))"""
    )
with con:
    for a, b, c, d in inputs:
        if any(elem is None for elem in (a, b, c, d)):
            raise ValueError('Fields must not be empty.')
con.execute('INSERT OR IGNORE INTO ABCD VALUES (?, ?, ?, ?)', (a, b, c, d))
con.close()
IntegrityError pysqlite: отличить «НЕ NULL» от «УНИКАЛЬНОГО» нарушения