database.py | update _ensure_connected()