Debian Codegraph @

gavo/resources/inputs/__system__/rds.rd

raw
1 <resource schema="dc" resdir="__system">
2 <meta name="creationDate">2020-02-21</meta>
3 <meta name="description">Management of RDs on the system.</meta>
4 <meta name="subject">astronomical-software</meta>
5
6 <table id="rdmeta" onDisk="True" system="True"
7 dupePolicy="overwrite" primary="sourceRD">
8 <meta name="description">This table lists the RDs DaCHS has imported
9 or otherwise manipulated.
10
11 Additionally, on import, we add the schema and whether there's
12 ADQL tables in the RD; this helps when several RDs share a single
13 schema.
14 </meta>
15
16 <column name="sourceRD" type="text"
17 tablehead="RD id"
18 description="Identifier (i.e., inputs-relative path, without .rd)
19 of the RD"
20 verbLevel="1"/>
21 <column name="data_updated" type="timestamp"
22 tablehead="Data Upd."
23 description="UTC of last execution of dachs imp on this RD. This
24 is NULL for RDs without data or when they have never been imported.
25 This is *not* reset on drop."
26 verbLevel="1"/>
27 <column name="schema_name" type="text"
28 tablehead="Schema"
29 description="Name of the schema managed by this RD when it was
30 last touched."
31 verbLevel="1"/>
32 <column name="adql" type="boolean" required="True"
33 tablehead="TAP?"
34 description="True if the RD had TAP-published tables when it was
35 last touched."
36 verbLevel="1"/>
37
38 <column name="spatial" type="text"
39 description="A representation of this resource's coverage as
40 a string suitable for including into RDs (an ASCII MOC, likely)"/>
41 <column name="temporal" type="double precision[]"
42 description="A flattened-out array of pairs of lower/upper pairs
43 of MJD of temporal coverage (as in RDs)"/>
44 <column name="spectral" type="double precision[]"
45 description="A flattened-out array of pairs of lower/upper pairs
46 of Joules of spectral coverage (as in RDs)"/>
47 </table>
48
49 <data id="update-for-rd" updating="True">
50 <!-- this data element takes a pair of (reason, RD) as input to its
51 embedded grammar and creates an new record for rdmeta. It is
52 made manually by dachs imp and dachs pub. -->
53 <sources/>
54 <embeddedGrammar>
55 <iterator>
56 <code>
57 reason, rd = self.sourceToken
58 row = {
59 "sourceRD": rd.sourceId,
60 "schema_name": rd.schema,
61 "data_updated": rd.getMeta("dataUpdated"),
62 }
63
64 for td in rd.tables:
65 if td.adql:
66 row["adql"] = True
67 break
68 else:
69 row["adql"] = False
70
71 if reason=="import":
72 row["data_updated"] = datetime.datetime.utcnow()
73
74 yield row
75 </code>
76 </iterator>
77 </embeddedGrammar>
78 <make table="rdmeta"/>
79 </data>
80 </resource>