You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updating docs to use the term lookup tables instead of reference tables (#102)
* Updating documentation to use the term lookup tables instead of reference tables
* Renaming reference to lookup in the code base, deprecating reference_tables argument
* ignoring felis import lint warning
Copy file name to clipboardExpand all lines: docs/index.rst
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,15 +22,15 @@ For example, the `SIMPLE database <https://github.com/SIMPLE-AstroDB/SIMPLE-db>`
22
22
23
23
- the primary Sources table, with coordinate information for each target
24
24
- several object data tables, like Photometry, Spectra, etc, that contain information for each target
25
-
- reference tables, like Publications, Telescopes, etc, that list other information that is used throughout the database, but doesn't refer to a particular target
25
+
- lookup tables, like Publications, Telescopes, etc, that list other information that is used throughout the database, but doesn't refer to a particular target. These are sometimes referred to as lookup or reference tables.
26
26
27
27
The goal of **AstrodbKit** is to link together the object tables together in order
28
-
to express them as a single entity, while still retaining the information for other reference tables.
28
+
to express them as a single entity, while still retaining the information for other lookup tables.
29
29
**AstrodbKit** can read and write out an entire target's data as a single JSON file for ease of transport and version
30
-
control. Reference tables are also written as JSON files, but organized differently-
30
+
control. Lookup tables are also written as JSON files, but organized differently-
31
31
a single file per table with multiple records.
32
32
An **AstrodbKit**-supported database can thus be exported to two types of JSON files:
33
-
individual target files and reference table files
33
+
individual target files and lookup table files
34
34
If your database is constructed in a similar fashion, it will work well with **AstrodbKit**.
35
35
Other databases can still benefit from some of the functionality of **AstrodbKit**,
36
36
but they might not work properly if attempting to use the save/load methods.
@@ -90,30 +90,32 @@ then initialize the database with the :py:class:`astrodbkit.astrodb.Database()`
90
90
The database is now read to be used. If the database is empty, see below how to populate it.
91
91
92
92
.. note:: The :py:class:`astrodbkit.astrodb.Database()` class has many parameters that can be set to
93
-
control the names of primary/reference tables. By default, these match the SIMPLE database, but users can
93
+
control the names of primary/lookup tables. By default, these match the SIMPLE database, but users can
94
94
configure them for their own needs and can pass them here or modify their __init__.py file.
95
95
96
96
97
97
When using PostgreSQL databases, it may be useful to pass along connection_arguments that specify the schema to use. For example::
# This will use my_schema as the default schema for this connection
110
110
111
+
.. note:: For historical reasons, lookup tables are referred internally as reference tables.
112
+
111
113
Loading the Database
112
114
--------------------
113
115
114
116
**Astrodbkit2** contains methods to output the full contents of the database as a list of JSON files.
115
117
It can likewise read in a directory of these files to populate the database.
116
-
By default, reference tables (eg, Publications, Telescopes, etc) and source tables are respectively stored in `reference/` and `source/` sub-directories of `data/`.
118
+
By default, lookup tables (eg, Publications, Telescopes, etc) and source tables are respectively stored in `reference/` and `source/` sub-directories of `data/`.
117
119
This is how SIMPLE is currently version controlled.
118
120
119
121
To load a database of this form, do the following::
@@ -271,7 +273,7 @@ Full String Search
271
273
Similar to the Identifier Search above, one can perform a case-insensitive search for
272
274
any string against every string column in the database with :py:meth:`~astrodbkit.astrodb.Database.search_string`.
273
275
The output is a dictionary with keys for each table that matched results.
274
-
This can be useful to find all results matching a particular reference regardless of table::
276
+
This can be useful to find all results matching a particular publication regardless of table::
275
277
276
278
db.search_string('twa') # search for any records with 'twa' anywhere in the database
277
279
db.search_string('Cruz18', fuzzy_search=False) # search for strings exactly matching Cruz19 anywhere in the database
@@ -438,8 +440,8 @@ Saving the Database
438
440
===================
439
441
440
442
If users perform changes to a database, they will want to output this to disk to be version controlled.
441
-
**Astrodbkit** provides methods to save an individual source or reference table as well as all of the data stored in the database.
442
-
By default, reference tables are stored in a sub-directory of `data/` called "reference"; this can be overwritten by
443
+
**Astrodbkit** provides methods to save an individual source or lookup table as well as all of the data stored in the database.
444
+
By default, lookup/reference tables are stored in a sub-directory of `data/` called "reference"; this can be overwritten by
443
445
supplying a `reference_directory` variable into `save_database` or `save_reference_table`.
444
446
Similarly, source/object tables are stored in a sub-directory of `data/` called "source" which can be overwritten by supplying a `source_directory` variable.
445
447
@@ -448,7 +450,7 @@ We recommend using `save_database` as that outputs the entire database contents
448
450
# Save single object
449
451
db.save_json('2MASS J13571237+1428398', 'data')
450
452
451
-
# Save single reference table
453
+
# Save single lookup/reference table
452
454
db.save_reference_table('Publications', 'data')
453
455
454
456
# Save entire database to directory 'data/' with 'reference/' and 'source/' subdirectories.
@@ -517,7 +519,7 @@ Here we provide useful tips or guidance when working with **AstrodbKit**.
517
519
Handling Relationships Between Object Tables
518
520
--------------------------------------------
519
521
520
-
Becuase **AstrodbKit** expects a single primary table, object tables that point back to it, and any number of reference tables, it can be difficult to handle relationships between object tables.
522
+
Becuase **AstrodbKit** expects a single primary table, object tables that point back to it, and any number of lookup/reference tables, it can be difficult to handle relationships between object tables.
521
523
522
524
As an example, consider the scenario where you want to store companion information to your sources, such as a table to store the relationship with orbital separation and a separate one to store general parameters.
523
525
You may be calling these CompanionRelationship and CompanionParameters, respectively.
@@ -527,7 +529,7 @@ You might find it attempting to load CompanionParameters only to find that Compa
527
529
528
530
The better approach is to define a lookup table that will store the companion identifiers which will be used as the foreign keys.
529
531
For example, a CompanionList table that both CompanionParameters and CompanionRelationship can refer to.
530
-
This would be a reference table, similar to Telescopes or Publications, while CompanionParameters and CompanionRelationship would be object tables that require tying back to a specific source in the Sources table.
532
+
This would be a lookup table, similar to Telescopes or Publications, while CompanionParameters and CompanionRelationship would be object tables that require tying back to a specific source in the Sources table.
531
533
Essentially, this is normalizing the database a bit further and serves to avoid some common issues with foreign keys.
0 commit comments