-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to manage metadata for database scans
This script connects to the database, retrieves scans, and updates their metadata for improved classification.
- Loading branch information
1 parent
66186f6
commit 9dc5c34
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Metadata Management for Database Scans | ||
This module provides functionality for adding metadata to scans in a database. | ||
Key Features: | ||
- Connects to a database using the `FSDB` module. | ||
- Retrieves all available scans from the database. | ||
- Adds or updates metadata to scans for better classification and organization. | ||
- Provides an easy-to-use method for specifying metadata, such as ownership and project details, in bulk or customized workflows. | ||
""" | ||
|
||
import os | ||
|
||
from plantdb.fsdb import FSDB | ||
from plantdb.fsdb_tools import add_metadata_to_scan | ||
|
||
path = os.environ.get('ROMI_DB', None) | ||
|
||
if path is None: | ||
raise ValueError('Environment variable ROMI_DB not set.') | ||
|
||
db = FSDB(path) | ||
db.connect("anonymous") | ||
|
||
for scan in db.get_scans(): | ||
new_md = {"owner": "test", "project": "test"} | ||
add_metadata_to_scan(db, scan, metadata=new_md) |