def METHOD_NAME(self, now, db, default_namespace):
    shard_id = default_namespace.id >> 48
    query = "SELECT count(id) FROM transaction WHERE namespace_id={}".format(
        default_namespace.id
    )
    all_transactions = db.session.execute(query).scalar()
    date_query = (
        "SELECT count(id) FROM transaction WHERE created_at < "
        "DATE_SUB({}, INTERVAL 30 day)"
    ).format(format_datetime(now))
    older_than_thirty_days = db.session.execute(date_query).scalar()
    # Delete all transactions older than 30 days
    purge_transactions(shard_id, days_ago=30, dry_run=False, now=now)
    assert (
        all_transactions - older_than_thirty_days
        == db.session.execute(query).scalar()
    )