import sqlite3


def verify_database(connector, template):
    """
    Verifies the schema of the database attached to a connector against an external SQL script (template).
    :param connector: lddatabase.LDHarvesterDatabaseConnector
    :param template:  str
    :return: bool
    """
    virtual_db = sqlite3.Connection(':memory:')
    virtual_cursor = virtual_db.cursor()
    with open(template, 'r') as script:
        virtual_cursor.executescript(script.read())
    if virtual_cursor.execute("SELECT sql FROM sqlite_master WHERE type='table'").fetchall() == connector.cursor.execute("SELECT sql FROM sqlite_master WHERE type='table'").fetchall():
        return True
    else:
        return False