How to get library versioning details from the database

How to get library versioning details from the database

book

Article ID: KB0070387

calendar_today

Updated On:

Products Versions
Spotfire Server 12.0.0 and above

Description

Starting from Spotfire version 12.0, it is now possible to utilize the version history feature in the Spotfire library. With this feature enabled, you can easily view all the previous versions of your analysis and restore any of them if needed. You can also save a previous version as a new file. For new installations, the library version history is enabled by default and each time you update a file, a new version is automatically created. The following article provides the steps to retrieve the versioning details from the database.

Issue/Introduction

This article explains how to retrieve versioning details from a database.

Environment

All

Resolution

The following example query for MSSQL can be used to obtain version details and size details for those versions from the database. 
= = = = = =
SELECT
li.TITLE,
liv.ITEM_ID,
COUNT(liv.VERSION_ID) as [# Versions],
SUM(ld.CONTENT_SIZE) as [Total Content Size],
Min(liv.CREATED) as [Min Version Created Date],
Max(liv.CREATED) as [Max Version Created Date],
li.ITEM_TYPE
FROM LIB_ITEM_VERSIONS liv
JOIN LIB_ITEMS li ON li.ITEM_ID = liv.ITEM_ID
JOIN LIB_DATA ld ON liv.DATA_ID = ld.DATA_ID
GROUP BY li.TITLE,li.ITEM_TYPE,liv.ITEM_ID
ORDER BY SUM(ld.CONTENT_SIZE) desc
--ORDER BY COUNT(liv.VERSION_ID) desc
= = = = = =

If you want to delete the library versions you can delete all, or some old versions of a file by using delete-library-versions command. Single old versions can be deleted from the Library user interface.

Additional Information

Library version history: https://docs.tibco.com/pub/spotfire_server/latest/doc/html/TIB_sfire_server_tsas_admin_help/server/topics/library_version_history.html
delete-library-versions:
https://docs.tibco.com/pub/spotfire_server/latest/doc/html/TIB_sfire_server_tsas_admin_help/server/topics/delete-library-versions.html