Querying snapshots in the system

Snapshots can be searched with the query language. This section provides example snapshot queries, and lists the snapshot fields that can be searched with the query language.

Snapshot query overview

For detailed information on Queries refer to the Helix IPLM query language section.

Snapshot related fields for use in queries

Snapshot

  • all_resources (list of snapshot resources)

  • creation_timestamp (integer)

  • creator (user)

  • description (string)

  • fqn (string): the FQN of the snapshot

  • resources (list of snapshot resources)

  • top_ipv (snapshot resource)

  • workspace (workspace)

Searching snapshots in PiCLI 

Listing with search

'pi snap list' output can be filtered with searches:

Command Option Description
--query, -q QUERY Search Snpapshots using a query defined on the command line (not a Saved query). See here for more information on the query language.
--squery , -sq SQUERY Search Snapshotss using a Saved query. See here for more information on Saved queries.


When searching Snapshots with a query such as:

Snapshots with Creation Timestamps in the Last 1 Week

pi snap list tutorial.tutorial -q 'creation_timestamp>now()-weeks(1)'
┌─────────────────────────────┬───────────────────────────┬──────────────────────┬───────────────────────────────┐
│ SNAPSHOT                    │ TOP-IPV                   │ PARENT               │ DATE                          │
╞═════════════════════════════╪═══════════════════════════╪══════════════════════╪═══════════════════════════════╡
│ tutorial.tutorial@4#1.TRUNK │ tutorial.tutorial@4.TRUNK │                      │ 2020-06-02 22:24:32 -0400 EDT │
│ tutorial.tutorial@6#1.TRUNK │ tutorial.tutorial@6.TRUNK │                      │ 2020-06-01 08:24:16 -0400 EDT │
└─────────────────────────────┴───────────────────────────┴──────────────────────┴───────────────────────────────┘
Found 2 matching object(s).

Snapshots Created by the 'admin' user

pi snap list tutorial.digital_top -q 'creator~="admin"'
┌────────────────────────────────┬──────────────────────────────┬──────────────────────┬───────────────────────────────┐
│ SNAPSHOT                       │ TOP-IPV                      │ PARENT               │ DATE                          │
╞════════════════════════════════╪══════════════════════════════╪══════════════════════╪═══════════════════════════════╡
│ tutorial.digital_top@2#1.TRUNK │ tutorial.digital_top@2.TRUNK │ /tmp/workspaces/ws92 │ 2020-05-23 22:33:03 -0400 EDT │
└────────────────────────────────┴──────────────────────────────┴──────────────────────┴───────────────────────────────┘
Found 1 matching object(s).

Snapshots with a resource named 'padring'

pi snap list tutorial.tutorial -q 'any(all_resources, {name~="padring"})'
┌─────────────────────────────┬───────────────────────────┬──────────────────────┬───────────────────────────────┐
│ SNAPSHOT                    │ TOP-IPV                   │ PARENT               │ DATE                          │
╞═════════════════════════════╪═══════════════════════════╪══════════════════════╪═══════════════════════════════╡
│ tutorial.tutorial@6#2.TRUNK │ tutorial.tutorial@6.TRUNK │ /tmp/workspaces/ws19 │ 2020-06-02 22:32:26 -0400 EDT │
│ tutorial.tutorial@4#1.TRUNK │ tutorial.tutorial@4.TRUNK │                      │ 2020-06-02 22:24:32 -0400 EDT │
└─────────────────────────────┴───────────────────────────┴──────────────────────┴───────────────────────────────┘
Found 2 matching object(s).