### Start and Connect to Memgraph Instance Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/instance-runner/memgraph-binary-instance.md Initialize and start a Memgraph binary instance, then establish a connection. Ensure the binary path and user are correctly set, especially for dpkg installations. ```python memgraph_instance = MemgraphInstanceBinary( host="0.0.0.0", port=7698, binary_path="/usr/lib/memgraph/memgraph", user="memgraph" ) memgraph = memgraph_instance.start_and_connect(restart=False) ``` -------------------------------- ### Generate Reference Documentation Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Install pydoc-markdown and run it to generate the reference guide from code. This is useful for creating API documentation. ```bash pip3 install pydoc-markdown ``` ```bash pydoc-markdown ``` -------------------------------- ### Start Memgraph instance with custom configuration flags Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/instance-runner/memgraph-docker-instance.md Starts a Memgraph Docker instance with custom configuration flags passed as a dictionary. This example sets the log level to TRACE. ```python config={"--log-level": "TRACE"} memgraph_instance = MemgraphInstanceDocker(config=config) ``` -------------------------------- ### Install GQLAlchemy with specific extras using uv Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs GQLAlchemy from source with selected optional dependencies using uv. Specify the desired extras to tailor the installation. ```bash uv sync # No extras ``` ```bash uv sync --extra arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats ``` ```bash uv sync --extra dgl # Installs torch (DGL must be installed separately, see below) ``` ```bash uv sync --extra dot # DOT graph import support (pydot) ``` ```bash uv sync --extra docker # Docker support ``` -------------------------------- ### Build GQLAlchemy from source with uv Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs GQLAlchemy and all optional dependencies from source using the uv package manager. This is a convenient way to get the full feature set. ```bash uv sync --all-extras ``` -------------------------------- ### Install GQLAlchemy with All Extras Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Install GQLAlchemy with all available optional features, including Arrow, DGL, and Docker support. ```bash pip install gqlalchemy[all] ``` -------------------------------- ### Install GQLAlchemy with Docker Support Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Install GQLAlchemy with Docker integration capabilities. ```bash pip install gqlalchemy[docker] ``` -------------------------------- ### Install GQLAlchemy with Specific Extras Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Installs GQLAlchemy with selected optional dependencies. Use this to tailor the installation to specific features like Arrow, DGL, Docker, or TFGNN. ```bash uv sync # No extras ``` ```bash uv sync --extra arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats ``` ```bash uv sync --extra dgl # Installs torch (DGL must be installed separately, see below) ``` ```bash uv sync --extra docker # Docker support ``` ```bash uv sync --extra tfgnn # TFGNN support ``` -------------------------------- ### Install pymgclient with pip Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs the pymgclient library, a prerequisite for GQLAlchemy, using pip. Use the --user flag for user-specific installations. ```bash pip install --user pymgclient ``` -------------------------------- ### Install Memgraph Platform Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/translators/import-python-graphs.md Installs Memgraph Platform including MAGE and Memgraph Lab. Use the Linux/macOS command for Docker Compose setup or the Windows command for its equivalent. ```bash curl https://install.memgraph.com | sh ``` ```powershell iwr https://windows.memgraph.com | iex ``` -------------------------------- ### Connect to Neo4j (Example) Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/streams/kafka-streams.md This is an example of how to connect to a Neo4j database using gqlalchemy. It is provided for context on alternative database connections. ```python db = Neo4j(host="localhost", port="7687", username="neo4j", password="test") ``` -------------------------------- ### Install GQLAlchemy with Arrow Support Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Install GQLAlchemy with support for CSV, Parquet, ORC, and IPC/Feather/Arrow formats. ```bash pip install gqlalchemy[arrow] ``` -------------------------------- ### Install GQLAlchemy with DGL Support Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Install GQLAlchemy with Deep Graph Library (DGL) support. This also includes PyTorch. ```bash pip install gqlalchemy[dgl] ``` -------------------------------- ### MemgraphInstance.start_and_connect Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/instance_runner.md Starts the Memgraph instance and returns the connection object. Optionally restarts the instance if it's already running. ```APIDOC ## MemgraphInstance.start_and_connect ### Description Start the Memgraph instance and return the connection object. ### Parameters #### Attributes - `restart` (bool) - Optional - A bool indicating if the instance should be restarted if it's already running. Defaults to `False`. ### Returns - `Memgraph` - The connection object. ``` -------------------------------- ### Start and connect to a Memgraph Docker instance Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/instance-runner/memgraph-docker-instance.md Initializes and starts a Memgraph Docker instance using default settings and establishes a connection. Set restart=True to force a restart if the instance is already running. ```python memgraph_instance = MemgraphInstanceDocker( docker_image=DockerImage.MEMGRAPH, docker_image_tag="latest", host="0.0.0.0", port=7687 ) memgraph = memgraph_instance.start_and_connect(restart=False) ``` -------------------------------- ### MemgraphInstance Start and Connect Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/instance_runner.md Starts a Memgraph instance and returns the connection object. If the instance is already running, it can be restarted if the `restart` flag is set to True. ```python def start_and_connect(restart: bool = False) -> "Memgraph" ``` -------------------------------- ### MemgraphInstance Start Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/instance_runner.md Starts the Memgraph instance. Use the `restart` parameter to force a restart if the instance is already running. ```python def start(restart: bool = False) -> None ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Install MkDocs, the Material theme, and PyMdown extensions, then serve the documentation locally to preview changes. This allows for local testing of documentation. ```bash pip3 install mkdocs ``` ```bash pip3 install mkdocs-material ``` ```bash pip3 install pymdown-extensions ``` ```bash mkdocs serve ``` -------------------------------- ### MemgraphInstance.start Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/instance_runner.md Starts the Memgraph instance. Can be configured to restart the instance if it is already running. ```APIDOC ## MemgraphInstance.start ### Description Start the Memgraph instance. ### Parameters #### Attributes - `restart` (bool) - Optional - A bool indicating if the instance should be restarted if it's already running. Defaults to `False`. ### Returns - `None` ``` -------------------------------- ### Install DOT Graph Support Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/translators/import-python-graphs.md Installs the necessary libraries for importing DOT files using GQLAlchemy, which relies on pydot and NetworkX. ```bash pip install gqlalchemy[dot] ``` -------------------------------- ### Install GQLAlchemy with PyTorch Geometric support via pip Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs GQLAlchemy with PyTorch Geometric support, including necessary prerequisites. Ensure PyTorch is installed separately if needed. ```bash pip install gqlalchemy[torch_pyg] # prerequisite pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.13.0+cpu.html ``` -------------------------------- ### Install DGL with uv Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs the DGL library using uv, specifying the correct wheel repository for PyTorch 2.4. ```bash uv sync --extra dgl uv pip install dgl -f https://data.dgl.ai/wheels/torch-2.4/repo.html ``` -------------------------------- ### Install GQLAlchemy with extras via pip Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs GQLAlchemy with additional capabilities for specific formats or libraries. Choose the extras that match your project's needs. ```bash pip install gqlalchemy[arrow] # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats ``` ```bash pip install gqlalchemy[dgl] # DGL support (also includes torch) ``` ```bash pip install gqlalchemy[dot] # DOT graph import support (pydot) ``` ```bash pip install gqlalchemy[docker] # Docker support ``` ```bash pip install gqlalchemy[all] # All of the above ``` -------------------------------- ### Full OGM Code Example Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md A comprehensive example demonstrating node and relationship definition, saving, loading, and constraint checking using GQLAlchemy's OGM. ```python from gqlalchemy import Memgraph, Node, Relationship, Field from typing import Optional db = Memgraph() class User(Node): id: str = Field(index=True, db=db) username: str = Field(exists=True, db=db) class Streamer(User): id: str username: Optional[str] = Field(exists=True, db=db) followers: Optional[str] class Language(Node, index=True, db=db): name: str = Field(unique=True, db=db) class ChatsWith(Relationship, type="CHATS_WITH"): last_chatted: str class Speaks(Relationship, type="SPEAKS"): since: Optional[str] john = User(id="1", username="John").save(db) jane = Streamer(id="2", username="janedoe", followers=111).save(db) language = Language(name="en").save(db) ChatsWith( _start_node_id=john._id, _end_node_id=jane._id, last_chatted="2023-02-14" ).save(db) Speaks(_start_node_id=john._id, _end_node_id=language._id, since="2023-02-14").save(db) streamer = Streamer(id="2").load(db=db) language = Language(name="en").load(db=db) speaks = Speaks( _start_node_id=streamer._id, _end_node_id=language._id, since="2023-02-20", ).save(db) speaks = Speaks(_start_node_id=streamer._id, _end_node_id=language._id).load(db) print(speaks.since) try: streamer = Streamer(id="3").load(db=db) except: print("Creating new Streamer node in the database.") streamer = Streamer(id="3", username="anne", followers=222).save(db=db) try: speaks = Speaks(_start_node_id=streamer._id, _end_node_id=language._id).load(db) except: print("Creating new Speaks relationship in the database.") speaks = Speaks( _start_node_id=streamer._id, _end_node_id=language._id, since="2023-02-20", ).save(db) print(db.get_indexes()) print(db.get_constraints()) ``` -------------------------------- ### Get Memgraph Build Information Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/manage-database.md Retrieve build information for the running Memgraph instance, such as the build type and optimization level. Ensure GQLAlchemy is installed and Memgraph is running. ```python from gqlalchemy import Memgraph db = Memgraph() build_info = db.get_build_info() for item in build_info: print(item) ``` -------------------------------- ### Install GQLAlchemy with pip Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs the default GQLAlchemy package using pip. This provides core functionality without specific import/export features. ```bash pip install gqlalchemy ``` -------------------------------- ### Run Development Build Commands Source: https://github.com/memgraph/gqlalchemy/blob/main/README.md Execute linters, formatters, and tests for development. Ensure you have 'uv' installed for running these commands. ```bash uv run flake8 . ``` ```bash uv run black . ``` ```bash uv run pytest . -k "not slow and not extras" ``` -------------------------------- ### Install GQLAlchemy with extras in zsh Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs GQLAlchemy with extras when using the zsh terminal. The command needs to be enclosed in single quotes to handle the special characters. ```bash pip install 'gqlalchemy[arrow]' ``` -------------------------------- ### Install PyTorch Geometric with uv Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Installs PyTorch Geometric and its related scatter, sparse, cluster, and spline convolution libraries using uv, pointing to the correct PyTorch 2.4.0 wheel repository. ```bash uv sync --extra torch_pyg uv pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-2.4.0+cpu.html ``` -------------------------------- ### Run GQLAlchemy tests with uv (specific extras) Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Executes GQLAlchemy tests using uv, excluding slow and general extras. Use this when only specific optional dependencies are installed. ```bash uv run pytest . -k "not slow and not extras" ``` -------------------------------- ### Run GQLAlchemy tests with uv (all extras) Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Executes GQLAlchemy tests using uv, excluding slow tests. This command is suitable when all optional extras have been installed. ```bash uv run pytest . -k "not slow" ``` -------------------------------- ### Load Relationship by Start and End Node IDs Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Load an existing relationship by specifying the IDs of its start and end nodes. The relationship's properties can then be accessed. ```python class Speaks(Relationship, type="SPEAKS"): since: Optional[str] loaded_speaks = Speaks( _start_node_id=streamer._id, _end_node_id=language._id ).load(db) print(loaded_speaks.since) ``` -------------------------------- ### Load Relationship by Start and End Node IDs Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/database_client.md Loads a relationship from the database using the start node and end node IDs. It matches properties that are not None. ```python def load_relationship_with_start_node_id_and_end_node_id( relationship: Relationship) -> Optional[Relationship] ``` -------------------------------- ### MemgraphInstanceBinary.is_running Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/instance_runner.md Checks if the Memgraph instance started from a binary file is currently running. ```APIDOC ## MemgraphInstanceBinary.is_running ### Description Check if the Memgraph instance is still running. ### Returns - `bool` ``` -------------------------------- ### Example Usage of to_cypher_queries Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md Demonstrates how to use the `to_cypher_queries` method to generate Cypher queries from a PyG graph and execute them using a Memgraph instance. ```python >>> memgraph = Memgraph() pyg_graph = HeteroData(...) for query in PyGTranslator().to_cypher_queries(pyg_graph): memgraph.execute(query) ``` -------------------------------- ### Import DGL Graph to Memgraph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/translators/import-python-graphs.md Converts a DGL heterogeneous graph to Cypher queries for Memgraph. Ensure DGL is installed. ```python import torch from dgl.data.utils import load_graphs from gqlalchemy import Memgraph from gqlalchemy.transformations.translators.dgl_translator import DGLTranslator # Load graph from file graph, _ = load_graphs("dgl_graph.bin") graph = graph[0] # Set edge features graph.edges[("user", "PLUS", "movie")].data["edge_prop1"] = torch.randn(size=(3, 1)) graph.edges[("user", "PLUS", "movie")].data["edge_prop2"] = torch.randn(size=(3, 1)) graph.edges[("user", "MINUS", "movie")].data["edge_prop1"] = torch.randn(size=(1, 1)) translator = DGLTranslator() for query in list(translator.to_cypher_queries(graph)): memgraph.execute(query) ``` -------------------------------- ### Import NetworkX Graph into Memgraph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/translators/import-python-graphs.md Translates a NetworkX graph into Cypher queries and executes them in Memgraph. Ensure NetworkX is installed and Memgraph is running. ```python import networkx as nx from gqlalchemy import Memgraph from gqlalchemy.transformations.translators.nx_translator import NxTranslator memgraph = Memgraph() memgraph.drop_database() graph = nx.Graph() graph.add_nodes_from([(1, {"labels": "First"}), (2, {"name": "Kata"}), 3]) graph.add_edges_from([(1, 2, {"type": "EDGE_TYPE", "date": "today"}), (1, 3)]) translator = NxTranslator() for query in list(translator.to_cypher_queries(graph)): memgraph.execute(query) ``` -------------------------------- ### Run GQLAlchemy tests for specific extras with uv Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/installation.md Executes GQLAlchemy tests for a particular optional extra (e.g., arrow, dgl, docker) using uv. This allows targeted testing of installed functionalities. ```bash uv run pytest . -k "arrow" ``` ```bash uv run pytest . -k "dgl" ``` ```bash uv run pytest . -k "docker" ``` -------------------------------- ### Merge Relationship Between Existing Nodes Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/query-builder.md This example shows how to merge a relationship between two existing nodes identified by their properties and variables. ```python from gqlalchemy import Memgraph, match, merge db = Memgraph() match().node(labels="Person", name="Leslie", variable="leslie").match().node( labels="Person", name="Ron", variable="ron" ).merge().node(variable="leslie").to(relationship_type="FRIENDS_WITH").node( variable="ron" ).execute() ``` -------------------------------- ### Get Memgraph Storage Information Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/manage-database.md Retrieve detailed storage information about your Memgraph instance, including vertex and edge counts, memory, and disk usage. Requires an active Memgraph instance and GQLAlchemy installation. ```python from gqlalchemy import Memgraph db = Memgraph() storage_info = db.get_storage_info() for item in storage_info: print(item) ``` -------------------------------- ### Load Nodes for Relationship Creation Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Load the start and end nodes required to create a relationship. The load() method returns a single result for unique matches. ```python loaded_streamer = Streamer(id="2").load(db=db) loaded_language = Language(name="en").load(db=db) ``` -------------------------------- ### Create Nodes and Relationships Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/query-builder.md Demonstrates creating nodes with labels and properties, and establishing relationships between them using the `create()` method. ```python from gqlalchemy import create, Memgraph db = Memgraph() db.drop_database() create().node(labels="Person", name="Leslie").to(relationship_type="FRIENDS_WITH").node( labels="Person", name="Ron" ).execute() create().node( labels="Person", name="Jane", last_name="James", address="street", age=19 ).from_(relationship_type="FRIENDS_WITH", since="2023-02-16").node( labels="Person", name="John", last_name="James", address="street", age=8 ).execute() ``` -------------------------------- ### Create and Load Data with On-Disk Property Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/on-disk-storage/on-disk-storage.md Creates a 'User' node with a large string property stored on disk and demonstrates loading it back. The 'huge_string' is fetched from the SQL database. ```python my_secret = "I LOVE DUCKS" * 1000 john = User(id=5, huge_string=my_secret).save(db) john2 = User(id=5).load(db) print(john2.huge_string) # prints I LOVE DUCKS, a 1000 times ``` -------------------------------- ### Create a Memgraph Graph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/translators/export-python-graphs.md This script initializes a Memgraph connection, drops any existing database, and then creates nodes and connections with specified properties. Ensure Memgraph Platform is running before execution. ```python from gqlalchemy import Memgraph memgraph = Memgraph() memgraph.drop_database() queries = [] queries.append(f"CREATE (m:Node {{id: 1, num: 80, edem: 30, lst: [2, 3, 3, 2]}})") queries.append(f"CREATE (m:Node {{id: 2, num: 91, edem: 32, lst: [2, 2, 3, 3]}})") queries.append( f"CREATE (m:Node {{id: 3, num: 100, edem: 34, lst: [3, 2, 2, 3, 4, 4]}})" ) queries.append(f"CREATE (m:Node {{id: 4, num: 12, edem: 34, lst: [2, 2, 2, 3, 5, 5]}})") queries.append( f"MATCH (n:Node {{id: 1}}), (m:Node {{id: 2}}) CREATE (n)-[r:CONNECTION {{edge_id: 1, edge_num: 99, edge_edem: 12, edge_lst: [0, 1, 0, 1, 0, 1, 0, 1]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 2}}), (m:Node {{id: 3}}) CREATE (n)-[r:CONNECTION {{edge_id: 2, edge_num: 99, edge_edem: 12, edge_lst: [0, 1, 0, 1]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 3}}), (m:Node {{id: 4}}) CREATE (n)-[r:CONNECTION {{edge_id: 3, edge_num: 99, edge_edem: 12, edge_lst: [1, 0, 1, 0, 1, 0, 1]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 4}}), (m:Node {{id: 1}}) CREATE (n)-[r:CONNECTION {{edge_id: 4, edge_num: 99, edge_edem: 12, edge_lst: [0, 1, 0, 1]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 1}}), (m:Node {{id: 3}}) CREATE (n)-[r:CONNECTION {{edge_id: 5, edge_num: 99, edge_edem: 12, edge_lst: [0, 1, 0, 1]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 2}}), (m:Node {{id: 4}}) CREATE (n)-[r:CONNECTION {{edge_id: 6, edge_num: 99, edge_edem: 12, edge_lst: [0, 1, 0, 1, 0, 0]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 4}}), (m:Node {{id: 2}}) CREATE (n)-[r:CONNECTION {{edge_id: 7, edge_num: 99, edge_edem: 12, edge_lst: [1, 1, 0, 0, 1, 1, 0, 1]}}]->(m)" ) queries.append( f"MATCH (n:Node {{id: 3}}), (m:Node {{id: 1}}) CREATE (n)-[r:CONNECTION {{edge_id: 8, edge_num: 99, edge_edem: 12, edge_lst: [0, 1, 0, 1]}}]->(m)" ) for query in queries: memgraph.execute(query) ``` -------------------------------- ### AllShortestPath Constructor Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md Initializes the AllShortestPath algorithm with specified parameters for pathfinding. ```APIDOC ## AllShortestPath Build a Dijkstra shortest path call for a Cypher query. ### ```python class AllShortestPath(IntegratedAlgorithm) ``` ### ```python def __init__(upper_bound: int = None, condition: str = None, total_weight_var: str = DEFAULT_TOTAL_WEIGHT, weight_property: str = DEFAULT_WEIGHT_PROPERTY) -> None ``` #### Arguments: - `upper_bound` (int) - Upper bound for path depth. - `condition` (str) - Filter through nodes and relationships that pass this condition. - `total_weight_var` (str) - Variable defined as the sum of all weights on path being returned. - `weight_property` (str) - Property being used as weight. ``` -------------------------------- ### Get Created Constraints Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Retrieve a list of all constraints currently created in the database using the `db.get_constraints()` method. ```python print(db.get_constraints()) ``` -------------------------------- ### Initialize DataLoader Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes a DataLoader with a file extension and a file system handler. ```python def __init__(file_extension: str, file_system_handler: FileSystemHandler) -> None ``` -------------------------------- ### Get All Constraints from Neo4j Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/neo4j.md Returns a list of all database constraints, including label and label-property types, from Neo4j. ```python def get_constraints( ) -> List[Union[Neo4jConstraintExists, Neo4jConstraintUnique]] ``` -------------------------------- ### Get All Indexes from Neo4j Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/neo4j.md Retrieves a list of all database indexes, including label and label-property types, from Neo4j. ```python def get_indexes() -> List[Neo4jIndex] ``` -------------------------------- ### Initialize and use custom importer Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/loaders/make-a-custom-file-system-importer.md Instantiate the custom `PyArrowAzureBlobImporter` with necessary parameters and call the `translate()` method to import data. Ensure to provide Azure account credentials. ```python importer = PyArrowAzureBlobImporter( container_name="test" file_extension_enum=PyArrowFileTypeEnum.Parquet, data_configuration=parsed_yaml, account_name="your_account_name", account_key="your_account_key", ) importer.translate(drop_database_on_start=True) ``` -------------------------------- ### with_ Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/query_builders/declarative_base.md Chains together parts of a query, piping the results from one to be used as starting points or criteria in the next. ```APIDOC ## with_ ### Description Pipes the result from first part of the query for the further use. ### Method Signature ```python def with_( results: Optional[Union[ str, Tuple[str, str], Dict[str, str], List[Union[str, Tuple[str, str]]], Set[Union[str, Tuple[str, str]]], ]] = None ) -> "DeclarativeBase" ``` ### Arguments - `results` - A dictionary mapping variables in the first query with aliases in the second query. ### Returns A `DeclarativeBase` instance for constructing queries. ### Raises - `GQLAlchemyResultQueryTypeError` - Raises an error when the provided argument is of wrong type. - `GQLAlchemyTooLargeTupleInResultQuery` - Raises an error when the given tuple has length larger than 2. ### Example ```python # Python match().node(variable='n').with_('n').execute() # Cypher MATCH (n) WITH n; ``` -------------------------------- ### Connect to Memgraph and SQLite Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/on-disk-storage/on-disk-storage.md Imports necessary classes and establishes connections to both Memgraph and a local SQLite database for property storage. Ensure Memgraph is running. ```python from gqlalchemy import Memgraph, SQLitePropertyDatabase, Node, Field from typing import Optional graphdb = Memgraph() SQLitePropertyDatabase('path-to-my-db.db', graphdb) ``` -------------------------------- ### TableToGraphImporter translate Method Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Performs the translation of table data to graph data. Can optionally drop the database at the start. ```python def translate(drop_database_on_start: bool = True) -> None ``` -------------------------------- ### Create Relationship with Properties (GQLAlchemy) Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/query-builder.md Use the `create()` method to define nodes and their relationship, including properties. Nodes are created if they don't exist. ```python from gqlalchemy import create query = ( create() .node(labels="Person", name="Leslie") .to(relationship_type="FRIENDS_WITH", since="2023-02-16") .node(labels="Person", name="Ron") .execute() ) ``` -------------------------------- ### Import MemgraphInstanceBinary Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/instance-runner/memgraph-binary-instance.md Import the necessary class for managing Memgraph binary instances. ```python from gqlalchemy.instance_runner import MemgraphInstanceBinary ``` -------------------------------- ### Start a Pulsar Stream Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/streams/pulsar-streams.md Call the start_stream() method with the stream object to begin processing data from the Pulsar topic. ```python db.start_stream(stream) ``` -------------------------------- ### Get a single result Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/query_builders/declarative_base.md Use `get_single` to retrieve a single result from the query based on a specified variable name. ```python def get_single(retrieve: str) -> Any ``` -------------------------------- ### S3FileSystemHandler Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes a connection to an Amazon S3 bucket for data handling. Requires bucket name and optionally accepts S3 credentials and region. ```python def __init__(bucket_name: str, **kwargs) ``` -------------------------------- ### Initialize Local File System Handler Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes a local file system handler with a specified path for data storage. ```python def __init__(path: str) -> None ``` -------------------------------- ### Get all triggers from the database Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/triggers/triggers.md Use the get_triggers() method on the database object to retrieve a list of all currently active triggers. ```python triggers = db.get_triggers() print(triggers) ``` -------------------------------- ### Connect to Memgraph and execute queries Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/index.md Connect to a running Memgraph instance, delete all existing nodes and relationships, create a new node with a label and property, and return the result. Ensure Memgraph is running and accessible at the specified host and port. ```python from gqlalchemy import Memgraph # Make a connection to the database memgraph = Memgraph(host='127.0.0.1', port=7687) # Delete all nodes and relationships query = "MATCH (n) DETACH DELETE n" # Execute the query memgraph.execute(query) # Create a node with the label FirstNode and message property with the value "Hello, World!" query = """CREATE (n:FirstNode) SET n.message = '{message}' RETURN 'Node ' + id(n) + ': ' + n.message AS result""".format(message="Hello, World!") # Execute the query results = memgraph.execute_and_fetch(query) # Print the first member print(list(results)[0]['result']) ``` -------------------------------- ### Create Various Index Types Programmatically Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Demonstrates the creation of different index types including label, label-property, composite, edge, global edge, and point indexes using `MemgraphIndex` and `create_index`. ```python label_index = MemgraphIndex("Person") label_prop_index = MemgraphIndex("Person", "name") label_composite_index = MemgraphIndex("Person", ("name", "age")) edge_type_index = MemgraphIndex("REL", None, index_type="EDGE_INDEX_TYPE") edge_type_property_index = MemgraphIndex("REL", "name", index_type="EDGE_INDEX_TYPE") global_edge_index = MemgraphIndex(None, "name", index_type="EDGE_GLOBAL_INDEX_TYPE") point_index = MemgraphIndex("Person", "year", index_type="POINT_INDEX_TYPE") memgraph.create_index(label_index) memgraph.create_index(label_prop_index) memgraph.create_index(label_composite_index) memgraph.create_index(edge_type_index) memgraph.create_index(edge_type_property_index) memgraph.create_index(global_edge_index) memgraph.create_index(point_index) ``` -------------------------------- ### Import TF-GNN Graph to Memgraph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/translators/import-python-graphs.md Converts a TF-GNN GraphTensor to Cypher queries for Memgraph. Requires TensorFlow GNN installation. ```python import os os.environ["TF_USE_LEGACY_KERAS"] = "1" # Required for TensorFlow 2.16+ import tensorflow as tf import tensorflow_gnn as tfgnn from gqlalchemy import Memgraph from gqlalchemy.transformations.translators.tfgnn_translator import TFGNNTranslator memgraph = Memgraph() memgraph.drop_database() # Create a TF-GNN GraphTensor graph_tensor = tfgnn.GraphTensor.from_pieces( node_sets={ "user": tfgnn.NodeSet.from_fields( sizes=[3], features={ "name": tf.constant(["Alice", "Bob", "Charlie"]), "age": tf.constant([25, 30, 35], dtype=tf.int64), } ), "movie": tfgnn.NodeSet.from_fields( sizes=[2], features={ "title": tf.constant(["Inception", "Matrix"]), "rating": tf.constant([8.8, 8.7], dtype=tf.float32), } ), }, edge_sets={ "LIKES": tfgnn.EdgeSet.from_fields( sizes=[3], adjacency=tfgnn.Adjacency.from_indices( source=("user", tf.constant([0, 0, 1])), target=("movie", tf.constant([0, 1, 0])), ), features={ "score": tf.constant([5, 4, 5], dtype=tf.int64), } ), }, ) translator = TFGNNTranslator() for query in translator.to_cypher_queries(graph_tensor): memgraph.execute(query) ``` -------------------------------- ### Create Relationship Between Existing Nodes (GQLAlchemy) Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/query-builder.md First match existing nodes using `match()` and then create a relationship between them using `create()`. Requires `match` and `create` imports. ```python from gqlalchemy import create, match query = ( match() .node(labels="Person", name="Leslie", variable="leslie") .match() .node(labels="Person", name="Ron", variable="ron") create() .node(variable="leslie") .to(relationship_type="FRIENDS_WITH") .node(variable="ron") .execute() ) ``` -------------------------------- ### load_relationship Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/database_client.md Loads a relationship from the database. It can find relationships by internal ID, or by matching start node, end node, and properties. ```APIDOC ## load_relationship ### Description Returns a relationship loaded from the database. If the relationship._id is not None, it fetches the relationship from the database that has the same internal id. Otherwise it returns the relationship whose relationship._start_node_id and relationship._end_node_id and all relationship properties that are not None match the relationship in the database. If there is no relationship like that in database, or if there are multiple relationships like that in database, throws GQLAlchemyError. ### Signature ```python @abstractmethod def load_relationship(relationship: Relationship) -> Optional[Relationship] ``` ### Parameters * **relationship** (Relationship) - The Relationship object used as a template for loading. ### Returns * Optional[Relationship] - The loaded Relationship object, or None if no matching relationship is found. ``` -------------------------------- ### Import necessary classes from GQLAlchemy Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/instance-runner/memgraph-docker-instance.md Import the DockerImage and MemgraphInstanceDocker classes for managing Memgraph Docker instances. ```python from gqlalchemy.instance_runner import ( DockerImage, MemgraphInstanceDocker ) ``` -------------------------------- ### Get or Create Node in Memgraph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/models.md Retrieves a node from Memgraph if it exists, or creates it if it does not. Returns the node and a boolean indicating if it was created. ```python def get_or_create(db: "Database") -> Tuple["Node", bool]: ``` -------------------------------- ### Connect to Neo4j Database Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Instantiate a Neo4j database connection using provided credentials. ```python db = Neo4j(host="localhost", port="7687", username="neo4j", password="test") ``` -------------------------------- ### Configure Memgraph Instance with Flags Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/instance-runner/memgraph-binary-instance.md Pass configuration flags to the Memgraph instance during initialization using a dictionary. ```python config={"--log-level": "TRACE"} memgraph_instance = MemgraphInstanceBinary(config=config) ``` -------------------------------- ### Get Local File Path Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Retrieves the file path within the local file system for a given collection name. ```python def get_path(collection_name: str) -> str ``` -------------------------------- ### Merge Relationship Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Merge a relationship by attempting to load it first. If the relationship does not exist between the specified start and end nodes, it is created and saved. ```python try: speaks = Speaks(_start_node_id=streamer._id, _end_node_id=language._id).load(db) except: print("Creating new Speaks relationship in the database.") speaks = Speaks( _start_node_id=streamer._id, _end_node_id=language._id, since="2023-02-20", ).save(db) ``` -------------------------------- ### Get Created Indexes Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md After defining indexes in your model classes, you can retrieve a list of all created indexes in the database using the `get_indexes()` method. ```python print(db.get_indexes()) ``` -------------------------------- ### AzureBlobFileSystemHandler Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes a connection to an Azure Blob container. Requires container name and accepts Azure account credentials or a SAS token. ```python def __init__(container_name: str, **kwargs) -> None ``` -------------------------------- ### Get or Create Relationship in Memgraph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/models.md Retrieves a relationship from Memgraph if it exists, or creates it if it does not. Returns the relationship object and a boolean indicating if it was created. ```python def get_or_create(db: "Database") -> Tuple["Relationship", bool] ``` -------------------------------- ### FeatherAzureBlobFileSystemImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the FeatherAzureBlobFileSystemImporter for reading Feather/IPC/Arrow files from Azure Blob storage. Requires container name and data configuration. ```python class FeatherAzureBlobFileSystemImporter(PyArrowAzureBlobImporter) def __init__(container_name, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None, **kwargs) -> None ``` -------------------------------- ### Get QueryModule Arguments for Call Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/graph_algorithms/query_modules.md Retrieves argument values formatted for the QueryBuilder call() method. Raises KeyError if any arguments are not set. ```python def get_arguments_for_call() -> str ``` -------------------------------- ### OnDiskPropertyDatabase Methods Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/disk_storage.md Abstract methods for saving, loading, and deleting node and relationship properties from disk, as well as dropping the entire database. ```APIDOC ## OnDiskPropertyDatabase An abstract class for implementing on-disk storage features with specific databases. ### Methods #### save_node_property ```python def save_node_property(node_id: int, property_name: str, property_value: str) -> None ``` Saves a node property to an on disk database. #### load_node_property ```python def load_node_property(node_id: int, property_name: str, property_value: str) -> Optional[str] ``` Loads a node property from an on disk database. #### delete_node_property ```python def delete_node_property(node_id: int, property_name: str, property_value: str) -> None ``` Deletes a node property from an on disk database. #### save_relationship_property ```python def save_relationship_property(relationship_id: int, property_name: str, property_value: str) -> None ``` Saves a relationship property to an on disk database. #### load_relationship_property ```python def load_relationship_property(relationship_id: int, property_name: str, property_value: str) -> Optional[str] ``` Loads a relationship property from an on disk database. #### delete_relationship_property ```python def delete_relationship_property(node_id: int, property_name: str, property_value: str) -> None ``` Deletes a node property from an on disk database. #### drop_database ```python def drop_database() -> None ``` Deletes all entries from the on disk database. ``` -------------------------------- ### load_relationship_with_start_node_id_and_end_node_id Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/database_client.md Loads a relationship from the database using the start node and end node IDs. It matches relationships where all non-None properties of the relationship match. ```APIDOC ## load_relationship_with_start_node_id_and_end_node_id ### Description Loads a relationship from the database using start node and end node id for which all properties of the relationship that are not None match. ### Signature ```python def load_relationship_with_start_node_id_and_end_node_id(relationship: Relationship) -> Optional[Relationship] ``` ``` -------------------------------- ### Initialize Azure Blob File System Importer Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/loaders/import-table-data-to-graph-database.md Instantiate the ParquetAzureBlobFileSystemImporter to connect to Azure Blob storage for data import. Ensure you provide the container name, data configuration, account name, and account key. ```python importer = ParquetAzureBlobFileSystemImporter( container_name="test", data_configuration=parsed_yaml, account_name="your_account_name", account_key="your_account_key", ) ``` -------------------------------- ### Import GQLAlchemy Classes Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Import necessary classes from the gqlalchemy library for OGM operations. ```python from gqlalchemy import Memgraph, Node, Relationship ``` -------------------------------- ### PyArrowLocalFileSystemImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the PyArrowLocalFileSystemImporter for reading data from the local file system. Requires the path to the directory, file extension enum, and data configuration. ```python def __init__(path: str, file_extension_enum: PyArrowFileTypeEnum, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None) -> None ``` -------------------------------- ### get_procedures Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/memgraph.md Retrieves a list of query procedures available in Memgraph. It can filter procedures by a starting string and optionally update the internal list of query modules. ```APIDOC ## get_procedures ### Description Return query procedures. Maintains a list of query modules in the Memgraph object. If starts_with is defined then return those modules that start with starts_with string. ### Method Signature ```python def get_procedures(starts_with: Optional[str] = None, update: bool = False) -> List["QueryModule"] ``` ### Parameters #### Query Parameters - **starts_with** (Optional[str]) - Optional - Return those modules that start with this string. - **update** (bool) - Optional - Whether to update the list of modules in self.query_modules. ``` -------------------------------- ### FeatherLocalFileSystemImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the FeatherLocalFileSystemImporter for reading Feather/IPC/Arrow files from the local file system. Requires the file path and data configuration. ```python class FeatherLocalFileSystemImporter(PyArrowLocalFileSystemImporter) def __init__(path: str, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None) -> None ``` -------------------------------- ### DeclarativeBase create method Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/query_builders/declarative_base.md Create nodes and relationships in a graph. Use this to add new data to the database. ```python def create() -> "DeclarativeBase": ``` ```python create().node(labels='Person', variable='p').return_(results='p').execute() ``` ```cypher CREATE (p:Person) RETURN p; ``` -------------------------------- ### WeightedShortestPath Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md Initializes a Weighted Shortest Path algorithm instance. Specify upper bound, filter condition, total weight variable, and the property to use as weight. ```python def __init__(upper_bound: int = None, condition: str = None, total_weight_var: str = DEFAULT_TOTAL_WEIGHT, weight_property: str = DEFAULT_WEIGHT_PROPERTY) -> None ``` -------------------------------- ### Delete Statistics for Specific Labels Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/manage-database.md Delete graph statistics for only specific labels. This allows for granular control over which statistics are removed. Ensure GQLAlchemy is installed and Memgraph is running. ```python from gqlalchemy import Memgraph db = Memgraph() deleted = db.delete_graph_statistics(labels=["Person"]) for item in deleted: print(item) ``` -------------------------------- ### Save Initial Nodes Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Save initial node instances to the database. This is a prerequisite for loading them later or creating relationships between them. ```python jane = Streamer(id="2", username="janedoe", followers=111).save(db) language = Language(name="en").save(db) ``` -------------------------------- ### Analyze Specific Graph Labels Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/manage-database.md Analyze statistics for only specific labels within the graph. This is useful for targeted performance tuning. Ensure GQLAlchemy is installed and Memgraph is running. ```python from gqlalchemy import Memgraph db = Memgraph() results = db.analyze_graph(labels=["Person", "City"]) for result in results: print(result) ``` -------------------------------- ### Get Node Properties from PyG Graph Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/translators/pyg_translator.md Extracts properties for a specific node from a heterogeneous PyG graph using its label and ID. Requires a reference to the PyG graph. ```python @classmethod def get_node_properties(cls, graph, node_label: str, node_id: int) ``` -------------------------------- ### TableToGraphImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the TableToGraphImporter with a DataLoader, data configuration, and an optional Memgraph connection. ```python def __init__(data_loader: DataLoader, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None) -> None ``` -------------------------------- ### ORCLocalFileSystemImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the ORCLocalFileSystemImporter for reading ORC files from the local file system. Requires the file path and data configuration. ```python class ORCLocalFileSystemImporter(PyArrowLocalFileSystemImporter) def __init__(path: str, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None) -> None ``` -------------------------------- ### ParquetAzureBlobFileSystemImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the ParquetAzureBlobFileSystemImporter for reading Parquet files from an Azure Blob container. Requires the container name and data configuration. ```python def __init__(container_name: str, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None, **kwargs) -> None ``` -------------------------------- ### Load Relationship from Neo4j Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/vendors/neo4j.md Loads a relationship from the Neo4j database. Matches by internal ID, or by start node, end node, and properties. Throws GQLAlchemyError if no unique match is found. ```python def load_relationship(relationship: Relationship) -> Optional[Relationship] ``` -------------------------------- ### Filter Data with AND and NOT Clauses (GQLAlchemy) Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/query-builder.md Combine multiple conditions using `and_where()` and `and_not_where()` for complex filtering. This example finds persons with matching addresses and last names, but different names. ```python from gqlalchemy import match from gqlalchemy.query_builders.memgraph_query_builder import Operator results = list( match() .node(labels="Person", variable="p1") .to(relationship_type="FRIENDS_WITH") .node(labels="Person", variable="p2") .where(item="p1.address", operator=Operator.EQUAL, expression="p2.address") .and_where(item="p1.last_name", operator=Operator.EQUAL, expression="p2.last_name") .and_not_where(item="p1.name", operator=Operator.EQUAL, expression="p2.name") .return_() .execute() ) print(results) ``` ```cypher MATCH (p1:Person)-[:FRIENDS_WITH]->(p2:Person) WHERE p1.address = p2.address AND p1.last_name = p2.last_name AND NOT p1.name = p2.name RETURN *; ``` -------------------------------- ### Create Indexes Programmatically with MemgraphIndex Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/how-to-guides/ogm.md Instantiate `MemgraphIndex` to create label and label-property indexes programmatically. The `create_index` method on the `Memgraph` instance is then used to apply these indexes. ```python from gqlalchemy import Memgraph from gqlalchemy.models import MemgraphIndex db = Memgraph() index1 = MemgraphIndex("NodeOne") index2 = MemgraphIndex("NodeOne", "name") db.create_index(index1) db.create_index(index2) ``` -------------------------------- ### ParquetLocalFileSystemImporter Initialization Source: https://github.com/memgraph/gqlalchemy/blob/main/docs/reference/gqlalchemy/transformations/importing/loaders.md Initializes the ParquetLocalFileSystemImporter for reading Parquet files from the local file system. Requires the file path and data configuration. ```python class ParquetLocalFileSystemImporter(PyArrowLocalFileSystemImporter) def __init__(path: str, data_configuration: Dict[str, Any], memgraph: Optional[Memgraph] = None) -> None ```