File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212from core import application_db as db
1313from core .admin import user_datastore
1414from core .models import Role
15+ from core .api .db_interface import get_all_fishfries
16+ from datetime import datetime
17+ from pathlib import Path
18+ import json
1519
1620
1721# ---------------------------------------------------------
@@ -123,10 +127,19 @@ def bootstrap_db():
123127 click .echo ("Created user {0}" .format (new_user .email ))
124128 return
125129
130+ @click .command ()
131+ @click .option ('--path' )
132+ def dump_geojson (path ):
133+ fries = get_all_fishfries ()
134+ out_file = Path (path ) / "fishfry_{0}.geojson" .format (datetime .now ().strftime ('%Y%d%mT%H%M%S' ))
135+ with open (str (out_file ), 'w' ) as fp :
136+ json .dump (fries , fp )
137+ click .echo ("dumped fishfries to {0}" .format (str (out_file )))
126138
127139manage_db .add_command (new_user )
128140manage_db .add_command (new_role )
129141manage_db .add_command (bootstrap_db )
142+ manage_db .add_command (dump_geojson )
130143
131144if __name__ == '__main__' :
132145 manage_db ()
You can’t perform that action at this time.
0 commit comments