Skip to content

Commit 7388503

Browse files
committed
more docs fixes
1 parent d711a8e commit 7388503

8 files changed

Lines changed: 67 additions & 19 deletions

File tree

docs/reference/gqlalchemy/models.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ def parse_obj(cls, obj)
173173
Used to convert a dictionary object into the appropriate
174174
GraphObject.
175175

176+
Compatibility note: `parse_obj` is retained for backward compatibility.
177+
For Pydantic v2-style usage, prefer `model_validate`.
178+
176179
## NodeMetaclass Objects
177180

178181
```python

docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Cypher query defining the MATCH clause which selects the nodes and relationships
7979
**Arguments**:
8080

8181
- `procedure` - A string representing the name of the procedure in the
82-
format `query_module.procedure`.
82+
format ``query_module.procedure``.
8383
- `arguments` - A string representing the arguments of the procedure in
8484
text format.
8585
- `node_labels` - Either a string, which is then used as the label for all nodes, or
@@ -92,18 +92,32 @@ Cypher query defining the MATCH clause which selects the nodes and relationships
9292

9393
**Returns**:
9494

95-
A `DeclarativeBase` instance for constructing queries.
95+
A ``DeclarativeBase`` instance for constructing queries.
9696

9797

9898
**Examples**:
9999

100-
- `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()`
101-
- `query_module.procedure`0 - `query_module.procedure`1
100+
Python:
101+
```python
102+
call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()
103+
```
104+
Cypher:
105+
```cypher
106+
MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL)
107+
WITH project(p) AS graph CALL export_util.json(graph, '/home/user')
108+
```
102109

103110
or
104111

105-
- `Python` - `query_module.procedure`3
106-
- `query_module.procedure`0 - `query_module.procedure`5
112+
Python:
113+
```python
114+
call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()
115+
```
116+
Cypher:
117+
```cypher
118+
MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph
119+
CALL export_util.json(graph, '/home/user')
120+
```
107121

108122
## ProjectPartialQuery Objects
109123

docs/reference/gqlalchemy/transformations/importing/graph_importer.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ Gets cypher queries using the underlying translator and then inserts all queries
3737
def translate_dot_file(path: str) -> None
3838
```
3939

40-
Parses a DOT file to a NetworkX graph and imports it to Memgraph.
40+
Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ``graph_type="NX"``
41+
42+
**Arguments**:
43+
44+
- ``path`` - Path to a DOT file.
4145

4246
#### translate\_dot\_data
4347

@@ -47,3 +51,7 @@ def translate_dot_data(dot_data: str) -> None
4751

4852
Parses DOT content to a NetworkX graph and imports it to Memgraph.
4953

54+
**Arguments**:
55+
56+
- ``dot_data`` - Raw DOT graph content.
57+

docs/reference/gqlalchemy/vendors/memgraph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ after significant changes to the graph structure or data.
413413

414414
**Arguments**:
415415

416-
- `labels` - Optional list of labels to delete statistics for.
416+
labels ``_Optional[List[str]]_``: Optional list of labels to delete statistics for.
417417
If None, deletes statistics for all labels.
418418

419419

gqlalchemy/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,9 @@ def model_validate(cls, obj, *args, **kwargs):
512512
def parse_obj(cls, obj):
513513
"""Used to convert a dictionary object into the appropriate
514514
GraphObject.
515+
516+
Compatibility note: `parse_obj` is retained for backward compatibility.
517+
For Pydantic v2-style usage, prefer `model_validate`.
515518
"""
516519
return cls.model_validate(obj)
517520

gqlalchemy/query_builders/memgraph_query_builder.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def call(
139139
140140
Args:
141141
procedure: A string representing the name of the procedure in the
142-
format `query_module.procedure`.
142+
format ``query_module.procedure``.
143143
arguments: A string representing the arguments of the procedure in
144144
text format.
145145
node_labels: Either a string, which is then used as the label for all nodes, or
@@ -150,18 +150,30 @@ def call(
150150
subgraph_path: Optional way to define the subgraph via a Cypher MATCH clause.
151151
152152
Returns:
153-
A `DeclarativeBase` instance for constructing queries.
153+
A ``DeclarativeBase`` instance for constructing queries.
154154
155155
Examples:
156-
Python: `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()`
157-
Cypher: `MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL)
158-
WITH project(p) AS graph CALL export_util.json(graph, '/home/user')`
156+
Python:
157+
```python
158+
call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()
159+
```
160+
Cypher:
161+
```cypher
162+
MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL)
163+
WITH project(p) AS graph CALL export_util.json(graph, '/home/user')
164+
```
159165
160166
or
161167
162-
Python: `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()`
163-
Cypher: `MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph
164-
CALL export_util.json(graph, '/home/user')`
168+
Python:
169+
```python
170+
call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()
171+
```
172+
Cypher:
173+
```cypher
174+
MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph
175+
CALL export_util.json(graph, '/home/user')
176+
```
165177
"""
166178

167179
if not (node_labels is None and relationship_types is None):

gqlalchemy/transformations/importing/graph_importer.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ def translate(self, graph) -> None:
8686
memgraph.execute(query)
8787

8888
def translate_dot_file(self, path: str) -> None:
89-
"""Parses a DOT file to a NetworkX graph and imports it to Memgraph."""
89+
"""Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ``graph_type="NX"``
90+
91+
Args:
92+
- ``path`` - Path to a DOT file.
93+
"""
9094
self._raise_if_not_nx_importer()
9195
raise_if_not_imported(dependency=pydot, dependency_name="pydot")
9296

@@ -98,7 +102,11 @@ def translate_dot_file(self, path: str) -> None:
98102
self.translate(graph)
99103

100104
def translate_dot_data(self, dot_data: str) -> None:
101-
"""Parses DOT content to a NetworkX graph and imports it to Memgraph."""
105+
"""Parses DOT content to a NetworkX graph and imports it to Memgraph.
106+
107+
Args:
108+
- ``dot_data`` - Raw DOT graph content.
109+
"""
102110
self._raise_if_not_nx_importer()
103111
raise_if_not_imported(dependency=pydot, dependency_name="pydot")
104112

gqlalchemy/vendors/memgraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def delete_graph_statistics(self, labels: Optional[List[str]] = None) -> List[di
631631
after significant changes to the graph structure or data.
632632
633633
Args:
634-
labels: Optional list of labels to delete statistics for.
634+
labels ``_Optional[List[str]]_``: Optional list of labels to delete statistics for.
635635
If None, deletes statistics for all labels.
636636
637637
Returns:

0 commit comments

Comments
 (0)