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
Refactor to have references in separate sub-directory; closes#49 (#77)
* First pass at having references in separate directory
* Iterating on reference directory use
* Using shutil to fully remove data directory and any sub-directories
* Safer use of shutil for reference directory
* Minor updates
* Updating documentation
* Saving source JSON files to source sub-directory
* Updating documentation
* Further updates
* Apply suggestions from code review
Co-authored-by: Kelle Cruz <kellecruz@gmail.com>
* Print out path when saving source and reference tables
---------
Co-authored-by: Kelle Cruz <kellecruz@gmail.com>
Copy file name to clipboardExpand all lines: docs/index.rst
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,15 +83,18 @@ Loading the Database
83
83
--------------------
84
84
85
85
**Astrodbkit2** contains methods to output the full contents of the database as a list of JSON files.
86
-
It can likewise read in a directory of these files to populate the database.
87
-
This is how SIMPLE is currently version controlled. To load a database of this form, do the following::
86
+
It can likewise read in a directory of these files to populate the database.
87
+
By default, reference tables (eg, Publications, Telescopes, etc) and source tables are respectively stored in `reference/` and `source/` sub-directories of `data/`.
88
+
This is how SIMPLE is currently version controlled.
89
+
90
+
To load a database of this form, do the following::
.. note:: Database contents are cleared when loading from JSON files to ensure that the database only contains
97
100
sources from on-disk files. We describe later how to use the :py:meth:`~astrodbkit2.astrodb.Database.save_db` method
@@ -406,17 +409,21 @@ Saving the Database
406
409
===================
407
410
408
411
If users perform changes to a database, they will want to output this to disk to be version controlled.
409
-
**Astrodbkit2** provides methods to save an individual source or reference table as well as the entire data.
410
-
We recommend the later to output the entire contents to disk::
412
+
**Astrodbkit2** provides methods to save an individual source or reference table as well as all of the data stored in the database.
413
+
By default, reference tables are stored in a sub-directory of `data/` called "reference"; this can be overwritten by
414
+
supplying a `reference_directory` variable into `save_database` or `save_reference_table`.
415
+
Similarly, source/object tables are stored in a sub-directory of `data/` called "source" which can be overwritten by supplying a `source_directory` variable.
416
+
417
+
We recommend using `save_database` as that outputs the entire database contents to disk::
411
418
412
419
# Save single object
413
420
db.save_json('2MASS J13571237+1428398', 'data')
414
421
415
422
# Save single reference table
416
423
db.save_reference_table('Publications', 'data')
417
424
418
-
# Save entire database to directory 'data'
419
-
db.save_database('data')
425
+
# Save entire database to directory 'data/' with 'reference/' and 'source/' subdirectories.
0 commit comments