# MemgraphGraph

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/graphs/memgraph_graph/MemgraphGraph)

Memgraph wrapper for graph operations.

Parameters:
url (Optional[str]): The URL of the Memgraph database server.
username (Optional[str]): The username for database authentication.
password (Optional[str]): The password for database authentication.
database (str): The name of the database to connect to. Default is 'memgraph'.
refresh_schema (bool): A flag whether to refresh schema information
at initialization. Default is True.
driver_config (Dict): Configuration passed to Neo4j Driver.

*Security note*: Make sure that the database connection uses credentials
    that are narrowly-scoped to only include necessary permissions.
    Failure to do so may result in data corruption or loss, since the calling
    code may attempt commands that would result in deletion, mutation
    of data if appropriately prompted or reading sensitive data if such
    data is present in the database.
    The best way to guard against such negative outcomes is to (as appropriate)
    limit the permissions granted to the credentials used with this tool.

    See https://python.langchain.com/docs/security for more information.

## Signature

```python
MemgraphGraph(
    self,
    url: Optional[str] = None,
    username: Optional[str] = None,
    password: Optional[str] = None,
    database: Optional[str] = None,
    refresh_schema: bool = True,
    *,
    driver_config: Optional[Dict] = None,
)
```

## Extends

- `GraphStore`

## Constructors

```python
__init__(
    self,
    url: Optional[str] = None,
    username: Optional[str] = None,
    password: Optional[str] = None,
    database: Optional[str] = None,
    refresh_schema: bool = True,
    *,
    driver_config: Optional[Dict] = None,
) -> None
```

| Name | Type |
|------|------|
| `url` | `Optional[str]` |
| `username` | `Optional[str]` |
| `password` | `Optional[str]` |
| `database` | `Optional[str]` |
| `refresh_schema` | `bool` |
| `driver_config` | `Optional[Dict]` |


## Properties

- `schema`
- `structured_schema`
- `get_schema`
- `get_structured_schema`

## Methods

- [`close()`](https://reference.langchain.com/python/langchain-community/graphs/memgraph_graph/MemgraphGraph/close)
- [`query()`](https://reference.langchain.com/python/langchain-community/graphs/memgraph_graph/MemgraphGraph/query)
- [`refresh_schema()`](https://reference.langchain.com/python/langchain-community/graphs/memgraph_graph/MemgraphGraph/refresh_schema)
- [`add_graph_documents()`](https://reference.langchain.com/python/langchain-community/graphs/memgraph_graph/MemgraphGraph/add_graph_documents)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/graphs/memgraph_graph.py#L258)