Aracılığıyla paylaş


Çalışma alanı sistem tablosu referansı

Önemli

Bu sistem tablosu Genel Önizleme aşamasındadır.

Bu sayfada, Azure Databricks hesabınızdaki çalışma alanlarını izlemek için çalışma alanları sistem tablosunun nasıl kullanılacağı açıklanmaktadır. Tablodaki her satır, meta veriler ve yaşam döngüsü durumu dahil olmak üzere hesabınızdaki etkin bir çalışma alanının bilinen en son durumunu temsil eder.

Bu tablo en çok diğer sistem tablolarıyla birleştirildiğinde kullanışlıdır. Hesabınızdaki çalışma alanları genelinde güvenilirlik, performans ve maliyetle ilgili toplu istatistikler almak için bunu kullanabilirsiniz.

Uyarı

Tablo yalnızca şu anda hesabınızda bulunan çalışma alanlarını içerir. Bir çalışma alanı iptal edildikten sonra satırı çalışma alanları sistem tablosundan kaldırılır.

Tablo yolu: Bu tablo şu konumda bulunur: system.access.workspaces_latest

Çalışma alanları tablo şeması

Sütun adı Veri türü Açıklama Örnek
account_id String Databricks hesabının kimliği 0722779a-fd4e-49c1-a7a6-8417a97cf9ea
workspace_id String Databricks çalışma alanının kimliği '2274721051152826'
workspace_name String Çalışma alanının okunabilir adı hamur-re-mi
workspace_url String Çalışma alanının URL'si https://dough-re-mi-pizza.cloud.databricks.com/
create_time Tarih damgası Çalışma alanının oluşturulduğu zamanın zaman damgası (saniye hassasiyeti) 2025-03-05 15:47
status enumerasyon Çalışma alanının durumu. Çalışma alanı oluşturmak için başlangıçta olarak PROVISIONING ayarlanır. "RUNNING durumu olana kadar durumu kontrol etmeye devam edin." NOT_PROVISIONED, PROVISIONING, RUNNING, FAILED, , BANNED

Örnek sorgulamalar

Aşağıdaki bölümler çalışma alanları sistem tablosunu kullanan örnek SQL sorgularını içerir.

Şu anda hangi çalışma alanları çalışıyor?

Aşağıdaki sorgu, hesabınızdaki RUNNING durumundaki tüm çalışma alanlarını şu anda gösterir.

SELECT
    workspace_id,
    workspace_name,
    workspace_url,
    create_time
FROM
    system.access.workspaces_latest
WHERE
    status = "RUNNING";

En yüksek harcamaya sahip çalışma alanları hangileridir?

Bu sorgu, son 30 gün içinde harcama yaparak hesabınızdaki en iyi 10 çalışma alanını hesaplar.

WITH
-- apply date filter
usage_with_ws_filtered_by_date AS (
  SELECT
    w.workspace_id,
    w.workspace_name,
    w.workspace_url,
    u.usage_quantity,
    u.usage_unit,
    u.sku_name,
    u.usage_end_time,
    u.cloud
  FROM
    system.billing.usage AS u NATURAL JOIN system.access.workspaces_latest AS w
  WHERE
    u.usage_date > DATE_ADD(CURRENT_DATE(), -30)
),
-- calc list priced usage in USD
prices AS (
  SELECT
    COALESCE(price_end_time, DATE_ADD(current_date, 1)) AS coalesced_price_end_time,
    *
  FROM
    system.billing.list_prices
  WHERE
    currency_code = 'USD'
),
list_priced_usd AS (
  SELECT
    COALESCE(u.usage_quantity * p.pricing.default, 0) as usage_usd,
    u.*
  FROM
    usage_with_ws_filtered_by_date as u
      LEFT JOIN prices AS p
        ON u.sku_name = p.sku_name
        AND u.cloud = p.cloud
        AND u.usage_unit = p.usage_unit
        AND (u.usage_end_time BETWEEN p.price_start_time AND p.coalesced_price_end_time)
)
-- calc total usage in USD
SELECT
  workspace_id,
  workspace_name,
  workspace_url,
  round(sum(usage_usd), 2) AS usage_usd
FROM
  list_priced_usd
GROUP BY
  1,
  2,
  3
ORDER BY
  4 DESC
limit 10;

Hesabım genelinde en pahalı olan işler hangileridir?

Bu sorgu, son 30 gün içinde hesabınızdaki en pahalı 10 işi hesaplar.

with usage_with_cost AS (
  SELECT
    *,
    t1.usage_quantity * list_prices.pricing.default as list_cost
  FROM system.billing.usage t1
  INNER JOIN system.billing.list_prices list_prices on
      t1.cloud = list_prices.cloud and
      t1.sku_name = list_prices.sku_name and
      t1.usage_start_time >= list_prices.price_start_time and
      (t1.usage_end_time <= list_prices.price_end_time or list_prices.price_end_time is null)
),
most_expensive_jobs_30d AS (
  SELECT
    workspace_id,
    usage_metadata.job_id,
    SUM(list_cost) as list_cost
  FROM usage_with_cost
  WHERE
    usage_metadata.job_id IS NOT NULL
    AND usage_date >= CURRENT_DATE() - INTERVAL 30 DAYS
  GROUP BY ALL
  ORDER BY list_cost DESC
  LIMIT 100
),
latest_jobs AS (
  SELECT
    *,
    ROW_NUMBER() OVER (PARTITION BY workspace_id, job_id ORDER BY change_time DESC) as rn
  FROM system.lakeflow.jobs QUALIFY rn=1
)
SELECT
  t1.workspace_id,
  t2.workspace_name,
  t3.name as job_name,
  CONCAT(
    t2.workspace_url, '/jobs/', t1.job_id
  ) as job_url,
  t1.list_cost
FROM most_expensive_jobs_30d t1
LEFT JOIN  system.access.workspaces_latest t2 using (workspace_id)
LEFT JOIN latest_jobs t3 USING (workspace_id, job_id)
ORDER BY list_cost DESC
LIMIT 10;