Price Groups

Table name: price_groups

Contains pricing group configurations and their application metrics across charge points,
sites, and team members. Includes both team-owned and operator-owned price groups,
providing comprehensive counts and aggregations for both total and non-deleted entities
to support pricing strategy analysis and billing operations. Scopes data to the
partner's teams and operator.

📘

New model

This table is the replacement for the soon-to-be-deprecated team_price_groups. It includes both team-owned and operator-owned price groups.

SQL: price_groups

Schema

Column NameData TypeDescription
Primary ID
idINTEGERPrimary key
Other IDs
owner_idINTEGERID of the owner (team or operator) that owns this price group
owner_typeVARCHARType of owner — Team for team-owned price groups, Operator for operator-owned
team_idINTEGERForeign key reference to the team associated with this price group (null for operator-owned price groups)
operator_idINTEGERForeign key reference to the operator managing this price group
external_idVARCHARExternal system identifier for the price group used for integration purposes
Timestamps
created_atTIMESTAMP_NTZTimestamp when the price group record was originally created
updated_atTIMESTAMP_NTZTimestamp when the price group record was last modified
deleted_atTIMESTAMP_NTZTimestamp when the price group was soft deleted, null if still active
Filters
is_main_operator_matchBOOLEANIndicates whether this price group belongs to the main operator (true) or a different operator (false)
Attributes
typeVARCHARClassification or category of the price group configuration
nameVARCHARHuman-readable name assigned to the price group for identification
team_member_countINTEGERNumber of team members currently associated with this price group
charge_point_countINTEGERNumber of charge points currently associated with this price group
Pricing Flags
pricings_countINTEGERTotal number of pricing configurations associated with this price group
has_pricingsBOOLEANIndicates whether this price group has any pricing configurations defined (true) or not (false)
Applied To Aggregations
applied_to_charge_points_totalINTEGERTotal count of charge points where this price group is applied, including deleted entities
applied_to_sites_totalINTEGERTotal count of sites where this price group is applied, including deleted entities
applied_to_team_members_totalINTEGERTotal count of team members where this price group is applied, including deleted entities
applied_to_charge_points_non_deletedINTEGERCount of active charge points where this price group is applied, excluding soft-deleted entities
applied_to_sites_non_deletedINTEGERCount of active sites where this price group is applied, excluding soft-deleted entities
applied_to_team_members_non_deletedINTEGERCount of active team members where this price group is applied, excluding soft-deleted entities
Count Aggregates
charge_point_count_totalINTEGERAggregate count of all charge points associated with this price group, including deleted entities
site_count_totalINTEGERAggregate count of all sites associated with this price group, including deleted entities
team_member_count_totalINTEGERAggregate count of all team members associated with this price group, including deleted entities
charge_point_count_non_deletedINTEGERAggregate count of active charge points associated with this price group, excluding soft-deleted entities
site_count_non_deletedINTEGERAggregate count of active sites associated with this price group, excluding soft-deleted entities
team_member_count_non_deletedINTEGERAggregate count of active team members associated with this price group, excluding soft-deleted entities
legacy_count_valid_rowsINTEGERNumber of valid data rows used in calculations for this price group record (used to match with legacy version of model)

Inclusion Criteria

  • Team-owned price groups: the team_id must exist in the partner's teams table
  • Operator-owned price groups: the operator_id must match the partner's operator ID or a sub-operator's operator ID

Data flow

Upstream tablesDownstream tables
teamsprice_group_pricings
charge_pointscharge_member_costs

Alignment

Monta API

  • Aligns with Monta API get/price-groups endpoint
  • The API now supports price groups at both the team and operator level
  • The API excludes rows where deleted_at is not null

Migration from team_price_groups

This table replaces team_price_groups and includes all price groups (both team-owned and operator-owned). The team_price_groups table remains available during a transition period. Key differences:

  • Adds owner_id and owner_type columns to distinguish team-owned vs operator-owned price groups
  • team_id is null for operator-owned price groups
  • operator_id is derived from the team for team-owned price groups, and from owner_id for operator-owned price groups

Changes vs previous version

Summary

  • Adds owner_id, owner_type, pricings_count, and has_pricings columns
  • Includes operator-owned price groups as new rows — filter on owner_type = 'Team' to get the same results as team_price_groups

Added columns (4)

  • owner_id — ID of the owner (team or operator) that owns this price group
  • owner_type — Type of owner (Team or Operator)
  • pricings_count — Total number of pricing configurations associated with this price group
  • has_pricings — Whether this price group has any pricing configurations defined

Removed columns (0)

Renamed columns (0)

New rows

Operator-owned price groups are now included. To replicate the old team_price_groups results, filter on owner_type = 'Team'.


Did this page help you?