diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql index d33b9f35..0db4e70a 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql @@ -1,10 +1,6 @@ -- This query exports all agent builder usage. SELECT - abu.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + abu.* FROM agent_builder_usage abu -JOIN tenants t ON abu.tenant_id = t.id -JOIN organizations o ON t.organization_id = o.id ORDER BY abu.from_timestamp DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql index 6da22e37..c7baf7e0 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql @@ -31,11 +31,8 @@ backfill_txns AS ( SELECT bt.*, t.organization_id, - t.display_name AS workspace_name, - o.display_name AS organization_name, :'customer_id' AS customer_id, :'customer_name' AS customer_name FROM backfill_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON o.id = t.organization_id +LEFT JOIN tenants t ON bt.tenant_id = t.id ORDER BY bt.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql index b4090ab1..bcfbd4b0 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql @@ -22,10 +22,6 @@ WITH backfilled_txns AS ( backfilled_at ) SELECT - bt.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + bt.* FROM backfilled_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON o.id = t.organization_id ORDER BY bt.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql index a6d6c89e..bf19e765 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql @@ -14,10 +14,7 @@ SELECT rm.self_hosted_customer_id, rm.backfill_id, rm.backfilled_at, - t.organization_id, - t.display_name AS workspace_name, - o.display_name AS organization_name + t.organization_id FROM remote_metrics rm -JOIN tenants t ON rm.tenant_id = t.id -JOIN organizations o ON t.organization_id = o.id +LEFT JOIN tenants t ON rm.tenant_id = t.id ORDER BY rm.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql index 25dd1b3a..9e01a88d 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql @@ -18,11 +18,7 @@ backfill_txns AS ( ) SELECT bt.*, - t.display_name AS workspace_name, - o.display_name AS organization_name, :'customer_id' AS customer_id, :'customer_name' AS customer_name FROM backfill_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON bt.organization_id = o.id ORDER BY bt.created_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql index a4564dc2..c5f3bd5d 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql @@ -9,10 +9,6 @@ WITH backfilled_txns AS ( RETURNING * ) SELECT - bt.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + bt.* FROM backfilled_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON bt.organization_id = o.id ORDER BY bt.created_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql index fdb8a019..ce4e73b1 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql @@ -1,10 +1,6 @@ -- This query exports all trace count transactions. SELECT - tc.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + tc.* FROM trace_count_transactions tc -JOIN tenants t ON tc.tenant_id = t.id -JOIN organizations o ON t.organization_id = o.id ORDER BY tc.created_at DESC;