def METHOD_NAME(self, i: int) -> "SQLiteDataset":
    """Make sure that a sqlite3 connection is open."""
    if self._database_list is None:
        assert isinstance(self._path, str)
        if self._conn is None:
            self._conn = sqlite3.connect(self._path)
    else:
        indices = self._indices[i]
        assert isinstance(indices, list)
        if self._conn is None:
            if self._all_connections_established is False:
                self._all_connections = []
                for database in self._database_list:
                    con = sqlite3.connect(database)
                    self._all_connections.append(con)
                self._all_connections_established = True
            self._conn = self._all_connections[indices[1]]
        if indices[1] != self._current_database:
            self._conn = self._all_connections[indices[1]]
            self._current_database = indices[1]
    return self