From 2025013080ae03821a905eecb9e56c7c32fa8d9d Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 23 Jun 2026 11:59:28 +0000 Subject: [PATCH 1/9] Prepare release v1.9.0 --- docs/changelog.md | 14 +++++++ docs/reference/gqlalchemy/models.md | 20 ++++++++-- .../query_builders/memgraph_query_builder.md | 20 +++++----- .../export/graph_transporter.md | 2 +- .../importing/graph_importer.md | 18 +++------ docs/reference/gqlalchemy/vendors/memgraph.md | 38 +++++++++++++++---- pyproject.toml | 2 +- 7 files changed, 79 insertions(+), 35 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index fd1eff2f..cecb19a3 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,19 @@ # Changelog +## v1.9.0 - June 23, 2026 + +### Features and improvements + + +* Fix release process (#387) +* feat: Build for Python 3.14 (#383) +* feat: Migrate to uv (#382) +* Add DOT import (#377) +* Add TensorflowGNN transformer (#353) +* Support Transport of ZonedDateTimes (#370) +* Added missing dependency for publish docs workflow (#368) + + ## v1.8.0 - June 12, 2025 ### Features and improvements diff --git a/docs/reference/gqlalchemy/models.md b/docs/reference/gqlalchemy/models.md index 3b9c7fb7..d7ffad4e 100644 --- a/docs/reference/gqlalchemy/models.md +++ b/docs/reference/gqlalchemy/models.md @@ -3,6 +3,14 @@ sidebar_label: models title: gqlalchemy.models --- +#### Field + +```python +def Field(default=..., **kwargs) +``` + +Pydantic Field wrapper that stores custom OGM metadata in json_schema_extra. + ## TriggerEventType Objects ```python @@ -146,6 +154,15 @@ Converts the GraphObject class into the appropriate subclass. This is used when deserialising a json representation of the class, or the object returned from the GraphDatabase. +#### model\_validate + +```python +@classmethod +def model_validate(cls, obj, *args, **kwargs) +``` + +Used to convert a dictionary object into the appropriate GraphObject. + #### parse\_obj ```python @@ -156,9 +173,6 @@ def parse_obj(cls, obj) Used to convert a dictionary object into the appropriate GraphObject. -Compatibility note: `parse_obj` is retained for backward compatibility. -For Pydantic v2-style usage, prefer `model_validate`. - ## NodeMetaclass Objects ```python diff --git a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md index 081b32ac..93005282 100644 --- a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md +++ b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md @@ -35,12 +35,12 @@ Load data from a CSV file by executing a Cypher query for each row. Load CSV with header: - `Python` - `load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute()` -- `Cypher` - `LOAD CSV FROM "path/to/my/file.csv" WITH HEADER AS row RETURN *;` +- `Cypher` - `http://`0 Load CSV without header: -- `Python` - `load_csv(path="path/to/my/file.csv", header=False, row="row").return_().execute()` -- `Cypher` - `LOAD CSV FROM "path/to/my/file.csv" NO HEADER AS row RETURN *;` +- `Python` - `http://`2 +- `Cypher` - `http://`4 #### call @@ -55,7 +55,7 @@ def call(procedure: str, subgraph_path: str = None) -> "DeclarativeBase" ``` -Override of base class method to support Memgraph subgraph functionality. +Override of base class method to support Memgraph's subgraph functionality. Method can be called with node labels and relationship types, both being optional, which are used to construct a subgraph, or if neither is provided, a subgraph query is used, which can be passed as a string representing a @@ -82,13 +82,15 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Examples**: -- `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` -- `Cypher` - `MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) WITH project(p) AS graph CALL export_util.json(graph, "/home/user")` +- `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() +- `Cypher`query_module.procedure`0MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) + WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` or -- `Python` - `call("export_util.json", "/home/user", subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()` -- `Cypher` - `MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph CALL export_util.json(graph, "/home/user")` +- `Python` - `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() +- `Cypher`query_module.procedure`0MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph + CALL export_util.json(graph, '/home/user')` ## ProjectPartialQuery Objects @@ -104,6 +106,6 @@ def construct_query() -> str Constructs a Project partial query. -Given path part of a query (e.g. (:LABEL)-[:TYPE]->(:LABEL2)), +Given path part of a query (e.g. (:LABEL)-[:TYPE]->(:LABEL2)), adds MATCH, a path identifier and appends the WITH clause. diff --git a/docs/reference/gqlalchemy/transformations/export/graph_transporter.md b/docs/reference/gqlalchemy/transformations/export/graph_transporter.md index 7955690d..85a7b125 100644 --- a/docs/reference/gqlalchemy/transformations/export/graph_transporter.md +++ b/docs/reference/gqlalchemy/transformations/export/graph_transporter.md @@ -33,7 +33,7 @@ graph = transporter.export() **Arguments**: -- `graph_type` - dgl, pyg or nx +- `graph_type` - dgl, pyg, nx or tfgnn #### export diff --git a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md index 0ac6b6a3..d0379e0b 100644 --- a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md +++ b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md @@ -29,29 +29,21 @@ Gets cypher queries using the underlying translator and then inserts all queries **Arguments**: -- `graph` - dgl, pytorch geometric or nx graph instance. +- `graph` - dgl, pytorch geometric, dot or nx graph instance. -#### translate_dot_file +#### translate\_dot\_file ```python def translate_dot_file(path: str) -> None ``` -Parses a DOT file into a NetworkX graph and imports it to Memgraph. This method is available when `graph_type="NX"`. +Parses a DOT file to a NetworkX graph and imports it to Memgraph. -**Arguments**: - -- `path` - Path to a DOT file. - -#### translate_dot_data +#### translate\_dot\_data ```python def translate_dot_data(dot_data: str) -> None ``` -Parses DOT content from a string into a NetworkX graph and imports it to Memgraph. This method is available when `graph_type="NX"`. - -**Arguments**: - -- `dot_data` - Raw DOT graph content. +Parses DOT content to a NetworkX graph and imports it to Memgraph. diff --git a/docs/reference/gqlalchemy/vendors/memgraph.md b/docs/reference/gqlalchemy/vendors/memgraph.md index 6af1468c..4f06a63e 100644 --- a/docs/reference/gqlalchemy/vendors/memgraph.md +++ b/docs/reference/gqlalchemy/vendors/memgraph.md @@ -340,7 +340,6 @@ Terminate transactions in the database. - `List[MemgraphTerminatedTransaction]` - A list of MemgraphTerminatedTransaction objects with info on their status. - #### get\_storage\_info ```python @@ -351,7 +350,15 @@ Get detailed storage information about the database instance. **Returns**: -- `List[dict]` - A list of dictionaries with 'storage info' and 'value' keys containing storage metrics like name, vertex_count, edge_count, memory_res, disk_usage, etc. +- `List[dict]` - A list of dictionaries with 'storage info' and 'value' keys containing: + - name: Current database name + - vertex_count: Total number of stored nodes + - edge_count: Total number of stored relationships + - average_degree: Average number of relationships per node + - memory_res: Non-swapped physical RAM memory used + - disk_usage: Data directory disk space consumption + - memory_tracked: RAM allocated and tracked by Memgraph + - and other storage-related metrics #### get\_build\_info @@ -363,7 +370,8 @@ Get build information about the Memgraph instance. **Returns**: -- `List[dict]` - A list of dictionaries with 'build info' and 'value' keys containing build_type (the optimization level). +- `List[dict]` - A list of dictionaries with 'build info' and 'value' keys containing: + - build_type: The optimization level the instance was built with #### analyze\_graph @@ -378,11 +386,19 @@ to select more optimal indexes and MERGE operations. **Arguments**: -- `labels` _Optional[List[str]]_ - Optional list of labels to analyze. If None, analyzes all labels. +- `labels` - Optional list of labels to analyze. If None, analyzes all labels. + **Returns**: -- `List[dict]` - A list of dictionaries containing analysis results with keys: label, property, num estimation nodes, num groups, avg group size, chi-squared value, avg degree. +- `List[dict]` - A list of dictionaries containing analysis results with keys: + - label: Index's label + - property: Index's property + - num estimation nodes: Nodes used for estimation + - num groups: Distinct property values + - avg group size: Average group size per value + - chi-squared value: Statistical distribution measure + - avg degree: Average degree of indexed nodes #### delete\_graph\_statistics @@ -392,12 +408,18 @@ def delete_graph_statistics(labels: Optional[List[str]] = None) -> List[dict] Delete graph statistics previously calculated by analyze_graph. +Use this to reset the analysis data if you want to recalculate statistics +after significant changes to the graph structure or data. + **Arguments**: -- `labels` _Optional[List[str]]_ - Optional list of labels to delete statistics for. If None, deletes statistics for all labels. +- `labels` - Optional list of labels to delete statistics for. + If None, deletes statistics for all labels. + **Returns**: -- `List[dict]` - A list of dictionaries containing deleted index info with keys: label, property. - +- `List[dict]` - A list of dictionaries containing deleted index info with keys: + - label: The deleted index's label + - property: The deleted index's property diff --git a/pyproject.toml b/pyproject.toml index 11eacc4d..15ef7184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "GQLAlchemy" -version = "1.8.0" +version = "1.9.0" description = "GQLAlchemy is a library developed to assist with writing and running queries in Memgraph." readme = "README.md" license = "Apache-2.0" From 378a904d86740addd14e5e66304b75c83f80553c Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 17:26:20 +0100 Subject: [PATCH 2/9] revert docs changes --- gqlalchemy/query_builders/memgraph_query_builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gqlalchemy/query_builders/memgraph_query_builder.py b/gqlalchemy/query_builders/memgraph_query_builder.py index ae6f16a9..bffbbe9b 100644 --- a/gqlalchemy/query_builders/memgraph_query_builder.py +++ b/gqlalchemy/query_builders/memgraph_query_builder.py @@ -137,13 +137,13 @@ def call( A `DeclarativeBase` instance for constructing queries. Examples: - Python: `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() + Python: `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` Cypher: `MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` or - Python: `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() + Python: `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()` Cypher: `MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` """ From a9d56ea63164796ef4832c3478574c7f19a3e69a Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 17:30:57 +0100 Subject: [PATCH 3/9] =?UTF-8?q?rebuild=20docs=C2=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../query_builders/memgraph_query_builder.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md index 93005282..50f14dd7 100644 --- a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md +++ b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md @@ -82,15 +82,13 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Examples**: -- `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() -- `Cypher`query_module.procedure`0MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) - WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` +- `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` +- `query_module.procedure`0 - `query_module.procedure`1 or -- `Python` - `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() -- `Cypher`query_module.procedure`0MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph - CALL export_util.json(graph, '/home/user')` +- `Python` - `query_module.procedure`3 +- `query_module.procedure`0 - `query_module.procedure`5 ## ProjectPartialQuery Objects From eb424de5052a447eb80609f73dd0a09b505b5a8b Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 17:34:42 +0100 Subject: [PATCH 4/9] disable html escape in docstrings --- pydoc-markdown.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pydoc-markdown.yml b/pydoc-markdown.yml index eb5eb215..cd7f15ed 100644 --- a/pydoc-markdown.yml +++ b/pydoc-markdown.yml @@ -2,9 +2,9 @@ loaders: - type: python search_path: [.] modules: - - gqlalchemy.connection + - gqlalchemy.connection - gqlalchemy.disk_storage - - gqlalchemy.exceptions + - gqlalchemy.exceptions - gqlalchemy.instance_runner - gqlalchemy.models - gqlalchemy.utilities @@ -39,3 +39,5 @@ renderer: relative_output_path: reference relative_sidebar_path: sidebar.json sidebar_top_level_label: 'Reference' + markdown: + escape_html_in_docstring: false From a895b515211c39c9db010e037b47c2732019c139 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 17:35:07 +0100 Subject: [PATCH 5/9] rebuild --- .../graph_algorithms/integrated_algorithms.md | 38 ++++++------ .../graph_algorithms/query_builder.md | 6 +- .../graph_algorithms/query_modules.md | 10 ++-- docs/reference/gqlalchemy/instance_runner.md | 6 +- docs/reference/gqlalchemy/models.md | 10 ++-- .../query_builders/declarative_base.md | 58 +++++++++---------- .../query_builders/memgraph_query_builder.md | 18 +++--- .../export/graph_transporter.md | 4 +- .../importing/graph_importer.md | 2 +- .../transformations/importing/loaders.md | 12 ++-- .../translators/dgl_translator.md | 14 ++--- .../translators/nx_translator.md | 2 +- .../translators/pyg_translator.md | 14 ++--- .../transformations/translators/translator.md | 4 +- .../gqlalchemy/vendors/database_client.md | 6 +- docs/reference/gqlalchemy/vendors/memgraph.md | 18 +++--- docs/reference/gqlalchemy/vendors/neo4j.md | 6 +- 17 files changed, 115 insertions(+), 113 deletions(-) diff --git a/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md b/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md index 7482c8b3..07cec31c 100644 --- a/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md +++ b/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md @@ -9,13 +9,13 @@ title: gqlalchemy.graph_algorithms.integrated_algorithms class IntegratedAlgorithm(ABC) ``` -Abstract class modeling Memgraph's built-in graph algorithms. +Abstract class modeling Memgraph's built-in graph algorithms. -These algorithms are integrated into Memgraph's codebase and are called +These algorithms are integrated into Memgraph's codebase and are called within a relationship part of a query. For instance: -MATCH p = (:City {name: "Paris"}) - -[:Road * bfs (r, n | r.length <= 200 AND n.name != "Metz")]-> - (:City {name: "Berlin"}) +MATCH p = (:City {name: "Paris"}) + -[:Road * bfs (r, n | r.length <= 200 AND n.name != "Metz")]-> + (:City {name: "Berlin"}) #### \_\_str\_\_ @@ -38,9 +38,9 @@ Method for creating a general lambda expression. Variables `r` and `n` stand for relationship and node. The expression is used e.g. for a filter lambda, to use only relationships of length less than 200: -expression="r.length < 200" +expression="r.length < 200" with the filter lambda being: -(r, n | r.length < 200) +(r, n | r.length < 200) **Arguments**: @@ -100,10 +100,10 @@ class DepthFirstSearch(IntegratedAlgorithm) Build a DFS call for a Cypher query. The Depth-First Search can be called in Memgraph with Cypher queries such as: -MATCH (a {id: 723})-[* ..10 (r, n | r.x > 12 AND n.y < 3)]-() RETURN *; -It is called inside the relationship clause, "*" naming the algorithm -("*" without "DFS" because it is defined like such in openCypher), -"..10" specifying depth bounds, and "(r, n | <expression>)" is a filter +MATCH (a {id: 723})-[* ..10 (r, n | r.x > 12 AND n.y < 3)]-() RETURN *; +It is called inside the relationship clause, "*" naming the algorithm +("*" without "DFS" because it is defined like such in openCypher), +"..10" specifying depth bounds, and "(r, n | )" is a filter lambda. #### \_\_init\_\_ @@ -147,10 +147,10 @@ Build a Dijkstra shortest path call for a Cypher query. The weighted shortest path algorithm can be called in Memgraph with Cypher queries such as: -" MATCH (a {id: 723})-[r *WSHORTEST 10 (r, n | r.weight) weight_sum - (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " -It is called inside the relationship clause, "*WSHORTEST" naming the -algorithm, "10" specifying search depth bounds, and "(r, n | <expression>)" +" MATCH (a {id: 723})-[r *WSHORTEST 10 (r, n | r.weight) weight_sum + (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " +It is called inside the relationship clause, "*WSHORTEST" naming the +algorithm, "10" specifying search depth bounds, and "(r, n | )" is a filter lambda, used to filter which relationships and nodes to use. #### \_\_init\_\_ @@ -181,10 +181,10 @@ Build a Dijkstra shortest path call for a Cypher query. The weighted shortest path algorithm can be called in Memgraph with Cypher queries such as: -" MATCH (a {id: 723})-[r *ALLSHORTEST 10 (r, n | r.weight) total_weight - (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " -It is called inside the relationship clause, "*ALLSHORTEST" naming the -algorithm, "10" specifying search depth bounds, and "(r, n | <expression>)" +" MATCH (a {id: 723})-[r *ALLSHORTEST 10 (r, n | r.weight) total_weight + (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " +It is called inside the relationship clause, "*ALLSHORTEST" naming the +algorithm, "10" specifying search depth bounds, and "(r, n | )" is a filter lambda, used to filter which relationships and nodes to use. #### \_\_init\_\_ diff --git a/docs/reference/gqlalchemy/graph_algorithms/query_builder.md b/docs/reference/gqlalchemy/graph_algorithms/query_builder.md index 4a668b6e..43cc16ae 100644 --- a/docs/reference/gqlalchemy/graph_algorithms/query_builder.md +++ b/docs/reference/gqlalchemy/graph_algorithms/query_builder.md @@ -9,9 +9,9 @@ title: gqlalchemy.graph_algorithms.query_builder class MemgraphQueryBuilder(QueryBuilder) ``` -This query builder extends the usual Cypher query builder capabilities with Memgraph's query modules. +This query builder extends the usual Cypher query builder capabilities with Memgraph's query modules. User gets with this module autocomplete features of graph algorithms. -Documentation on the methods can be found on Memgraph's web page. +Documentation on the methods can be found on Memgraph's web page. ## MageQueryBuilder Objects @@ -21,5 +21,5 @@ class MageQueryBuilder(MemgraphQueryBuilder) This query builder extends the Memgraph query builder with Memgraph MAGE graph algorithm Cypher options. User gets with this module autocomplete features of graph algorithms written in MAGE library. -Documentation on the methods can be found on Memgraph's web page. +Documentation on the methods can be found on Memgraph's web page. diff --git a/docs/reference/gqlalchemy/graph_algorithms/query_modules.md b/docs/reference/gqlalchemy/graph_algorithms/query_modules.md index 14d4521c..80e4917c 100644 --- a/docs/reference/gqlalchemy/graph_algorithms/query_modules.md +++ b/docs/reference/gqlalchemy/graph_algorithms/query_modules.md @@ -32,7 +32,7 @@ Named arguments in self.arguments. def get_arguments_for_call() -> str ``` -return inputs in form "value1, value2, ..." for QueryBuilder call() +return inputs in form "value1, value2, ..." for QueryBuilder call() method. **Raises**: @@ -54,12 +54,12 @@ One list is for arguments and another for returns. For instance, if a query module signature is: dummy_module.dummy(lst :: LIST OF STRING, num = 3 :: NUMBER) :: (ret :: STRING) the method should return a list of arguments: -[{"name": "lst", "type": "LIST OF STRING"}, {"name": "num", "type": "NUMBER", "default": 3}] +[{"name": "lst", "type": "LIST OF STRING"}, {"name": "num", "type": "NUMBER", "default": 3}] and a list of returns: -[{"name": "ret", "type": "STRING"}] +[{"name": "ret", "type": "STRING"}] -Dictionary consists of fields: "name" - argument name, "type" - data -type of argument and "default" where default argument value is given +Dictionary consists of fields: "name" - argument name, "type" - data +type of argument and "default" where default argument value is given **Arguments**: diff --git a/docs/reference/gqlalchemy/instance_runner.md b/docs/reference/gqlalchemy/instance_runner.md index 08e32b57..7c231c5d 100644 --- a/docs/reference/gqlalchemy/instance_runner.md +++ b/docs/reference/gqlalchemy/instance_runner.md @@ -50,7 +50,7 @@ Wait for a Docker container to enter the status `running`. **Raises**: -- `TimeoutError` - Raises an error when the container isn't running after the +- `TimeoutError` - Raises an error when the container isn't running after the timeout period has passed. ## MemgraphInstance Objects @@ -71,7 +71,7 @@ connection object. **Attributes**: - `restart` - A bool indicating if the instance should be - restarted if it's already running. + restarted if it's already running. #### start @@ -84,7 +84,7 @@ Start the Memgraph instance. **Attributes**: - `restart` - A bool indicating if the instance should be - restarted if it's already running. + restarted if it's already running. #### stop diff --git a/docs/reference/gqlalchemy/models.md b/docs/reference/gqlalchemy/models.md index d7ffad4e..b7a59cdd 100644 --- a/docs/reference/gqlalchemy/models.md +++ b/docs/reference/gqlalchemy/models.md @@ -27,8 +27,8 @@ class TriggerEventObject() An enum representing types of trigger objects. -NODE -> `()` -RELATIONSHIP -> `-->` +NODE -> `()` +RELATIONSHIP -> `-->` ## TriggerExecutionPhase Objects @@ -211,9 +211,9 @@ def save(db: "Database") -> "Node" Saves node to Memgraph. If the node._id is not None it fetches the node with the same id from -Memgraph and updates it's fields. +Memgraph and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from Memgraph and updates it's fields. +fields from Memgraph and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -281,7 +281,7 @@ def save(db: "Database") -> "Relationship" Saves a relationship to Memgraph. If relationship._id is not None it finds the relationship in Memgraph -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. diff --git a/docs/reference/gqlalchemy/query_builders/declarative_base.md b/docs/reference/gqlalchemy/query_builders/declarative_base.md index d237bc1b..b55dfcab 100644 --- a/docs/reference/gqlalchemy/query_builders/declarative_base.md +++ b/docs/reference/gqlalchemy/query_builders/declarative_base.md @@ -306,7 +306,7 @@ Call a query module procedure. Call procedure with arguments: -- `Python` - `call('json_util.load_from_url', "'https://some-url.com'").yield_('objects').return_(results='objects').execute() +- `Python` - `call('json_util.load_from_url', "'https://some-url.com'").yield_('objects').return_(results='objects').execute() - `Cypher` - `CALL json_util.load_from_url(https://some-url.com) YIELD objects RETURN objects;` #### node @@ -376,7 +376,7 @@ Add a relationship pattern to the query. Match and return a relationship: - `Python` - `match().node(labels='Town', variable='t').to(relationship_type='BELONGS_TO', variable='b').node(labels='Country', variable='c').return_(results='b').execute()` -- `directed`0 - `directed`1 +- `Cypher` - `MATCH (t:Town)-[b:BELONGS_TO]->(c:Country) RETURN b;` #### from\_ @@ -411,7 +411,7 @@ Add a relationship pattern to the query. Match and return a relationship: - `Python` - `match().node(labels='Country', variable='c').from_(relationship_type='BELONGS_TO', variable='b').node(labels='Town', variable='t').return_(results='b').execute()` -- `Cypher` - `directed`0 +- `Cypher` - `MATCH (c:Country)<-[b:BELONGS_TO]-(t:Town) RETURN b;` #### where @@ -428,7 +428,7 @@ Creates a WHERE statement Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Raises**: @@ -447,17 +447,17 @@ Creates a WHERE statement Cypher partial query. Filtering query results by the equality of `name` properties of two connected nodes. - `Python` - `match().node(variable='n').to().node(variable='m').where(item='n.name', operator=Operator.EQUAL, expression='m.name').return_()` -- `operator`0 - `operator`1 +- `Cypher` - `MATCH (n)-[]->(m) WHERE n.name = m.name RETURN *;` Filtering query results by the node label. -- `Python` - `operator`3 -- `operator`0 - `operator`5 +- `Python` - `match().node(variable='n').where(item='n', operator=Operator.LABEL_FILTER, expression='User').return_()` +- `Cypher` - `MATCH (n) WHERE n:User RETURN *;` Filtering query results by the comparison of node property and literal. -- `Python` - `operator`7 -- `operator`0 - `operator`9 +- `Python` - `match().node(variable='n').where(item='n.age', operator=Operator.GREATER_THAN, literal=18).return_()` +- `Cypher` - `MATCH (n) WHERE n.age > 18 RETURN *;` #### where\_not @@ -474,7 +474,7 @@ Creates a WHERE NOT statement Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Raises**: @@ -493,7 +493,7 @@ Creates a WHERE NOT statement Cypher partial query. Filtering query results by the equality of `name` properties of two connected nodes. - `Python` - `match().node(variable='n').to().node(variable='m').where_not(item='n.name', operator='=', expression='m.name').return_()` -- `operator`0 - `operator`1 +- `Cypher` - `MATCH (n)-[]->(m) WHERE NOT n.name = m.name RETURN *;` #### and\_where @@ -510,7 +510,7 @@ Creates an AND statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -541,7 +541,7 @@ Creates an AND NOT statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -571,7 +571,7 @@ Creates an OR statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -601,7 +601,7 @@ Creates an OR NOT statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -631,7 +631,7 @@ Creates an XOR statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -662,7 +662,7 @@ Creates an XOR NOT statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -870,7 +870,7 @@ Yield data from the query. Yield some data from a query: - `Python` - `.call(procedure='pagerank.get').yield_(results=['node', 'rank']).return_(results=['node','rank']).execute()` -- `Cypher` - `GQLAlchemyResultQueryTypeError`1 +- `Cypher` - `CALL pagerank.get() YIELD node, rank RETURN node, rank;` #### return\_ @@ -914,7 +914,7 @@ Return data from the query. Return specific variables from a query: - `Python` - `match().node(labels='Person', variable='p1').to().node(labels='Person', variable='p2').return_(results=[('p1','first'), 'p2']).execute()` -- `Cypher` - `GQLAlchemyResultQueryTypeError`1 +- `Cypher` - `MATCH (p1:Person)-[]->(p2:Person) RETURN p1 AS first, p2;` #### order\_by @@ -1084,7 +1084,7 @@ Creates a SET statement Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Raises**: @@ -1103,27 +1103,27 @@ Creates a SET statement Cypher partial query. Set or update a property. - `Python` - `match().node(variable='n').where(item='n.name', operator=Operator.EQUAL, literal='Germany').set_(item='n.population', operator=Operator.ASSIGNMENT, literal=83000001).return_().execute()` -- `Cypher` - `operator`0 +- `Cypher` - `MATCH (n) WHERE n.name = 'Germany' SET n.population = 83000001 RETURN *;` Set or update multiple properties. -- `Python` - `operator`2 -- `Cypher` - `operator`4 +- `Python` - `match().node(variable='n').where(item='n.name', operator=Operator.EQUAL, literal='Germany').set_(item='n.population', operator=Operator.ASSIGNMENT, literal=83000001).set_(item='n.capital', operator=Operator.ASSIGNMENT, literal='Berlin').return_().execute()` +- `Cypher` - `MATCH (n) WHERE n.name = 'Germany' SET n.population = 83000001 SET n.capital = 'Berlin' RETURN *;` Set node label. -- `Python` - `operator`6 -- `Cypher` - `operator`8 +- `Python` - `match().node(variable='n').where(item='n.name', operator=Operator.EQUAL, literal='Germany').set_(item='n', operator=Operator.LABEL_FILTER, expression='Land').return_().execute()` +- `Cypher` - `MATCH (n) WHERE n.name = 'Germany' SET n:Land RETURN *;` Replace all properties using map. -- `Python` - `literal`0 -- `Cypher` - `literal`2 +- `Python` - `match().node(variable='c', labels='Country').where(item='c.name', operator=Operator.EQUAL, literal='Germany').set_(item='c', operator=Operator.ASSIGNMENT, literal={'name': 'Germany', 'population': '85000000'}).return_().execute()` +- `Cypher` - `MATCH (c:Country) WHERE c.name = 'Germany' SET c = {name: 'Germany', population: '85000000'} RETURN *;` Update all properties using map. -- `Python` - `literal`4 -- `Cypher` - `literal`6 +- `Python` - `match().node(variable='c', labels='Country').where(item='c.name', operator=Operator.EQUAL, literal='Germany').set_(item='c', operator=Operator.INCREMENT, literal={'name': 'Germany', 'population': '85000000'}).return_().execute()` +- `Cypher` - `MATCH (c:Country) WHERE c.name = 'Germany' SET c += {name: 'Germany', population: '85000000'} RETURN *;` #### execute diff --git a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md index 50f14dd7..4f4b2d76 100644 --- a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md +++ b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md @@ -35,12 +35,12 @@ Load data from a CSV file by executing a Cypher query for each row. Load CSV with header: - `Python` - `load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute()` -- `Cypher` - `http://`0 +- `Cypher` - `LOAD CSV FROM 'path/to/my/file.csv' WITH HEADER AS row RETURN *;` Load CSV without header: -- `Python` - `http://`2 -- `Cypher` - `http://`4 +- `Python` - `load_csv(path='path/to/my/file.csv', header=False, row='row').return_().execute()` +- `Cypher` - `LOAD CSV FROM 'path/to/my/file.csv' NO HEADER AS row RETURN *;` #### call @@ -55,7 +55,7 @@ def call(procedure: str, subgraph_path: str = None) -> "DeclarativeBase" ``` -Override of base class method to support Memgraph's subgraph functionality. +Override of base class method to support Memgraph's subgraph functionality. Method can be called with node labels and relationship types, both being optional, which are used to construct a subgraph, or if neither is provided, a subgraph query is used, which can be passed as a string representing a @@ -83,12 +83,14 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Examples**: - `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` -- `query_module.procedure`0 - `query_module.procedure`1 +- `Cypher` - `MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) + WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` or -- `Python` - `query_module.procedure`3 -- `query_module.procedure`0 - `query_module.procedure`5 +- `Python` - `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()` +- `Cypher` - `MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph + CALL export_util.json(graph, '/home/user')` ## ProjectPartialQuery Objects @@ -104,6 +106,6 @@ def construct_query() -> str Constructs a Project partial query. -Given path part of a query (e.g. (:LABEL)-[:TYPE]->(:LABEL2)), +Given path part of a query (e.g. (:LABEL)-[:TYPE]->(:LABEL2)), adds MATCH, a path identifier and appends the WITH clause. diff --git a/docs/reference/gqlalchemy/transformations/export/graph_transporter.md b/docs/reference/gqlalchemy/transformations/export/graph_transporter.md index 85a7b125..f2ad2192 100644 --- a/docs/reference/gqlalchemy/transformations/export/graph_transporter.md +++ b/docs/reference/gqlalchemy/transformations/export/graph_transporter.md @@ -10,7 +10,7 @@ class GraphTransporter(Transporter) ``` Here is a possible example for using this module: ->>> transporter = GraphTransporter("dgl") +>>> transporter = GraphTransporter("dgl") graph = transporter.export() #### \_\_init\_\_ @@ -28,7 +28,7 @@ def __init__(graph_type: str, Initializes GraphTransporter. It is used for converting Memgraph graph to the specific graph type offered by some Python package (PyG, DGL, NX...) Here is a possible example for using this module: ->>> transporter = GraphTransporter("dgl") +>>> transporter = GraphTransporter("dgl") graph = transporter.export() **Arguments**: diff --git a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md index d0379e0b..3d7cdc31 100644 --- a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md +++ b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md @@ -11,7 +11,7 @@ class GraphImporter(Importer) Imports dgl, pyg or networkx graph representations to Memgraph. The following code will suffice for importing queries. ->>> importer = GraphImporter("dgl") +>>> importer = GraphImporter("dgl") graph = DGLGraph(...) importer.translate(graph) # queries are inserted in this step diff --git a/docs/reference/gqlalchemy/transformations/importing/loaders.md b/docs/reference/gqlalchemy/transformations/importing/loaders.md index 8aaab696..63a7dbfc 100644 --- a/docs/reference/gqlalchemy/transformations/importing/loaders.md +++ b/docs/reference/gqlalchemy/transformations/importing/loaders.md @@ -77,7 +77,7 @@ Class that contains new label name and all of the column name mappings for a sin **Attributes**: - `label` - New label (Optional). -- `column_names_mapping` - Dictionary containing key-value pairs in form ("column name", "property name") (Optional). +- `column_names_mapping` - Dictionary containing key-value pairs in form ("column name", "property name") (Optional). ## NameMapper Objects @@ -162,7 +162,7 @@ Initializes connection and data bucket. **Raises**: -- `KeyError` - kwargs doesn't contain necessary fields. +- `KeyError` - kwargs doesn't contain necessary fields. #### get\_path @@ -204,7 +204,7 @@ Initializes connection and data container. **Raises**: -- `KeyError` - kwargs doesn't contain necessary fields. +- `KeyError` - kwargs doesn't contain necessary fields. #### get\_path @@ -305,8 +305,8 @@ class PyArrowDataLoader(DataLoader) Loads data using PyArrow. -PyArrow currently supports "parquet", "ipc"/"arrow"/"feather", "csv", -and "orc", see pyarrow.dataset.dataset for up-to-date info. +PyArrow currently supports "parquet", "ipc"/"arrow"/"feather", "csv", +and "orc", see pyarrow.dataset.dataset for up-to-date info. ds.dataset in load_data accepts any fsspec subclass, making this DataLoader compatible with fsspec-compatible filesystems. @@ -399,7 +399,7 @@ def __init__(file_system_handler: str, **Raises**: -- `ValueError` - PyArrow doesn't support ORC on Windows. +- `ValueError` - PyArrow doesn't support ORC on Windows. ## PyArrowS3Importer Objects diff --git a/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md b/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md index 0c7a2fc1..a3323abc 100644 --- a/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md @@ -23,11 +23,11 @@ same name must have the same dimensionality and data type. def to_cypher_queries(graph: Union[dgl.DGLGraph, dgl.DGLHeteroGraph]) ``` -Produce cypher queries for data saved as part of the DGL graph. The method handles both homogeneous and heterogeneous graph. If the graph is homogeneous, a default DGL's labels will be used. -_N as a node label and _E as edge label. The method converts 1D as well as multidimensional features. If there are some isolated nodes inside DGL graph, they won't get transferred. Nodes and edges -created in Memgraph DB will, for the consistency reasons, have property `dgl_id` set to the id they have as part of the DGL graph. Note that this method doesn't insert anything inside the database, +Produce cypher queries for data saved as part of the DGL graph. The method handles both homogeneous and heterogeneous graph. If the graph is homogeneous, a default DGL's labels will be used. +_N as a node label and _E as edge label. The method converts 1D as well as multidimensional features. If there are some isolated nodes inside DGL graph, they won't get transferred. Nodes and edges +created in Memgraph DB will, for the consistency reasons, have property `dgl_id` set to the id they have as part of the DGL graph. Note that this method doesn't insert anything inside the database, it just creates cypher queries. To insert queries the following code can be used: ->>> memgraph = Memgraph() +>>> memgraph = Memgraph() dgl_graph = DGLGraph(...) for query in DGLTranslator().to_cypher_queries(dgl_graph): memgraph.execute(query) @@ -46,9 +46,9 @@ memgraph.execute(query) def get_instance() -> dgl.DGLHeteroGraph ``` -Create instance of DGL graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features -that are set on all nodes or all edges are transferred to the DGL instance since this is DGL's requirement. That means that any string values properties won't be transferred, as well as numerical properties -that aren't set on all nodes. However, features of type list are transferred to the DGL and can be used as any other feature in the DGL graph. Regardless of data residing inside Memgraph database, the created +Create instance of DGL graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features +that are set on all nodes or all edges are transferred to the DGL instance since this is DGL's requirement. That means that any string values properties won't be transferred, as well as numerical properties +that aren't set on all nodes. However, features of type list are transferred to the DGL and can be used as any other feature in the DGL graph. Regardless of data residing inside Memgraph database, the created DGL graph is a heterograph instance. **Returns**: diff --git a/docs/reference/gqlalchemy/transformations/translators/nx_translator.md b/docs/reference/gqlalchemy/transformations/translators/nx_translator.md index 6c4afc06..28045ee7 100644 --- a/docs/reference/gqlalchemy/transformations/translators/nx_translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/nx_translator.md @@ -59,6 +59,6 @@ Generates Cypher queries and inserts data into Memgraph in parallel. def get_instance() ``` -Creates NetworkX instance of the graph from the data residing inside Memgraph. Since NetworkX doesn't support labels in a way Memgraph does, labels +Creates NetworkX instance of the graph from the data residing inside Memgraph. Since NetworkX doesn't support labels in a way Memgraph does, labels are encoded as a node and edge properties. diff --git a/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md b/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md index 78b82c5d..f4286f99 100644 --- a/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md @@ -31,7 +31,7 @@ Extracts node properties from heterogeneous graph based on the node_label. def extract_node_edge_properties_from_homogeneous_graph(cls, graph) ``` -Homogenous graph don't have node and etype properties so it is hard to extract node and edge attributes. +Homogenous graph don't have node and etype properties so it is hard to extract node and edge attributes. **Arguments**: @@ -48,10 +48,10 @@ def to_cypher_queries(graph) ``` Produce cypher queries for data saved as part of thePyG graph. The method handles both homogeneous and heterogeneous graph. -The method converts 1D as well as multidimensional features. If there are some isolated nodes inside the graph, they won't get transferred. Nodes and edges -created in Memgraph DB will, for the consistency reasons, have property `pyg_id` set to the id they have as part of the PyG graph. Note that this method doesn't insert anything inside +The method converts 1D as well as multidimensional features. If there are some isolated nodes inside the graph, they won't get transferred. Nodes and edges +created in Memgraph DB will, for the consistency reasons, have property `pyg_id` set to the id they have as part of the PyG graph. Note that this method doesn't insert anything inside the database, it just creates cypher queries. To insert queries the following code can be used: ->>> memgraph = Memgraph() +>>> memgraph = Memgraph() pyg_graph = HeteroData(...) for query in PyGTranslator().to_cypher_queries(pyg_graph): memgraph.execute(query) @@ -70,9 +70,9 @@ memgraph.execute(query) def get_instance() ``` -Create instance of PyG graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features -that are set on all nodes or all edges are transferred to the PyG instance since this is PyG's requirement. That means that any string values properties won't be transferred, as well as numerical properties -that aren't set on all nodes. However, features that are of type list are transferred to the PyG instance and can be used as any other feature in the PyG graph. Regardless of data residing inside Memgraph database, the created +Create instance of PyG graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features +that are set on all nodes or all edges are transferred to the PyG instance since this is PyG's requirement. That means that any string values properties won't be transferred, as well as numerical properties +that aren't set on all nodes. However, features that are of type list are transferred to the PyG instance and can be used as any other feature in the PyG graph. Regardless of data residing inside Memgraph database, the created PyG graph is a heterograph instance. **Returns**: diff --git a/docs/reference/gqlalchemy/transformations/translators/translator.md b/docs/reference/gqlalchemy/transformations/translators/translator.md index 233a530e..abeea720 100644 --- a/docs/reference/gqlalchemy/transformations/translators/translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/translator.md @@ -16,7 +16,7 @@ class Translator(ABC) def to_cypher_queries(graph) ``` -Abstract method which doesn't know how to produce cypher queries for a specific graph type and thus needs to be overridden. +Abstract method which doesn't know how to produce cypher queries for a specific graph type and thus needs to be overridden. **Arguments**: @@ -34,7 +34,7 @@ Abstract method which doesn't know how to produce cypher queries for a spec def get_instance() ``` -Abstract method which doesn't know how to create the concrete instance so it needs to be overridden. +Abstract method which doesn't know how to create the concrete instance so it needs to be overridden. **Raises**: diff --git a/docs/reference/gqlalchemy/vendors/database_client.md b/docs/reference/gqlalchemy/vendors/database_client.md index 88eefa92..8f2decb9 100644 --- a/docs/reference/gqlalchemy/vendors/database_client.md +++ b/docs/reference/gqlalchemy/vendors/database_client.md @@ -152,9 +152,9 @@ def save_node(node: Node) -> Node Saves node to database. If the node._id is not None, it fetches the node with the same id from -the database and updates it's fields. +the database and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from the database and updates it's fields. +fields from the database and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -250,7 +250,7 @@ def save_relationship(relationship: Relationship) -> Optional[Relationship] Saves a relationship to the database. If relationship._id is not None it finds the relationship in the database -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. diff --git a/docs/reference/gqlalchemy/vendors/memgraph.md b/docs/reference/gqlalchemy/vendors/memgraph.md index 4f06a63e..fb658782 100644 --- a/docs/reference/gqlalchemy/vendors/memgraph.md +++ b/docs/reference/gqlalchemy/vendors/memgraph.md @@ -181,9 +181,9 @@ def save_node(node: Node) -> Node Saves node to the database. If the node._id is not None it fetches the node with the same id from -the database and updates it's fields. +the database and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from the database and updates it's fields. +fields from the database and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -225,7 +225,7 @@ def save_relationship(relationship: Relationship) -> Optional[Relationship] Saves a relationship to the database. If relationship._id is not None it finds the relationship in the database -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. @@ -350,7 +350,7 @@ Get detailed storage information about the database instance. **Returns**: -- `List[dict]` - A list of dictionaries with 'storage info' and 'value' keys containing: +- `List[dict]` - A list of dictionaries with 'storage info' and 'value' keys containing: - name: Current database name - vertex_count: Total number of stored nodes - edge_count: Total number of stored relationships @@ -370,7 +370,7 @@ Get build information about the Memgraph instance. **Returns**: -- `List[dict]` - A list of dictionaries with 'build info' and 'value' keys containing: +- `List[dict]` - A list of dictionaries with 'build info' and 'value' keys containing: - build_type: The optimization level the instance was built with #### analyze\_graph @@ -392,8 +392,8 @@ to select more optimal indexes and MERGE operations. **Returns**: - `List[dict]` - A list of dictionaries containing analysis results with keys: - - label: Index's label - - property: Index's property + - label: Index's label + - property: Index's property - num estimation nodes: Nodes used for estimation - num groups: Distinct property values - avg group size: Average group size per value @@ -420,6 +420,6 @@ after significant changes to the graph structure or data. **Returns**: - `List[dict]` - A list of dictionaries containing deleted index info with keys: - - label: The deleted index's label - - property: The deleted index's property + - label: The deleted index's label + - property: The deleted index's property diff --git a/docs/reference/gqlalchemy/vendors/neo4j.md b/docs/reference/gqlalchemy/vendors/neo4j.md index 5a016c9d..b90102ad 100644 --- a/docs/reference/gqlalchemy/vendors/neo4j.md +++ b/docs/reference/gqlalchemy/vendors/neo4j.md @@ -66,9 +66,9 @@ def save_node(node: Node) -> Node Saves node to the database. If the node._id is not None it fetches the node with the same id from -the database and updates it's fields. +the database and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from the database and updates it's fields. +fields from the database and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -110,7 +110,7 @@ def save_relationship(relationship: Relationship) -> Optional[Relationship] Saves a relationship to the database. If relationship._id is not None it finds the relationship in the database -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. From d711a8e80cd85f15f6433c7fef9f8e4503a57f27 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 22:06:36 +0100 Subject: [PATCH 6/9] fix docs issue --- .../graph_algorithms/integrated_algorithms.md | 38 ++++++------ .../graph_algorithms/query_builder.md | 6 +- .../graph_algorithms/query_modules.md | 10 ++-- docs/reference/gqlalchemy/instance_runner.md | 6 +- docs/reference/gqlalchemy/models.md | 10 ++-- .../query_builders/declarative_base.md | 58 +++++++++---------- .../query_builders/memgraph_query_builder.md | 37 ++++++++---- .../export/graph_transporter.md | 4 +- .../importing/graph_importer.md | 2 +- .../transformations/importing/loaders.md | 12 ++-- .../translators/dgl_translator.md | 14 ++--- .../translators/nx_translator.md | 2 +- .../translators/pyg_translator.md | 14 ++--- .../transformations/translators/translator.md | 4 +- .../gqlalchemy/vendors/database_client.md | 6 +- docs/reference/gqlalchemy/vendors/memgraph.md | 18 +++--- docs/reference/gqlalchemy/vendors/neo4j.md | 6 +- .../query_builders/memgraph_query_builder.py | 26 +++++++-- pydoc-markdown.yml | 2 +- 19 files changed, 152 insertions(+), 123 deletions(-) diff --git a/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md b/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md index 07cec31c..7482c8b3 100644 --- a/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md +++ b/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md @@ -9,13 +9,13 @@ title: gqlalchemy.graph_algorithms.integrated_algorithms class IntegratedAlgorithm(ABC) ``` -Abstract class modeling Memgraph's built-in graph algorithms. +Abstract class modeling Memgraph's built-in graph algorithms. -These algorithms are integrated into Memgraph's codebase and are called +These algorithms are integrated into Memgraph's codebase and are called within a relationship part of a query. For instance: -MATCH p = (:City {name: "Paris"}) - -[:Road * bfs (r, n | r.length <= 200 AND n.name != "Metz")]-> - (:City {name: "Berlin"}) +MATCH p = (:City {name: "Paris"}) + -[:Road * bfs (r, n | r.length <= 200 AND n.name != "Metz")]-> + (:City {name: "Berlin"}) #### \_\_str\_\_ @@ -38,9 +38,9 @@ Method for creating a general lambda expression. Variables `r` and `n` stand for relationship and node. The expression is used e.g. for a filter lambda, to use only relationships of length less than 200: -expression="r.length < 200" +expression="r.length < 200" with the filter lambda being: -(r, n | r.length < 200) +(r, n | r.length < 200) **Arguments**: @@ -100,10 +100,10 @@ class DepthFirstSearch(IntegratedAlgorithm) Build a DFS call for a Cypher query. The Depth-First Search can be called in Memgraph with Cypher queries such as: -MATCH (a {id: 723})-[* ..10 (r, n | r.x > 12 AND n.y < 3)]-() RETURN *; -It is called inside the relationship clause, "*" naming the algorithm -("*" without "DFS" because it is defined like such in openCypher), -"..10" specifying depth bounds, and "(r, n | )" is a filter +MATCH (a {id: 723})-[* ..10 (r, n | r.x > 12 AND n.y < 3)]-() RETURN *; +It is called inside the relationship clause, "*" naming the algorithm +("*" without "DFS" because it is defined like such in openCypher), +"..10" specifying depth bounds, and "(r, n | <expression>)" is a filter lambda. #### \_\_init\_\_ @@ -147,10 +147,10 @@ Build a Dijkstra shortest path call for a Cypher query. The weighted shortest path algorithm can be called in Memgraph with Cypher queries such as: -" MATCH (a {id: 723})-[r *WSHORTEST 10 (r, n | r.weight) weight_sum - (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " -It is called inside the relationship clause, "*WSHORTEST" naming the -algorithm, "10" specifying search depth bounds, and "(r, n | )" +" MATCH (a {id: 723})-[r *WSHORTEST 10 (r, n | r.weight) weight_sum + (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " +It is called inside the relationship clause, "*WSHORTEST" naming the +algorithm, "10" specifying search depth bounds, and "(r, n | <expression>)" is a filter lambda, used to filter which relationships and nodes to use. #### \_\_init\_\_ @@ -181,10 +181,10 @@ Build a Dijkstra shortest path call for a Cypher query. The weighted shortest path algorithm can be called in Memgraph with Cypher queries such as: -" MATCH (a {id: 723})-[r *ALLSHORTEST 10 (r, n | r.weight) total_weight - (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " -It is called inside the relationship clause, "*ALLSHORTEST" naming the -algorithm, "10" specifying search depth bounds, and "(r, n | )" +" MATCH (a {id: 723})-[r *ALLSHORTEST 10 (r, n | r.weight) total_weight + (r, n | r.x > 12 AND r.y < 3)]-(b {id: 882}) RETURN * " +It is called inside the relationship clause, "*ALLSHORTEST" naming the +algorithm, "10" specifying search depth bounds, and "(r, n | <expression>)" is a filter lambda, used to filter which relationships and nodes to use. #### \_\_init\_\_ diff --git a/docs/reference/gqlalchemy/graph_algorithms/query_builder.md b/docs/reference/gqlalchemy/graph_algorithms/query_builder.md index 43cc16ae..4a668b6e 100644 --- a/docs/reference/gqlalchemy/graph_algorithms/query_builder.md +++ b/docs/reference/gqlalchemy/graph_algorithms/query_builder.md @@ -9,9 +9,9 @@ title: gqlalchemy.graph_algorithms.query_builder class MemgraphQueryBuilder(QueryBuilder) ``` -This query builder extends the usual Cypher query builder capabilities with Memgraph's query modules. +This query builder extends the usual Cypher query builder capabilities with Memgraph's query modules. User gets with this module autocomplete features of graph algorithms. -Documentation on the methods can be found on Memgraph's web page. +Documentation on the methods can be found on Memgraph's web page. ## MageQueryBuilder Objects @@ -21,5 +21,5 @@ class MageQueryBuilder(MemgraphQueryBuilder) This query builder extends the Memgraph query builder with Memgraph MAGE graph algorithm Cypher options. User gets with this module autocomplete features of graph algorithms written in MAGE library. -Documentation on the methods can be found on Memgraph's web page. +Documentation on the methods can be found on Memgraph's web page. diff --git a/docs/reference/gqlalchemy/graph_algorithms/query_modules.md b/docs/reference/gqlalchemy/graph_algorithms/query_modules.md index 80e4917c..14d4521c 100644 --- a/docs/reference/gqlalchemy/graph_algorithms/query_modules.md +++ b/docs/reference/gqlalchemy/graph_algorithms/query_modules.md @@ -32,7 +32,7 @@ Named arguments in self.arguments. def get_arguments_for_call() -> str ``` -return inputs in form "value1, value2, ..." for QueryBuilder call() +return inputs in form "value1, value2, ..." for QueryBuilder call() method. **Raises**: @@ -54,12 +54,12 @@ One list is for arguments and another for returns. For instance, if a query module signature is: dummy_module.dummy(lst :: LIST OF STRING, num = 3 :: NUMBER) :: (ret :: STRING) the method should return a list of arguments: -[{"name": "lst", "type": "LIST OF STRING"}, {"name": "num", "type": "NUMBER", "default": 3}] +[{"name": "lst", "type": "LIST OF STRING"}, {"name": "num", "type": "NUMBER", "default": 3}] and a list of returns: -[{"name": "ret", "type": "STRING"}] +[{"name": "ret", "type": "STRING"}] -Dictionary consists of fields: "name" - argument name, "type" - data -type of argument and "default" where default argument value is given +Dictionary consists of fields: "name" - argument name, "type" - data +type of argument and "default" where default argument value is given **Arguments**: diff --git a/docs/reference/gqlalchemy/instance_runner.md b/docs/reference/gqlalchemy/instance_runner.md index 7c231c5d..08e32b57 100644 --- a/docs/reference/gqlalchemy/instance_runner.md +++ b/docs/reference/gqlalchemy/instance_runner.md @@ -50,7 +50,7 @@ Wait for a Docker container to enter the status `running`. **Raises**: -- `TimeoutError` - Raises an error when the container isn't running after the +- `TimeoutError` - Raises an error when the container isn't running after the timeout period has passed. ## MemgraphInstance Objects @@ -71,7 +71,7 @@ connection object. **Attributes**: - `restart` - A bool indicating if the instance should be - restarted if it's already running. + restarted if it's already running. #### start @@ -84,7 +84,7 @@ Start the Memgraph instance. **Attributes**: - `restart` - A bool indicating if the instance should be - restarted if it's already running. + restarted if it's already running. #### stop diff --git a/docs/reference/gqlalchemy/models.md b/docs/reference/gqlalchemy/models.md index b7a59cdd..d7ffad4e 100644 --- a/docs/reference/gqlalchemy/models.md +++ b/docs/reference/gqlalchemy/models.md @@ -27,8 +27,8 @@ class TriggerEventObject() An enum representing types of trigger objects. -NODE -> `()` -RELATIONSHIP -> `-->` +NODE -> `()` +RELATIONSHIP -> `-->` ## TriggerExecutionPhase Objects @@ -211,9 +211,9 @@ def save(db: "Database") -> "Node" Saves node to Memgraph. If the node._id is not None it fetches the node with the same id from -Memgraph and updates it's fields. +Memgraph and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from Memgraph and updates it's fields. +fields from Memgraph and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -281,7 +281,7 @@ def save(db: "Database") -> "Relationship" Saves a relationship to Memgraph. If relationship._id is not None it finds the relationship in Memgraph -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. diff --git a/docs/reference/gqlalchemy/query_builders/declarative_base.md b/docs/reference/gqlalchemy/query_builders/declarative_base.md index b55dfcab..d237bc1b 100644 --- a/docs/reference/gqlalchemy/query_builders/declarative_base.md +++ b/docs/reference/gqlalchemy/query_builders/declarative_base.md @@ -306,7 +306,7 @@ Call a query module procedure. Call procedure with arguments: -- `Python` - `call('json_util.load_from_url', "'https://some-url.com'").yield_('objects').return_(results='objects').execute() +- `Python` - `call('json_util.load_from_url', "'https://some-url.com'").yield_('objects').return_(results='objects').execute() - `Cypher` - `CALL json_util.load_from_url(https://some-url.com) YIELD objects RETURN objects;` #### node @@ -376,7 +376,7 @@ Add a relationship pattern to the query. Match and return a relationship: - `Python` - `match().node(labels='Town', variable='t').to(relationship_type='BELONGS_TO', variable='b').node(labels='Country', variable='c').return_(results='b').execute()` -- `Cypher` - `MATCH (t:Town)-[b:BELONGS_TO]->(c:Country) RETURN b;` +- `directed`0 - `directed`1 #### from\_ @@ -411,7 +411,7 @@ Add a relationship pattern to the query. Match and return a relationship: - `Python` - `match().node(labels='Country', variable='c').from_(relationship_type='BELONGS_TO', variable='b').node(labels='Town', variable='t').return_(results='b').execute()` -- `Cypher` - `MATCH (c:Country)<-[b:BELONGS_TO]-(t:Town) RETURN b;` +- `Cypher` - `directed`0 #### where @@ -428,7 +428,7 @@ Creates a WHERE statement Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Raises**: @@ -447,17 +447,17 @@ Creates a WHERE statement Cypher partial query. Filtering query results by the equality of `name` properties of two connected nodes. - `Python` - `match().node(variable='n').to().node(variable='m').where(item='n.name', operator=Operator.EQUAL, expression='m.name').return_()` -- `Cypher` - `MATCH (n)-[]->(m) WHERE n.name = m.name RETURN *;` +- `operator`0 - `operator`1 Filtering query results by the node label. -- `Python` - `match().node(variable='n').where(item='n', operator=Operator.LABEL_FILTER, expression='User').return_()` -- `Cypher` - `MATCH (n) WHERE n:User RETURN *;` +- `Python` - `operator`3 +- `operator`0 - `operator`5 Filtering query results by the comparison of node property and literal. -- `Python` - `match().node(variable='n').where(item='n.age', operator=Operator.GREATER_THAN, literal=18).return_()` -- `Cypher` - `MATCH (n) WHERE n.age > 18 RETURN *;` +- `Python` - `operator`7 +- `operator`0 - `operator`9 #### where\_not @@ -474,7 +474,7 @@ Creates a WHERE NOT statement Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Raises**: @@ -493,7 +493,7 @@ Creates a WHERE NOT statement Cypher partial query. Filtering query results by the equality of `name` properties of two connected nodes. - `Python` - `match().node(variable='n').to().node(variable='m').where_not(item='n.name', operator='=', expression='m.name').return_()` -- `Cypher` - `MATCH (n)-[]->(m) WHERE NOT n.name = m.name RETURN *;` +- `operator`0 - `operator`1 #### and\_where @@ -510,7 +510,7 @@ Creates an AND statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -541,7 +541,7 @@ Creates an AND NOT statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -571,7 +571,7 @@ Creates an OR statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -601,7 +601,7 @@ Creates an OR NOT statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -631,7 +631,7 @@ Creates an XOR statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -662,7 +662,7 @@ Creates an XOR NOT statement as a part of WHERE Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Returns**: @@ -870,7 +870,7 @@ Yield data from the query. Yield some data from a query: - `Python` - `.call(procedure='pagerank.get').yield_(results=['node', 'rank']).return_(results=['node','rank']).execute()` -- `Cypher` - `CALL pagerank.get() YIELD node, rank RETURN node, rank;` +- `Cypher` - `GQLAlchemyResultQueryTypeError`1 #### return\_ @@ -914,7 +914,7 @@ Return data from the query. Return specific variables from a query: - `Python` - `match().node(labels='Person', variable='p1').to().node(labels='Person', variable='p2').return_(results=[('p1','first'), 'p2']).execute()` -- `Cypher` - `MATCH (p1:Person)-[]->(p2:Person) RETURN p1 AS first, p2;` +- `Cypher` - `GQLAlchemyResultQueryTypeError`1 #### order\_by @@ -1084,7 +1084,7 @@ Creates a SET statement Cypher partial query. Kwargs: - `literal` - A value that will be converted to Cypher value, such as int, float, string, etc. -- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). +- `expression` - A node label or property that won't be converted to Cypher value (no additional quotes will be added). **Raises**: @@ -1103,27 +1103,27 @@ Creates a SET statement Cypher partial query. Set or update a property. - `Python` - `match().node(variable='n').where(item='n.name', operator=Operator.EQUAL, literal='Germany').set_(item='n.population', operator=Operator.ASSIGNMENT, literal=83000001).return_().execute()` -- `Cypher` - `MATCH (n) WHERE n.name = 'Germany' SET n.population = 83000001 RETURN *;` +- `Cypher` - `operator`0 Set or update multiple properties. -- `Python` - `match().node(variable='n').where(item='n.name', operator=Operator.EQUAL, literal='Germany').set_(item='n.population', operator=Operator.ASSIGNMENT, literal=83000001).set_(item='n.capital', operator=Operator.ASSIGNMENT, literal='Berlin').return_().execute()` -- `Cypher` - `MATCH (n) WHERE n.name = 'Germany' SET n.population = 83000001 SET n.capital = 'Berlin' RETURN *;` +- `Python` - `operator`2 +- `Cypher` - `operator`4 Set node label. -- `Python` - `match().node(variable='n').where(item='n.name', operator=Operator.EQUAL, literal='Germany').set_(item='n', operator=Operator.LABEL_FILTER, expression='Land').return_().execute()` -- `Cypher` - `MATCH (n) WHERE n.name = 'Germany' SET n:Land RETURN *;` +- `Python` - `operator`6 +- `Cypher` - `operator`8 Replace all properties using map. -- `Python` - `match().node(variable='c', labels='Country').where(item='c.name', operator=Operator.EQUAL, literal='Germany').set_(item='c', operator=Operator.ASSIGNMENT, literal={'name': 'Germany', 'population': '85000000'}).return_().execute()` -- `Cypher` - `MATCH (c:Country) WHERE c.name = 'Germany' SET c = {name: 'Germany', population: '85000000'} RETURN *;` +- `Python` - `literal`0 +- `Cypher` - `literal`2 Update all properties using map. -- `Python` - `match().node(variable='c', labels='Country').where(item='c.name', operator=Operator.EQUAL, literal='Germany').set_(item='c', operator=Operator.INCREMENT, literal={'name': 'Germany', 'population': '85000000'}).return_().execute()` -- `Cypher` - `MATCH (c:Country) WHERE c.name = 'Germany' SET c += {name: 'Germany', population: '85000000'} RETURN *;` +- `Python` - `literal`4 +- `Cypher` - `literal`6 #### execute diff --git a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md index 4f4b2d76..79d160ec 100644 --- a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md +++ b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md @@ -19,7 +19,8 @@ Load data from a CSV file by executing a Cypher query for each row. **Arguments**: -- `path` - A string representing the path to the CSV file. If beginning with `http://`, `https://`, or `ftp://`, the CSV file will be fetched over the network. +- `path` - A string representing the path to the CSV file. If beginning with + "http://", "https://" or "ftp://", the CSV file will be fetched over the network. - `header` - A bool indicating if the CSV file starts with a header row. - `row` - A string representing the name of the variable for iterating over each row. @@ -34,13 +35,27 @@ Load data from a CSV file by executing a Cypher query for each row. Load CSV with header: -- `Python` - `load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute()` -- `Cypher` - `LOAD CSV FROM 'path/to/my/file.csv' WITH HEADER AS row RETURN *;` + - Python: + ``` + load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute() + ``` + + - Cypher: + ``` + LOAD CSV FROM "path/to/my/file.csv" WITH HEADER AS row RETURN *; + ``` Load CSV without header: -- `Python` - `load_csv(path='path/to/my/file.csv', header=False, row='row').return_().execute()` -- `Cypher` - `LOAD CSV FROM 'path/to/my/file.csv' NO HEADER AS row RETURN *;` + - Python: + ``` + load_csv(path="path/to/my/file.csv", header=False, row="row").return_().execute() + ``` + + - Cypher: + ``` + LOAD CSV FROM "path/to/my/file.csv" NO HEADER AS row RETURN *; + ``` #### call @@ -55,7 +70,7 @@ def call(procedure: str, subgraph_path: str = None) -> "DeclarativeBase" ``` -Override of base class method to support Memgraph's subgraph functionality. +Override of base class method to support Memgraph's subgraph functionality. Method can be called with node labels and relationship types, both being optional, which are used to construct a subgraph, or if neither is provided, a subgraph query is used, which can be passed as a string representing a @@ -83,14 +98,12 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Examples**: - `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` -- `Cypher` - `MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) - WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` +- `query_module.procedure`0 - `query_module.procedure`1 or -- `Python` - `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()` -- `Cypher` - `MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph - CALL export_util.json(graph, '/home/user')` +- `Python` - `query_module.procedure`3 +- `query_module.procedure`0 - `query_module.procedure`5 ## ProjectPartialQuery Objects @@ -106,6 +119,6 @@ def construct_query() -> str Constructs a Project partial query. -Given path part of a query (e.g. (:LABEL)-[:TYPE]->(:LABEL2)), +Given path part of a query (e.g. (:LABEL)-[:TYPE]->(:LABEL2)), adds MATCH, a path identifier and appends the WITH clause. diff --git a/docs/reference/gqlalchemy/transformations/export/graph_transporter.md b/docs/reference/gqlalchemy/transformations/export/graph_transporter.md index f2ad2192..85a7b125 100644 --- a/docs/reference/gqlalchemy/transformations/export/graph_transporter.md +++ b/docs/reference/gqlalchemy/transformations/export/graph_transporter.md @@ -10,7 +10,7 @@ class GraphTransporter(Transporter) ``` Here is a possible example for using this module: ->>> transporter = GraphTransporter("dgl") +>>> transporter = GraphTransporter("dgl") graph = transporter.export() #### \_\_init\_\_ @@ -28,7 +28,7 @@ def __init__(graph_type: str, Initializes GraphTransporter. It is used for converting Memgraph graph to the specific graph type offered by some Python package (PyG, DGL, NX...) Here is a possible example for using this module: ->>> transporter = GraphTransporter("dgl") +>>> transporter = GraphTransporter("dgl") graph = transporter.export() **Arguments**: diff --git a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md index 3d7cdc31..d0379e0b 100644 --- a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md +++ b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md @@ -11,7 +11,7 @@ class GraphImporter(Importer) Imports dgl, pyg or networkx graph representations to Memgraph. The following code will suffice for importing queries. ->>> importer = GraphImporter("dgl") +>>> importer = GraphImporter("dgl") graph = DGLGraph(...) importer.translate(graph) # queries are inserted in this step diff --git a/docs/reference/gqlalchemy/transformations/importing/loaders.md b/docs/reference/gqlalchemy/transformations/importing/loaders.md index 63a7dbfc..8aaab696 100644 --- a/docs/reference/gqlalchemy/transformations/importing/loaders.md +++ b/docs/reference/gqlalchemy/transformations/importing/loaders.md @@ -77,7 +77,7 @@ Class that contains new label name and all of the column name mappings for a sin **Attributes**: - `label` - New label (Optional). -- `column_names_mapping` - Dictionary containing key-value pairs in form ("column name", "property name") (Optional). +- `column_names_mapping` - Dictionary containing key-value pairs in form ("column name", "property name") (Optional). ## NameMapper Objects @@ -162,7 +162,7 @@ Initializes connection and data bucket. **Raises**: -- `KeyError` - kwargs doesn't contain necessary fields. +- `KeyError` - kwargs doesn't contain necessary fields. #### get\_path @@ -204,7 +204,7 @@ Initializes connection and data container. **Raises**: -- `KeyError` - kwargs doesn't contain necessary fields. +- `KeyError` - kwargs doesn't contain necessary fields. #### get\_path @@ -305,8 +305,8 @@ class PyArrowDataLoader(DataLoader) Loads data using PyArrow. -PyArrow currently supports "parquet", "ipc"/"arrow"/"feather", "csv", -and "orc", see pyarrow.dataset.dataset for up-to-date info. +PyArrow currently supports "parquet", "ipc"/"arrow"/"feather", "csv", +and "orc", see pyarrow.dataset.dataset for up-to-date info. ds.dataset in load_data accepts any fsspec subclass, making this DataLoader compatible with fsspec-compatible filesystems. @@ -399,7 +399,7 @@ def __init__(file_system_handler: str, **Raises**: -- `ValueError` - PyArrow doesn't support ORC on Windows. +- `ValueError` - PyArrow doesn't support ORC on Windows. ## PyArrowS3Importer Objects diff --git a/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md b/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md index a3323abc..0c7a2fc1 100644 --- a/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/dgl_translator.md @@ -23,11 +23,11 @@ same name must have the same dimensionality and data type. def to_cypher_queries(graph: Union[dgl.DGLGraph, dgl.DGLHeteroGraph]) ``` -Produce cypher queries for data saved as part of the DGL graph. The method handles both homogeneous and heterogeneous graph. If the graph is homogeneous, a default DGL's labels will be used. -_N as a node label and _E as edge label. The method converts 1D as well as multidimensional features. If there are some isolated nodes inside DGL graph, they won't get transferred. Nodes and edges -created in Memgraph DB will, for the consistency reasons, have property `dgl_id` set to the id they have as part of the DGL graph. Note that this method doesn't insert anything inside the database, +Produce cypher queries for data saved as part of the DGL graph. The method handles both homogeneous and heterogeneous graph. If the graph is homogeneous, a default DGL's labels will be used. +_N as a node label and _E as edge label. The method converts 1D as well as multidimensional features. If there are some isolated nodes inside DGL graph, they won't get transferred. Nodes and edges +created in Memgraph DB will, for the consistency reasons, have property `dgl_id` set to the id they have as part of the DGL graph. Note that this method doesn't insert anything inside the database, it just creates cypher queries. To insert queries the following code can be used: ->>> memgraph = Memgraph() +>>> memgraph = Memgraph() dgl_graph = DGLGraph(...) for query in DGLTranslator().to_cypher_queries(dgl_graph): memgraph.execute(query) @@ -46,9 +46,9 @@ memgraph.execute(query) def get_instance() -> dgl.DGLHeteroGraph ``` -Create instance of DGL graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features -that are set on all nodes or all edges are transferred to the DGL instance since this is DGL's requirement. That means that any string values properties won't be transferred, as well as numerical properties -that aren't set on all nodes. However, features of type list are transferred to the DGL and can be used as any other feature in the DGL graph. Regardless of data residing inside Memgraph database, the created +Create instance of DGL graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features +that are set on all nodes or all edges are transferred to the DGL instance since this is DGL's requirement. That means that any string values properties won't be transferred, as well as numerical properties +that aren't set on all nodes. However, features of type list are transferred to the DGL and can be used as any other feature in the DGL graph. Regardless of data residing inside Memgraph database, the created DGL graph is a heterograph instance. **Returns**: diff --git a/docs/reference/gqlalchemy/transformations/translators/nx_translator.md b/docs/reference/gqlalchemy/transformations/translators/nx_translator.md index 28045ee7..6c4afc06 100644 --- a/docs/reference/gqlalchemy/transformations/translators/nx_translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/nx_translator.md @@ -59,6 +59,6 @@ Generates Cypher queries and inserts data into Memgraph in parallel. def get_instance() ``` -Creates NetworkX instance of the graph from the data residing inside Memgraph. Since NetworkX doesn't support labels in a way Memgraph does, labels +Creates NetworkX instance of the graph from the data residing inside Memgraph. Since NetworkX doesn't support labels in a way Memgraph does, labels are encoded as a node and edge properties. diff --git a/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md b/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md index f4286f99..78b82c5d 100644 --- a/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md @@ -31,7 +31,7 @@ Extracts node properties from heterogeneous graph based on the node_label. def extract_node_edge_properties_from_homogeneous_graph(cls, graph) ``` -Homogenous graph don't have node and etype properties so it is hard to extract node and edge attributes. +Homogenous graph don't have node and etype properties so it is hard to extract node and edge attributes. **Arguments**: @@ -48,10 +48,10 @@ def to_cypher_queries(graph) ``` Produce cypher queries for data saved as part of thePyG graph. The method handles both homogeneous and heterogeneous graph. -The method converts 1D as well as multidimensional features. If there are some isolated nodes inside the graph, they won't get transferred. Nodes and edges -created in Memgraph DB will, for the consistency reasons, have property `pyg_id` set to the id they have as part of the PyG graph. Note that this method doesn't insert anything inside +The method converts 1D as well as multidimensional features. If there are some isolated nodes inside the graph, they won't get transferred. Nodes and edges +created in Memgraph DB will, for the consistency reasons, have property `pyg_id` set to the id they have as part of the PyG graph. Note that this method doesn't insert anything inside the database, it just creates cypher queries. To insert queries the following code can be used: ->>> memgraph = Memgraph() +>>> memgraph = Memgraph() pyg_graph = HeteroData(...) for query in PyGTranslator().to_cypher_queries(pyg_graph): memgraph.execute(query) @@ -70,9 +70,9 @@ memgraph.execute(query) def get_instance() ``` -Create instance of PyG graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features -that are set on all nodes or all edges are transferred to the PyG instance since this is PyG's requirement. That means that any string values properties won't be transferred, as well as numerical properties -that aren't set on all nodes. However, features that are of type list are transferred to the PyG instance and can be used as any other feature in the PyG graph. Regardless of data residing inside Memgraph database, the created +Create instance of PyG graph from all edges that are inside Memgraph. Currently, isolated nodes are ignored because they don't contribute in message passing neural networks. Only numerical features +that are set on all nodes or all edges are transferred to the PyG instance since this is PyG's requirement. That means that any string values properties won't be transferred, as well as numerical properties +that aren't set on all nodes. However, features that are of type list are transferred to the PyG instance and can be used as any other feature in the PyG graph. Regardless of data residing inside Memgraph database, the created PyG graph is a heterograph instance. **Returns**: diff --git a/docs/reference/gqlalchemy/transformations/translators/translator.md b/docs/reference/gqlalchemy/transformations/translators/translator.md index abeea720..233a530e 100644 --- a/docs/reference/gqlalchemy/transformations/translators/translator.md +++ b/docs/reference/gqlalchemy/transformations/translators/translator.md @@ -16,7 +16,7 @@ class Translator(ABC) def to_cypher_queries(graph) ``` -Abstract method which doesn't know how to produce cypher queries for a specific graph type and thus needs to be overridden. +Abstract method which doesn't know how to produce cypher queries for a specific graph type and thus needs to be overridden. **Arguments**: @@ -34,7 +34,7 @@ Abstract method which doesn't know how to produce cypher queries for a specific def get_instance() ``` -Abstract method which doesn't know how to create the concrete instance so it needs to be overridden. +Abstract method which doesn't know how to create the concrete instance so it needs to be overridden. **Raises**: diff --git a/docs/reference/gqlalchemy/vendors/database_client.md b/docs/reference/gqlalchemy/vendors/database_client.md index 8f2decb9..88eefa92 100644 --- a/docs/reference/gqlalchemy/vendors/database_client.md +++ b/docs/reference/gqlalchemy/vendors/database_client.md @@ -152,9 +152,9 @@ def save_node(node: Node) -> Node Saves node to database. If the node._id is not None, it fetches the node with the same id from -the database and updates it's fields. +the database and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from the database and updates it's fields. +fields from the database and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -250,7 +250,7 @@ def save_relationship(relationship: Relationship) -> Optional[Relationship] Saves a relationship to the database. If relationship._id is not None it finds the relationship in the database -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. diff --git a/docs/reference/gqlalchemy/vendors/memgraph.md b/docs/reference/gqlalchemy/vendors/memgraph.md index fb658782..4f06a63e 100644 --- a/docs/reference/gqlalchemy/vendors/memgraph.md +++ b/docs/reference/gqlalchemy/vendors/memgraph.md @@ -181,9 +181,9 @@ def save_node(node: Node) -> Node Saves node to the database. If the node._id is not None it fetches the node with the same id from -the database and updates it's fields. +the database and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from the database and updates it's fields. +fields from the database and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -225,7 +225,7 @@ def save_relationship(relationship: Relationship) -> Optional[Relationship] Saves a relationship to the database. If relationship._id is not None it finds the relationship in the database -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. @@ -350,7 +350,7 @@ Get detailed storage information about the database instance. **Returns**: -- `List[dict]` - A list of dictionaries with 'storage info' and 'value' keys containing: +- `List[dict]` - A list of dictionaries with 'storage info' and 'value' keys containing: - name: Current database name - vertex_count: Total number of stored nodes - edge_count: Total number of stored relationships @@ -370,7 +370,7 @@ Get build information about the Memgraph instance. **Returns**: -- `List[dict]` - A list of dictionaries with 'build info' and 'value' keys containing: +- `List[dict]` - A list of dictionaries with 'build info' and 'value' keys containing: - build_type: The optimization level the instance was built with #### analyze\_graph @@ -392,8 +392,8 @@ to select more optimal indexes and MERGE operations. **Returns**: - `List[dict]` - A list of dictionaries containing analysis results with keys: - - label: Index's label - - property: Index's property + - label: Index's label + - property: Index's property - num estimation nodes: Nodes used for estimation - num groups: Distinct property values - avg group size: Average group size per value @@ -420,6 +420,6 @@ after significant changes to the graph structure or data. **Returns**: - `List[dict]` - A list of dictionaries containing deleted index info with keys: - - label: The deleted index's label - - property: The deleted index's property + - label: The deleted index's label + - property: The deleted index's property diff --git a/docs/reference/gqlalchemy/vendors/neo4j.md b/docs/reference/gqlalchemy/vendors/neo4j.md index b90102ad..5a016c9d 100644 --- a/docs/reference/gqlalchemy/vendors/neo4j.md +++ b/docs/reference/gqlalchemy/vendors/neo4j.md @@ -66,9 +66,9 @@ def save_node(node: Node) -> Node Saves node to the database. If the node._id is not None it fetches the node with the same id from -the database and updates it's fields. +the database and updates it's fields. If the node has unique fields it fetches the nodes with the same unique -fields from the database and updates it's fields. +fields from the database and updates it's fields. Otherwise it creates a new node with the same properties. Null properties are ignored. @@ -110,7 +110,7 @@ def save_relationship(relationship: Relationship) -> Optional[Relationship] Saves a relationship to the database. If relationship._id is not None it finds the relationship in the database -and updates it's properties with the values in `relationship`. +and updates it's properties with the values in `relationship`. If relationship._id is None, it creates a new relationship. If you want to set a relationship._id instead of creating a new relationship, use `load_relationship` first. diff --git a/gqlalchemy/query_builders/memgraph_query_builder.py b/gqlalchemy/query_builders/memgraph_query_builder.py index bffbbe9b..2fc98886 100644 --- a/gqlalchemy/query_builders/memgraph_query_builder.py +++ b/gqlalchemy/query_builders/memgraph_query_builder.py @@ -58,7 +58,8 @@ def load_csv(self, path: str, header: bool, row: str) -> "DeclarativeBase": """Load data from a CSV file by executing a Cypher query for each row. Args: - path: A string representing the path to the CSV file. If beginning with `http://`, `https://`, or `ftp://`, the CSV file will be fetched over the network. + path: A string representing the path to the CSV file. If beginning with + "http://", "https://" or "ftp://", the CSV file will be fetched over the network. header: A bool indicating if the CSV file starts with a header row. row: A string representing the name of the variable for iterating over each row. @@ -69,13 +70,28 @@ def load_csv(self, path: str, header: bool, row: str) -> "DeclarativeBase": Examples: Load CSV with header: - Python: `load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute()` - Cypher: `LOAD CSV FROM 'path/to/my/file.csv' WITH HEADER AS row RETURN *;` + - Python: + ``` + load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute() + ``` + + - Cypher: + ``` + LOAD CSV FROM "path/to/my/file.csv" WITH HEADER AS row RETURN *; + ``` Load CSV without header: - Python: `load_csv(path='path/to/my/file.csv', header=False, row='row').return_().execute()` - Cypher: `LOAD CSV FROM 'path/to/my/file.csv' NO HEADER AS row RETURN *;` + - Python: + ``` + load_csv(path="path/to/my/file.csv", header=False, row="row").return_().execute() + ``` + + - Cypher: + ``` + LOAD CSV FROM "path/to/my/file.csv" NO HEADER AS row RETURN *; + ``` + """ self._query.append(LoadCsvPartialQuery(path, header, row)) diff --git a/pydoc-markdown.yml b/pydoc-markdown.yml index cd7f15ed..e74b1aaf 100644 --- a/pydoc-markdown.yml +++ b/pydoc-markdown.yml @@ -40,4 +40,4 @@ renderer: relative_sidebar_path: sidebar.json sidebar_top_level_label: 'Reference' markdown: - escape_html_in_docstring: false + escape_html_in_docstring: true From 73885038b8b96a09fb2ee710deaeb74a9273267d Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 22:47:19 +0100 Subject: [PATCH 7/9] more docs fixes --- docs/reference/gqlalchemy/models.md | 3 ++ .../query_builders/memgraph_query_builder.md | 26 +++++++++++++---- .../importing/graph_importer.md | 10 ++++++- docs/reference/gqlalchemy/vendors/memgraph.md | 2 +- gqlalchemy/models.py | 3 ++ .../query_builders/memgraph_query_builder.py | 28 +++++++++++++------ .../importing/graph_importer.py | 12 ++++++-- gqlalchemy/vendors/memgraph.py | 2 +- 8 files changed, 67 insertions(+), 19 deletions(-) diff --git a/docs/reference/gqlalchemy/models.md b/docs/reference/gqlalchemy/models.md index d7ffad4e..6d8b0a4a 100644 --- a/docs/reference/gqlalchemy/models.md +++ b/docs/reference/gqlalchemy/models.md @@ -173,6 +173,9 @@ def parse_obj(cls, obj) Used to convert a dictionary object into the appropriate GraphObject. +Compatibility note: `parse_obj` is retained for backward compatibility. +For Pydantic v2-style usage, prefer `model_validate`. + ## NodeMetaclass Objects ```python diff --git a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md index 79d160ec..fcc67257 100644 --- a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md +++ b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md @@ -79,7 +79,7 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Arguments**: - `procedure` - A string representing the name of the procedure in the - format `query_module.procedure`. + format ``query_module.procedure``. - `arguments` - A string representing the arguments of the procedure in text format. - `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 **Returns**: - A `DeclarativeBase` instance for constructing queries. + A ``DeclarativeBase`` instance for constructing queries. **Examples**: -- `Python` - `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` -- `query_module.procedure`0 - `query_module.procedure`1 + Python: + ```python + call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() + ``` + Cypher: + ```cypher + MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) + WITH project(p) AS graph CALL export_util.json(graph, '/home/user') + ``` or -- `Python` - `query_module.procedure`3 -- `query_module.procedure`0 - `query_module.procedure`5 + Python: + ```python + call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() + ``` + Cypher: + ```cypher + MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph + CALL export_util.json(graph, '/home/user') + ``` ## ProjectPartialQuery Objects diff --git a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md index d0379e0b..a72e0578 100644 --- a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md +++ b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md @@ -37,7 +37,11 @@ Gets cypher queries using the underlying translator and then inserts all queries def translate_dot_file(path: str) -> None ``` -Parses a DOT file to a NetworkX graph and imports it to Memgraph. +Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ``graph_type="NX"`` + +**Arguments**: + + - ``path`` - Path to a DOT file. #### translate\_dot\_data @@ -47,3 +51,7 @@ def translate_dot_data(dot_data: str) -> None Parses DOT content to a NetworkX graph and imports it to Memgraph. +**Arguments**: + + - ``dot_data`` - Raw DOT graph content. + diff --git a/docs/reference/gqlalchemy/vendors/memgraph.md b/docs/reference/gqlalchemy/vendors/memgraph.md index 4f06a63e..dd5d3568 100644 --- a/docs/reference/gqlalchemy/vendors/memgraph.md +++ b/docs/reference/gqlalchemy/vendors/memgraph.md @@ -413,7 +413,7 @@ after significant changes to the graph structure or data. **Arguments**: -- `labels` - Optional list of labels to delete statistics for. + labels ``_Optional[List[str]]_``: Optional list of labels to delete statistics for. If None, deletes statistics for all labels. diff --git a/gqlalchemy/models.py b/gqlalchemy/models.py index d3925907..008c3ee9 100644 --- a/gqlalchemy/models.py +++ b/gqlalchemy/models.py @@ -512,6 +512,9 @@ def model_validate(cls, obj, *args, **kwargs): def parse_obj(cls, obj): """Used to convert a dictionary object into the appropriate GraphObject. + + Compatibility note: `parse_obj` is retained for backward compatibility. + For Pydantic v2-style usage, prefer `model_validate`. """ return cls.model_validate(obj) diff --git a/gqlalchemy/query_builders/memgraph_query_builder.py b/gqlalchemy/query_builders/memgraph_query_builder.py index 2fc98886..43e167a7 100644 --- a/gqlalchemy/query_builders/memgraph_query_builder.py +++ b/gqlalchemy/query_builders/memgraph_query_builder.py @@ -139,7 +139,7 @@ def call( Args: procedure: A string representing the name of the procedure in the - format `query_module.procedure`. + format ``query_module.procedure``. arguments: A string representing the arguments of the procedure in text format. node_labels: Either a string, which is then used as the label for all nodes, or @@ -150,18 +150,30 @@ def call( subgraph_path: Optional way to define the subgraph via a Cypher MATCH clause. Returns: - A `DeclarativeBase` instance for constructing queries. + A ``DeclarativeBase`` instance for constructing queries. Examples: - Python: `call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute()` - Cypher: `MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) - WITH project(p) AS graph CALL export_util.json(graph, '/home/user')` + Python: + ```python + call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() + ``` + Cypher: + ```cypher + MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) + WITH project(p) AS graph CALL export_util.json(graph, '/home/user') + ``` or - Python: `call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute()` - Cypher: `MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph - CALL export_util.json(graph, '/home/user')` + Python: + ```python + call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() + ``` + Cypher: + ```cypher + MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph + CALL export_util.json(graph, '/home/user') + ``` """ if not (node_labels is None and relationship_types is None): diff --git a/gqlalchemy/transformations/importing/graph_importer.py b/gqlalchemy/transformations/importing/graph_importer.py index a60f33b8..2a3e2228 100644 --- a/gqlalchemy/transformations/importing/graph_importer.py +++ b/gqlalchemy/transformations/importing/graph_importer.py @@ -86,7 +86,11 @@ def translate(self, graph) -> None: memgraph.execute(query) def translate_dot_file(self, path: str) -> None: - """Parses a DOT file to a NetworkX graph and imports it to Memgraph.""" + """Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ``graph_type="NX"`` + + Args: + - ``path`` - Path to a DOT file. + """ self._raise_if_not_nx_importer() raise_if_not_imported(dependency=pydot, dependency_name="pydot") @@ -98,7 +102,11 @@ def translate_dot_file(self, path: str) -> None: self.translate(graph) def translate_dot_data(self, dot_data: str) -> None: - """Parses DOT content to a NetworkX graph and imports it to Memgraph.""" + """Parses DOT content to a NetworkX graph and imports it to Memgraph. + + Args: + - ``dot_data`` - Raw DOT graph content. + """ self._raise_if_not_nx_importer() raise_if_not_imported(dependency=pydot, dependency_name="pydot") diff --git a/gqlalchemy/vendors/memgraph.py b/gqlalchemy/vendors/memgraph.py index 9a57f63a..00c138a9 100644 --- a/gqlalchemy/vendors/memgraph.py +++ b/gqlalchemy/vendors/memgraph.py @@ -631,7 +631,7 @@ def delete_graph_statistics(self, labels: Optional[List[str]] = None) -> List[di after significant changes to the graph structure or data. Args: - labels: Optional list of labels to delete statistics for. + labels ``_Optional[List[str]]_``: Optional list of labels to delete statistics for. If None, deletes statistics for all labels. Returns: From 304525e9e850eef404a2e954eae3a3c33aa52174 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 23 Jun 2026 22:49:42 +0100 Subject: [PATCH 8/9] more docs fixes --- .../gqlalchemy/transformations/importing/graph_importer.md | 2 +- gqlalchemy/transformations/importing/graph_importer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md index a72e0578..f9435535 100644 --- a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md +++ b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md @@ -49,7 +49,7 @@ Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is def translate_dot_data(dot_data: str) -> None ``` -Parses DOT content to a NetworkX graph and imports it to Memgraph. +Parses DOT content to a NetworkX graph and imports it to Memgraph. This method is available when `graph_type="NX". **Arguments**: diff --git a/gqlalchemy/transformations/importing/graph_importer.py b/gqlalchemy/transformations/importing/graph_importer.py index 2a3e2228..9505a78c 100644 --- a/gqlalchemy/transformations/importing/graph_importer.py +++ b/gqlalchemy/transformations/importing/graph_importer.py @@ -102,7 +102,7 @@ def translate_dot_file(self, path: str) -> None: self.translate(graph) def translate_dot_data(self, dot_data: str) -> None: - """Parses DOT content to a NetworkX graph and imports it to Memgraph. + """Parses DOT content to a NetworkX graph and imports it to Memgraph. This method is available when `graph_type="NX". Args: - ``dot_data`` - Raw DOT graph content. From 2bbca647378b478f1d60394487d96c0fcec86005 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 24 Jun 2026 17:06:51 +0100 Subject: [PATCH 9/9] mroe docs-related fixed --- docs/reference/gqlalchemy/models.md | 8 ----- .../query_builders/memgraph_query_builder.md | 34 ++++++++++--------- .../importing/graph_importer.md | 4 +-- .../query_builders/memgraph_query_builder.py | 22 ++++++------ .../importing/graph_importer.py | 4 +-- pydoc-markdown.yml | 6 ++++ 6 files changed, 40 insertions(+), 38 deletions(-) diff --git a/docs/reference/gqlalchemy/models.md b/docs/reference/gqlalchemy/models.md index 6d8b0a4a..8657085f 100644 --- a/docs/reference/gqlalchemy/models.md +++ b/docs/reference/gqlalchemy/models.md @@ -3,14 +3,6 @@ sidebar_label: models title: gqlalchemy.models --- -#### Field - -```python -def Field(default=..., **kwargs) -``` - -Pydantic Field wrapper that stores custom OGM metadata in json_schema_extra. - ## TriggerEventType Objects ```python diff --git a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md index fcc67257..bc097a43 100644 --- a/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md +++ b/docs/reference/gqlalchemy/query_builders/memgraph_query_builder.md @@ -36,24 +36,24 @@ Load data from a CSV file by executing a Cypher query for each row. Load CSV with header: - Python: - ``` + ```python load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute() ``` - Cypher: - ``` + ```cypher LOAD CSV FROM "path/to/my/file.csv" WITH HEADER AS row RETURN *; ``` Load CSV without header: - Python: - ``` + ```python load_csv(path="path/to/my/file.csv", header=False, row="row").return_().execute() ``` - Cypher: - ``` + ```cypher LOAD CSV FROM "path/to/my/file.csv" NO HEADER AS row RETURN *; ``` @@ -79,7 +79,7 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Arguments**: - `procedure` - A string representing the name of the procedure in the - format ``query_module.procedure``. + format "query_module.procedure". - `arguments` - A string representing the arguments of the procedure in text format. - `node_labels` - Either a string, which is then used as the label for all nodes, or @@ -92,31 +92,33 @@ Cypher query defining the MATCH clause which selects the nodes and relationships **Returns**: - A ``DeclarativeBase`` instance for constructing queries. + A DeclarativeBase instance for constructing queries. **Examples**: - Python: + - Python: ```python - call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() + call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() ``` - Cypher: + + - Cypher: ```cypher - MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) - WITH project(p) AS graph CALL export_util.json(graph, '/home/user') + MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) + WITH project(p) AS graph CALL export_util.json(graph, '/home/user') ``` or - Python: + - Python: ```python - call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() + call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() ``` - Cypher: + + - Cypher: ```cypher - MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph - CALL export_util.json(graph, '/home/user') + MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph + CALL export_util.json(graph, '/home/user') ``` ## ProjectPartialQuery Objects diff --git a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md index f9435535..921ea52f 100644 --- a/docs/reference/gqlalchemy/transformations/importing/graph_importer.md +++ b/docs/reference/gqlalchemy/transformations/importing/graph_importer.md @@ -37,7 +37,7 @@ Gets cypher queries using the underlying translator and then inserts all queries def translate_dot_file(path: str) -> None ``` -Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ``graph_type="NX"`` +Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ```graph_type="NX"``` **Arguments**: @@ -49,7 +49,7 @@ Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is def translate_dot_data(dot_data: str) -> None ``` -Parses DOT content to a NetworkX graph and imports it to Memgraph. This method is available when `graph_type="NX". +Parses DOT content to a NetworkX graph and imports it to Memgraph. This method is available when ```graph_type="NX"```. **Arguments**: diff --git a/gqlalchemy/query_builders/memgraph_query_builder.py b/gqlalchemy/query_builders/memgraph_query_builder.py index 43e167a7..65178fa6 100644 --- a/gqlalchemy/query_builders/memgraph_query_builder.py +++ b/gqlalchemy/query_builders/memgraph_query_builder.py @@ -71,24 +71,24 @@ def load_csv(self, path: str, header: bool, row: str) -> "DeclarativeBase": Load CSV with header: - Python: - ``` + ```python load_csv(path="path/to/my/file.csv", header=True, row="row").return_().execute() ``` - Cypher: - ``` + ```cypher LOAD CSV FROM "path/to/my/file.csv" WITH HEADER AS row RETURN *; ``` Load CSV without header: - Python: - ``` + ```python load_csv(path="path/to/my/file.csv", header=False, row="row").return_().execute() ``` - Cypher: - ``` + ```cypher LOAD CSV FROM "path/to/my/file.csv" NO HEADER AS row RETURN *; ``` @@ -139,7 +139,7 @@ def call( Args: procedure: A string representing the name of the procedure in the - format ``query_module.procedure``. + format "query_module.procedure". arguments: A string representing the arguments of the procedure in text format. node_labels: Either a string, which is then used as the label for all nodes, or @@ -150,14 +150,15 @@ def call( subgraph_path: Optional way to define the subgraph via a Cypher MATCH clause. Returns: - A ``DeclarativeBase`` instance for constructing queries. + A DeclarativeBase instance for constructing queries. Examples: - Python: + - Python: ```python call('export_util.json', '/home/user', "LABEL", ["TYPE1", "TYPE2"]).execute() ``` - Cypher: + + - Cypher: ```cypher MATCH p=(a)-[:TYPE1 | :TYPE2]->(b) WHERE (a:LABEL) AND (b:LABEL) WITH project(p) AS graph CALL export_util.json(graph, '/home/user') @@ -165,11 +166,12 @@ def call( or - Python: + - Python: ```python call('export_util.json', '/home/user', subgraph_path="(:LABEL)-[:TYPE]->(:LABEL)").execute() ``` - Cypher: + + - Cypher: ```cypher MATCH p=(:LABEL)-[:TYPE1]->(:LABEL) WITH project(p) AS graph CALL export_util.json(graph, '/home/user') diff --git a/gqlalchemy/transformations/importing/graph_importer.py b/gqlalchemy/transformations/importing/graph_importer.py index 9505a78c..9262f3ea 100644 --- a/gqlalchemy/transformations/importing/graph_importer.py +++ b/gqlalchemy/transformations/importing/graph_importer.py @@ -86,7 +86,7 @@ def translate(self, graph) -> None: memgraph.execute(query) def translate_dot_file(self, path: str) -> None: - """Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ``graph_type="NX"`` + """Parses a DOT file to a NetworkX graph and imports it to Memgraph. This method is available when ```graph_type="NX"``` Args: - ``path`` - Path to a DOT file. @@ -102,7 +102,7 @@ def translate_dot_file(self, path: str) -> None: self.translate(graph) def translate_dot_data(self, dot_data: str) -> None: - """Parses DOT content to a NetworkX graph and imports it to Memgraph. This method is available when `graph_type="NX". + """Parses DOT content to a NetworkX graph and imports it to Memgraph. This method is available when ```graph_type="NX"```. Args: - ``dot_data`` - Raw DOT graph content. diff --git a/pydoc-markdown.yml b/pydoc-markdown.yml index e74b1aaf..e9780364 100644 --- a/pydoc-markdown.yml +++ b/pydoc-markdown.yml @@ -31,6 +31,12 @@ loaders: processors: - type: filter skip_empty_modules: true + expression: > + not ( + name == 'Field' + and obj.location.filename.replace('\\', '/').endswith('gqlalchemy/models.py') + ) + and default() - type: smart - type: crossref renderer: