def _sql_alchemy_serialization_asserts(db: DB) -> None:
    """Checks that data migrated JSONs can be deserialized from DB to Python objects.

    Args:
        db (DB): The database object

    Raises:
        VersionException: raises if a serialization fails
    """
    session = Session(db.engine)

    import inspect

    # from trulens.core.database import orm
    # Dynamically check the orm classes since these could change version to version
    for _, orm_obj in inspect.getmembers(db.orm):
        # Check only classes
        if inspect.isclass(orm_obj):
            mod_check = str(orm_obj).split(".")

            # Check only orm defined classes
            if (
                len(mod_check) > 2 and "orm" == mod_check[-2]
            ):  # <class mod.mod.mod.orm.SQLORM>
                stmt = select(orm_obj)

                # for each record in this orm table
                for db_record in session.scalars(stmt).all():
                    # for each column in the record
                    for attr_name in db_record.__dict__:
                        # Check only json columns
                        if "_json" in attr_name:
                            db_json_str = getattr(db_record, attr_name)
                            if (
                                db_json_str
                                == legacy_migration.MIGRATION_UNKNOWN_STR
                            ):
                                continue

                            # Do not check Nullables
                            if db_json_str is not None:
                                # Test deserialization
                                test_json = json.loads(
                                    getattr(db_record, attr_name)
                                )

                                # special implementation checks for serialized classes
                                if "implementation" in test_json:
                                    try:
                                        pyschema_utils.FunctionOrMethod.model_validate(
                                            test_json["implementation"]
                                        ).load()
                                    except ImportError:
                                        # Import error is not a migration problem.
                                        # It signals that the function cannot be used for deferred evaluation.
                                        pass

                                if attr_name == "record_json":
                                    record_schema.Record.model_validate(
                                        test_json
                                    )
                                elif attr_name == "cost_json":
                                    base_schema.Cost.model_validate(test_json)
                                elif attr_name == "perf_json":
                                    base_schema.Perf.model_validate(test_json)
                                elif attr_name == "calls_json":
                                    for record_app_call_json in test_json[
                                        "calls"
                                    ]:
                                        feedback_schema.FeedbackCall.model_validate(
                                            record_app_call_json
                                        )
                                elif attr_name == "feedback_json":
                                    feedback_schema.FeedbackDefinition.model_validate(
                                        test_json
                                    )
                                elif attr_name == "app_json":
                                    app_schema.AppDefinition.model_validate(
                                        test_json
                                    )
                                else:
                                    # If this happens, trulens needs to add a migration
                                    raise legacy_migration.VersionException(
                                        f"serialized column migration not implemented: {attr_name}."
                                    )
Checks that data migrated JSONs can be deserialized from DB to Python objects.

    Args:
        db (DB): The database object

    Raises:
        VersionException: raises if a serialization fails
    
src/core/trulens/core/database/migrations/data.py