'Disable foreign key constraint checking.'

@contextmanager
def constraint_checks_disabled(self):

    disabled = self.disable_constraint_checking()
    try:
        (yield)
    finally:
        if disabled:
            self.enable_constraint_checking()
