You can easily backup data with
./run.sh backup backups/your_backup_name_herethen load from an existing snapshot with
./run.sh reload_from_backup backups/your_backup_name_hereor from production container mode
./run.sh reload_from_backup -p backups/your_backup_name_hereSee run.md for more info.
To access the database, first import the Database class from db.py:
from ..db import DatabaseThen, you can execute SQL queries by
with Database() as db:
db.execute("""<SQL HERE>""") or if you want the values returned from the execute, use
with Database() as db:
out = db.execute_return("""<SQL HERE>""") which will return a list of the results too.
Note
with Database() as db
opens up the db connection, then closes it when the scope is finished
Wrap execute or execute_return in try except statements like this:
with Database() as db:
try:
out = db.execute_return("""<SQL HERE>""")
except Exception as e:
# here if you encounter an error in the above query
passto catch errors.
To use the shell to run SQL commands to directly on the database, run
sh run.sh psqlwhich will open up the venome-posgres docker image and login to psql (posgresSQL) for you.
You should get access to the psql shell now, where you can run stuff like
If you have errors, make sure the docker container is already running (./run.sh start cmd).