LSST Applications g1635faa6d4+cd41018181,g1653933729+a8ce1bb630,g28da252d5a+9f67f2cd61,g2bbee38e9b+afd37a6135,g2bc492864f+afd37a6135,g2cdde0e794+3ad5f2bb52,g3156d2b45e+07302053f8,g33b1fccb7f+5f3fbc5215,g347aa1857d+afd37a6135,g35bb328faa+a8ce1bb630,g3a166c0a6a+afd37a6135,g3e281a1b8c+693a468c5f,g4005a62e65+17cd334064,g414038480c+36331ed8df,g41af890bb2+5e164101f9,g57cf332d5c+8bf329c3b1,g781aacb6e4+a8ce1bb630,g80478fca09+30926ec3c6,g82479be7b0+923225cd3a,g858d7b2824+30db5ec68c,g9125e01d80+a8ce1bb630,ga5288a1d22+91ef555625,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gbb4f38f987+30db5ec68c,gc28159a63d+afd37a6135,gcf0d15dbbd+754df76b7f,gcfacc2a72f+7db8e9b0b3,gda3e153d99+30db5ec68c,gda6a2b7d83+754df76b7f,gdaeeff99f8+1711a396fd,ge2409df99d+3b9c66f090,ge33fd446bb+30db5ec68c,ge79ae78c31+afd37a6135,gebdfc2c0af+fdb5b64983,gf0baf85859+5daf287408,gf3967379c6+e78244637f,gf8bc214d71+c4204bfb82,v24.1.6.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Functions
lsst.dax.apdb.scripts.metadata Namespace Reference

Functions

None metadata_delete (str config, str key)
 
None metadata_get (str config, str key)
 
None metadata_set (str config, str key, str value, bool force)
 
None metadata_show (str config, bool use_json)
 

Function Documentation

◆ metadata_delete()

None lsst.dax.apdb.scripts.metadata.metadata_delete ( str config,
str key )
Delete metadata key.

Parameters
----------
config : `str`
    Path or URI of APDB configuration file.
key : `str`
    Metadata key.

Definition at line 32 of file metadata.py.

32def metadata_delete(config: str, key: str) -> None:
33 """Delete metadata key.
34
35 Parameters
36 ----------
37 config : `str`
38 Path or URI of APDB configuration file.
39 key : `str`
40 Metadata key.
41 """
42 apdb = Apdb.from_uri(config)
43 apdb.metadata.delete(key)
44
45

◆ metadata_get()

None lsst.dax.apdb.scripts.metadata.metadata_get ( str config,
str key )
Print value of the metadata item.

Parameters
----------
config : `str`
    Path or URI of APDB configuration file.
key : `str`
    Metadata key.

Definition at line 46 of file metadata.py.

46def metadata_get(config: str, key: str) -> None:
47 """Print value of the metadata item.
48
49 Parameters
50 ----------
51 config : `str`
52 Path or URI of APDB configuration file.
53 key : `str`
54 Metadata key.
55 """
56 apdb = Apdb.from_uri(config)
57 value = apdb.metadata.get(key)
58 if value is None:
59 raise KeyError(f"Metadata key {key!r} does not exist.")
60 else:
61 print(value)
62
63

◆ metadata_set()

None lsst.dax.apdb.scripts.metadata.metadata_set ( str config,
str key,
str value,
bool force )
Add or update metadata item.

Parameters
----------
config : `str`
    Path or URI of APDB configuration file.
key : `str`
    Metadata key.
value : `str`
    Metadata value.
force : `bool`
    Set to True to allow updates for existing keys.

Definition at line 64 of file metadata.py.

64def metadata_set(config: str, key: str, value: str, force: bool) -> None:
65 """Add or update metadata item.
66
67 Parameters
68 ----------
69 config : `str`
70 Path or URI of APDB configuration file.
71 key : `str`
72 Metadata key.
73 value : `str`
74 Metadata value.
75 force : `bool`
76 Set to True to allow updates for existing keys.
77 """
78 apdb = Apdb.from_uri(config)
79 apdb.metadata.set(key, value, force=force)
80
81

◆ metadata_show()

None lsst.dax.apdb.scripts.metadata.metadata_show ( str config,
bool use_json )
Show contents of APDB metadata table.

Parameters
----------
config : `str`
    Path or URI of APDB configuration file.
use_json : `bool`
    If True dump in JSON format.

Definition at line 82 of file metadata.py.

82def metadata_show(config: str, use_json: bool) -> None:
83 """Show contents of APDB metadata table.
84
85 Parameters
86 ----------
87 config : `str`
88 Path or URI of APDB configuration file.
89 use_json : `bool`
90 If True dump in JSON format.
91 """
92 apdb = Apdb.from_uri(config)
93 if use_json:
94 data = {key: value for key, value in apdb.metadata.items()}
95 json.dump(data, sys.stdout, indent=2)
96 print()
97 else:
98 for key, value in apdb.metadata.items():
99 print(f"{key}: {value}")