client.add_segment

Adds a user-defined Segment to a model.

For details on supported constants, operators, and functions, see Fiddler Query Language.

Input ParameterTypeRequiredDescription
namestringYesName of the segment
project_idstringYesThe unique identifier for the project
model_idstringYesThe unique identifier for the model
definitionstringYesThe FQL metric definition for the segment
descriptionstringNoA description of the segment
PROJECT_ID = 'my_project'
MODEL_ID = 'my_model'

definition = """
    age > 50
"""

client.add_segment(
    name='Over 50',
    description='All people over the age of 50',
    project_id=PROJECT_ID,
    model_id=MODEL_ID,
    definition=definition
)
Segment(
  id='50a1c32d-c2b4-4faf-9006-f4aeadd7a859',
  name='Over 50',
  project_name='my_project',
  organization_name='mainbuild',
  definition='age > 50',
  description='All people over the age of 50',
  created_at=None,
  created_by=None
)