Skip to main content
Back to contributions
Pull Request
Merged
287

Add SHOW STORAGE INFO and BUILD INFO queries

memgraph/gqlalchemy

Added get_storage_info() and get_build_info() methods to retrieve Memgraph instance information

The Problem

GQLAlchemy, the Python OGM (Object Graph Mapper) for Memgraph, was missing programmatic access to critical database introspection capabilities. Specifically, developers had no way to retrieve:

  • Storage metrics: Vertex counts, edge counts, memory usage, and other storage-related statistics
  • Build information: Memgraph version details, build type, and optimization level

This meant users who needed to monitor their Memgraph instance or gather operational metrics had to drop down to raw Cypher queries, breaking the abstraction that GQLAlchemy provides. Issues #254 and #255 tracked these missing features, both labeled as “good first issue” for community contributors.

The Solution

I implemented two new methods on the Memgraph class that wrap the native SHOW STORAGE INFO and SHOW BUILD INFO Cypher queries, providing a clean Pythonic interface:

from gqlalchemy import Memgraph

memgraph = Memgraph()

# Get storage metrics (vertex count, edge count, memory usage, etc.)
storage_info = memgraph.get_storage_info()

# Get build information (build type, optimization level)
build_info = memgraph.get_build_info()

The implementation follows GQLAlchemy’s existing patterns, using the execute_and_fetch method internally and returning results as a list of dictionaries:

def get_storage_info(self) -> List[dict]:
    """Get detailed storage information about the database instance."""
    return list(self.execute_and_fetch("SHOW STORAGE INFO;"))

def get_build_info(self) -> List[dict]:
    """Get build information about the Memgraph instance."""
    return list(self.execute_and_fetch("SHOW BUILD INFO;"))

Files Changed

FileChangesDescription
gqlalchemy/vendors/memgraph.py+25 linesAdded get_storage_info() and get_build_info() methods
tests/memgraph/test_show_info.py+47 lines (new)Unit tests with mocked database connections
docs/reference/gqlalchemy/vendors/memgraph.md+26 linesAPI documentation for both methods

Testing

The PR includes comprehensive unit tests that mock the database connection and verify:

  • Correct Cypher queries are executed
  • Results are properly returned as list of dictionaries
  • Both methods follow existing patterns in the codebase

Timeline

DateAction
June 21, 2023Issue #254 opened by katarinasupe requesting SHOW STORAGE INFO support
December 13, 2025PR #374 submitted implementing both features
December 16, 2025PR approved by antejavor and Josipmrden
December 16, 2025PR merged, closing issues #254 and #255