How can i get total number of presents and models in pyramid for version 2025.01.004 using pyramid sql repository.
Hi everyone,
We are running Pyramid in a single‑tenant deployment on our own VMs, and I am trying to generate daily stats for:
- total active Models
- total active Presents
This is to help us track adoption trends and “work in progress” over time.
From what I understand, the content_tbl_item table stores all content objects, and item_type identifies the object type. Based on documentation and older forum references, I have the following mappings:
- item_type = 4 → Models
- item_type = 8 → Presents
To calculate the active counts, I am using these queries:
Models
SQL
SELECT COUNT(*) AS etl FROM dbo.content_tbl_item WITH (NOLOCK)
WHERE item_type = 4 AND (is_deleted = 0 OR is_deleted IS NULL)
AND is_active = 1;
Presents
SQL
SELECT COUNT(*) AS present FROM dbo.content_tbl_item WITH (NOLOCK)
WHERE item_type = 8 AND (is_deleted = 0 OR is_deleted IS NULL)
AND is_active = 1;
My questions
- Are these
item_typevalues correct (4 = model, 8 = present) in a single‑tenant Pyramid install? - Is this the correct and supported way to count active content items in Pyramid?
- Are there any other flags or joins I should include to ensure accuracy (e.g., multi-version rows, ownership, tenant filters, etc.)?
1 reply
-
Hi Chaitali.
First, remember that any queries run against the repository database need to be executed with care. Please make sure queries are reviewed and tested before running them, as improper or heavy queries can impact performance and data integrity.
Regarding item types, these are the ones you can use in your queries:
case
when (item_type = 4 and sub_type =1) then 'Discover'
when (item_type = 4 and sub_type =2) then 'Present'
when (item_type = 4 and sub_type =3) then 'Publish'
when (item_type = 4 and sub_type =5) then 'Tabulate'
when (item_type = 6 and sub_type = 1) then 'Formula'
when (item_type = 6 and sub_type =2) then 'Custom List'
when (item_type = 6 and sub_type =3) then 'Model Parameter'
when (item_type = 6 and sub_type = 4) then 'Formulate Script'
when (item_type = 6 and sub_type = 5) then 'KPI'
when (item_type = 6 and sub_type = 6) then 'Custom Column'
when (item_type = 6 and sub_type = 7) then 'Custom Visual'
when (item_type = 8 and sub_type is null) then 'Model'
end as "Content Type"I hope it helps.
Thanks,
Eduardo