Snapshots Management#

See also

The Vast DB SDK API Documentation is available here.

Important

This notebook is in the process of being migrated to Vast Data Platform Field Docs. It will probably not run yet.

Install sdk and connect to Vast DB#

Install vastdb library.

!pip install --quiet vastdb
# Change these variables to reflect your environment, E.g. 
#
# ENDPOINT = 'http://your_vast_endpoint:12345'
# DATABASE_NAME = 'your_db'
# ACCESS_KEY = 'your_access_key'
# SECRET_KEY = 'your_secret_key'

Connect to Vast DB

import vastdb

session = vastdb.connect(
    endpoint=ENDPOINT,
    access=ACCESS_KEY,
    secret=SECRET_KEY)

List Snapshots#

snapshots#

  • Usage: Lists all snapshots of the current bucket. A snapshot is a read-only copy of a bucket at a certain point in time. This method returns a list of Bucket objects, each representing a snapshot.

  • Parameters:

    • None

  • Returns:

    • List[Bucket]: A list of Bucket objects representing the snapshots of the current bucket.

  • Note:

    • The name of each snapshot is the name of the bucket followed by the snapshot name, separated by a slash.

with session.transaction() as tx:
    try:
        snapshots = tx.bucket(DATABASE_NAME).snapshots()
        for s in snapshots:
            print(s)
    except Exception as e:
        print("Issue retrieving snapshots:", e)
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_53_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_54_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_55_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_56_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_57_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_58_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_17_59_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_00_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_01_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_02_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_03_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_04_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_05_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_06_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_07_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_08_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_09_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_10_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_11_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_12_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_13_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_14_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_15_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_16_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_17_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_18_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_19_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_20_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_21_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_22_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_23_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_24_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_25_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_26_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_27_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_28_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_29_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_30_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_31_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_32_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_33_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_34_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_35_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_36_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_37_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_38_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_39_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_40_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_41_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_42_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_43_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_44_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_45_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_46_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_47_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_48_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_49_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_50_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_51_23_UTC', tx=Transaction(id=0x0737700000000724))
Bucket(name='vastdb/.snapshot/big_catalog_2024-10-13_18_52_23_UTC', tx=Transaction(id=0x0737700000000724))
with session.transaction() as tx:
    try:
        snapshots = tx.bucket(DATABASE_NAME).snapshot('.snapshot/big_catalog_2024-10-13_17_53_23_UTC')
        for s in snapshots:
            print(s)
    except Exception as e:
        print("Issue retrieving snapshots:", e)
Issue retrieving snapshots: ('vastdb', '.snapshot/vastdb/.snapshot/big_catalog_2024-10-13_17_53_23_UTC')