class_docstr: Class that contains methods for storing an Ax experiment to SQLAlchemy.
  
  Instantiate with an instance of Config to customize the functionality.
  For even more flexibility, create a subclass.
  
  Attributes:
      config: Metadata needed to save and load an experiment to SQLAlchemy.
class_docstr_tok: ["Class","that","contains","methods","for","storing","an","Ax","experiment","to","SQLAlchemy",".","Instantiate","with","an","instance","of","Config","to","customize","the","functionality",".","For","even","more","flexibility",",","create","a","subclass",".","Attributes",":","config",":","Metadata","needed","to","save","and","load","an","experiment","to","SQLAlchemy","."]
docstr: Convert Ax Experiment to SQLAlchemy.
  
  In addition to creating and storing a new Experiment object, we need to
  create and store copies of the Trials, Metrics, Parameters,
  ParameterConstraints, and Runner owned by this Experiment.
code: def experiment_to_sqa(self, experiment: Experiment) -> SQAExperiment:
      """Convert Ax Experiment to SQLAlchemy.
  
      In addition to creating and storing a new Experiment object, we need to
      create and store copies of the Trials, Metrics, Parameters,
      ParameterConstraints, and Runner owned by this Experiment.
      """
      optimization_metrics = self.optimization_config_to_sqa(
          experiment.optimization_config
      )
  
      tracking_metrics = []
      for metric in experiment._tracking_metrics.values():
          tracking_metrics.append(self.metric_to_sqa(metric))
  
      parameters, parameter_constraints = self.search_space_to_sqa(
          experiment.search_space
      )
  
      status_quo_name = None
      status_quo_parameters = None
      if experiment.status_quo is not None:
          status_quo_name = not_none(experiment.status_quo).name
          status_quo_parameters = not_none(
              experiment.status_quo
          ).parameters
  
      trials = []
      for trial in experiment.trials.values():
          trial_sqa = self.trial_to_sqa(trial=trial)
          trials.append(trial_sqa)
  
      experiment_data = self.experiment_data_to_sqa(
          experiment=experiment
      )
  
      experiment_type = self.get_enum_value(
          value=experiment.experiment_type,
          enum=self.config.experiment_type_enum,
      )
  
      properties = experiment._properties
      runners = []
      if isinstance(experiment, MultiTypeExperiment):
          properties[Keys.SUBCLASS] = "MultiTypeExperiment"
          for (
              trial_type,
              runner,
          ) in experiment._trial_type_to_runner.items():
              runner_sqa = self.runner_to_sqa(runner, trial_type)
              runners.append(runner_sqa)
  
          for metric in tracking_metrics:
              metric.trial_type = experiment._metric_to_trial_type[
                  metric.name
              ]
              if metric.name in experiment._metric_to_canonical_name:
                  metric.canonical_name = (
                      experiment._metric_to_canonical_name[metric.name]
                  )
      elif experiment.runner:
          runners.append(
              self.runner_to_sqa(not_none(experiment.runner))
          )
  
      # pyre-ignore[9]: Expected `Base` for 1st...yping.Type[Experiment]`.
      experiment_class: Type[
          SQAExperiment
      ] = self.config.class_to_sqa_class[Experiment]
      exp_sqa = experiment_class(
          id=experiment.db_id,  # pyre-ignore
          description=experiment.description,
          is_test=experiment.is_test,
          name=experiment.name,
          status_quo_name=status_quo_name,
          status_quo_parameters=status_quo_parameters,
          time_created=experiment.time_created,
          experiment_type=experiment_type,
          metrics=optimization_metrics + tracking_metrics,
          parameters=parameters,
          parameter_constraints=parameter_constraints,
          trials=trials,
          runners=runners,
          data=experiment_data,
          properties=properties,
          default_trial_type=experiment.default_trial_type,
          default_data_type=experiment.default_data_type,
      )
      return exp_sqa
  
imports: from enum import Enum
  from logging import Logger
  from typing import Any, cast, Dict, List, Optional, Tuple, Type
  from ax.core.arm import Arm
  from ax.core.base_trial import BaseTrial
  from ax.core.batch_trial import AbandonedArm, BatchTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun, GeneratorRunType
  from ax.core.metric import Metric
  from ax.core.multi_type_experiment import MultiTypeExperiment
  from ax.core.objective import MultiObjective, Objective, ScalarizedObjective
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.outcome_constraint import ObjectiveThreshold, OutcomeConstraint, ScalarizedOutcomeConstraint
  from ax.core.parameter import ChoiceParameter, FixedParameter, Parameter, RangeParameter
  from ax.core.parameter_constraint import OrderConstraint, ParameterConstraint, SumConstraint
  from ax.core.parameter_distribution import ParameterDistribution
  from ax.core.risk_measures import RiskMeasure
  from ax.core.runner import Runner
  from ax.core.search_space import RobustSearchSpace, SearchSpace
  from ax.core.trial import Trial
  from ax.exceptions.storage import SQAEncodeError
  from ax.modelbridge.generation_strategy import GenerationStrategy
  from ax.storage.json_store.encoder import object_to_json
  from ax.storage.sqa_store.sqa_classes import SQAAbandonedArm, SQAArm, SQAData, SQAExperiment, SQAGenerationStrategy, SQAGeneratorRun, SQAMetric, SQAParameter, SQAParameterConstraint, SQARunner, SQATrial
  from ax.storage.sqa_store.sqa_config import SQAConfig
  from ax.storage.utils import DomainType, MetricIntent, ParameterConstraintType
  from ax.utils.common.base import Base
  from ax.utils.common.constants import Keys
  from ax.utils.common.logger import get_logger
  from ax.utils.common.serialization import serialize_init_args
  from ax.utils.common.typeutils import checked_cast, not_none
label_desc: Use image node_id 4 for calling the Encoder obj's underlying member method code with example usage: obj.experiment_to_sqa(experiment) and returns: exp_sqa