run-llama/llama_index · error · NotImplementedError

SimpleGraphStore does not support get_schema

Error message

SimpleGraphStore does not support get_schema

What it means

SimpleGraphStore.get_schema() unconditionally raises NotImplementedError. SimpleGraphStore is an in-memory/dict-backed triple store (subject-predicate-object maps persisted as JSON); it has no schema concept and no query language, so the base GraphStore interface methods it cannot honor are explicitly stubbed out with clear errors rather than returning fake data.

Source

Thrown at llama-index-core/llama_index/core/graph_stores/simple.py:155

                    del self._data.graph_dict[subj]

    def persist(
        self,
        persist_path: str = os.path.join(DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME),
        fs: Optional[fsspec.AbstractFileSystem] = None,
    ) -> None:
        """Persist the SimpleGraphStore to a directory."""
        fs = fs or self._fs
        dirpath = os.path.dirname(persist_path)
        if not fs.exists(dirpath):
            fs.makedirs(dirpath)

        with fs.open(persist_path, "w", encoding="utf-8") as f:
            json.dump(self._data.to_dict(), f)

    def get_schema(self, refresh: bool = False) -> str:
        """Get the schema of the Simple Graph store."""
        raise NotImplementedError("SimpleGraphStore does not support get_schema")

    def query(self, query: str, param_map: Optional[Dict[str, Any]] = {}) -> Any:
        """Query the Simple Graph store."""
        raise NotImplementedError("SimpleGraphStore does not support query")

    @classmethod
    def from_persist_path(
        cls, persist_path: str, fs: Optional[fsspec.AbstractFileSystem] = None
    ) -> "SimpleGraphStore":
        """Create a SimpleGraphStore from a persist directory."""
        fs = fs or fsspec.filesystem("file")
        if not fs.exists(persist_path):
            logger.warning(
                f"No existing {__name__} found at {persist_path}. "
                "Initializing a new graph_store from scratch. "
            )
            return cls()

View on GitHub (pinned to afd0fef371)

Solutions

  1. Use a real graph backend that implements get_schema — e.g. Neo4jGraphStore, NebulaGraphStore, or another integration package.
  2. If you only need triple storage/retrieval, call SimpleGraphStore's supported methods (get/upsert triple(s), get_triplets) instead of get_schema.
  3. Feature-detect before calling: skip schema introspection when isinstance(store, SimpleGraphStore) or when the method raises NotImplementedError.

Example fix

# before
schema = graph_store.get_schema()  # SimpleGraphStore -> NotImplementedError

# after
try:
    schema = graph_store.get_schema(refresh=True)
except NotImplementedError:
    schema = ""  # simple in-memory store has no schema
Defensive patterns

Strategy: fallback

Validate before calling

from llama_index.core.graph_stores.simple import SimpleGraphStore

schema = "" if isinstance(graph_store, SimpleGraphStore) else graph_store.get_schema(refresh=True)

Type guard

def supports_schema(store) -> bool:
    return not isinstance(store, (SimpleGraphStore, SimplePropertyGraphStore))

Try / catch

try:
    schema = graph_store.get_schema(refresh=True)
except NotImplementedError:
    schema = ""  # in-memory stores carry no schema

Prevention

When it happens

Trigger: Calling graph_store.get_schema() on a store created via SimpleGraphStore() or SimpleGraphStore.from_persist_path(...) — typically generic code (e.g. a KnowledgeGraphIndex/RAG flow that introspects the store's schema, or PropertyGraphIndex scaffolding) that assumes a full graph-database backend like Neo4j.

Common situations: Prototyping with the default simple store and then wiring in code written against Neo4jGraphStore/NeptuneGraphStore; LLM agents calling get_schema() to build prompts; swapping store implementations via config without adjusting the query layer.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/55ee6b6dcf9b3d85. Report an issue: GitHub.