# View: dt_restrictions_label_territory

**View Name:** dt_restrictions_label_territory
**Table Source:** `INTELLIGENCE.DBT_PROD.RESTRICTIONS_LABEL_TERRITORY`
**File Path:** `dt_restrictions_label_territory.view.lkml`

## Overview

- **File Size:** 1374 bytes
- **Lines of Code:** 50
- **Dimensions:** 2
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Comments & Notes

- derived_table: {
- sql: WITH territory_restrictions AS (
- TRY_TO_NUMBER(a.value::string) AS country_id

## Dimensions

| Name | Type |
|------|------|
| `label_id` | number |
| `list_aggregate_restrictions` | string |

## Derived Table

```sql
#    sql: WITH territory_restrictions AS (
#  SELECT id,
#      TRY_TO_NUMBER(a.value::string) AS country_id
#  FROM orchard_app_reporting_v2.art_relations_prod_art_relations.vendor_contract,
#  LATERAL FLATTEN(INPUT => SPLIT(territory_carve_out, ',')) a
#  WHERE country_id IS NOT NULL)
#
#SELECT
#    vw.vendor_id,
#    LISTAGG(DISTINCT c.name, ', ') WITHIN GROUP (ORDER BY c.name) AS list_aggregate_restrictions
#FROM territory_restrictions tr
#INNER JOIN intelligence.dbt_prod.active_vendor_contracts vw ON tr.id = vw.vendor_contract_id
#INNER JOIN orchard_app_reporting_v2.art_relations_prod_art_relations.country c ON tr.country_id = c.id
#GROUP BY 1
#      ;;
#
```

