original_docstring: Creates an instance of this class from a protobuf.
  
          :type database_pb:
              :class:`~google.cloud.spanner_admin_instance_v1.types.Instance`
          :param database_pb: A instance protobuf object.
  
          :type instance: :class:`~google.cloud.spanner_v1.instance.Instance`
          :param instance: The instance that owns the database.
  
          :type pool: concrete subclass of
                      :class:`~google.cloud.spanner_v1.pool.AbstractSessionPool`.
          :param pool: (Optional) session pool to be used by database.
  
          :rtype: :class:`Database`
          :returns: The database parsed from the protobuf response.
          :raises ValueError:
              if the instance name does not match the expected format
              or if the parsed project ID does not match the project ID
              on the instance's client, or if the parsed instance ID does
              not match the instance's ID.
          
docstring: Creates an instance of this class from a protobuf.
docstring_tokens: Creates an instance of this class from a protobuf .
code: def from_pb(cls, database_pb, instance, pool=None):
          """Creates an instance of this class from a protobuf.
  
          :type database_pb:
              :class:`~google.cloud.spanner_admin_instance_v1.types.Instance`
          :param database_pb: A instance protobuf object.
  
          :type instance: :class:`~google.cloud.spanner_v1.instance.Instance`
          :param instance: The instance that owns the database.
  
          :type pool: concrete subclass of
                      :class:`~google.cloud.spanner_v1.pool.AbstractSessionPool`.
          :param pool: (Optional) session pool to be used by database.
  
          :rtype: :class:`Database`
          :returns: The database parsed from the protobuf response.
          :raises ValueError:
              if the instance name does not match the expected format
              or if the parsed project ID does not match the project ID
              on the instance's client, or if the parsed instance ID does
              not match the instance's ID.
          """
          match = _DATABASE_NAME_RE.match(database_pb.name)
          if match is None:
              raise ValueError(
                  "Database protobuf name was not in the " "expected format.",
                  database_pb.name,
              )
          if match.group("project") != instance._client.project:
              raise ValueError(
                  "Project ID on database does not match the "
                  "project ID on the instance's client"
              )
          instance_id = match.group("instance_id")
          if instance_id != instance.instance_id:
              raise ValueError(
                  "Instance ID on database does not match the "
                  "Instance ID on the instance"
              )
          database_id = match.group("database_id")
  
          return cls(database_id, instance, pool=pool)
code_tokens: def from_pb ( cls , database_pb , instance , pool = None ) : match = _DATABASE_NAME_RE . match ( database_pb . name ) if match is None : raise ValueError ( "Database protobuf name was not in the " "expected format." , database_pb . name , ) if match . group ( "project" ) != instance . _client . project : raise ValueError ( "Project ID on database does not match the " "project ID on the instance's client" ) instance_id = match . group ( "instance_id" ) if instance_id != instance . instance_id : raise ValueError ( "Instance ID on database does not match the " "Instance ID on the instance" ) database_id = match . group ( "database_id" ) return cls ( database_id , instance , pool = pool )
short_docstring: Creates an instance of this class from a protobuf.
short_docstring_tokens: Creates an instance of this class from a protobuf .
comment: """Creates an instance of this class from a protobuf.
  
          :type database_pb:
              :class:`~google.cloud.spanner_admin_instance_v1.types.Instance`
          :param database_pb: A instance protobuf object.
  
          :type instance: :class:`~google.cloud.spanner_v1.instance.Instance`
          :param instance: The instance that owns the database.
  
          :type pool: concrete subclass of
                      :class:`~google.cloud.spanner_v1.pool.AbstractSessionPool`.
          :param pool: (Optional) session pool to be used by database.
  
          :rtype: :class:`Database`
          :returns: The database parsed from the protobuf response.
          :raises ValueError:
              if the instance name does not match the expected format
              or if the parsed project ID does not match the project ID
              on the instance's client, or if the parsed instance ID does
              not match the instance's ID.
          """