How can I create a Kafka stream directly from Python? I know that I need to use GQLAlchemy but I don’t know the exact commands.
Advertisement
Answer
GQLAlchemy is a fully open-source Python library and Object Graph Mapper (OGM) – a link between graph database objects and Python objects.
An Object Graph Mapper or OGM provides a developer-friendly workflow that allows for writing object-oriented notation to communicate with graph databases. This means that instead of writing Cypher queries, you can write object-oriented code, which the OGM will automatically translate into Cypher queries.
You can use the following code to connect to the Pulsar stream:
from gqlalchemy import MemgraphPulsarStream stream = MemgraphPulsarStream(name="ratings_stream", topics=["ratings"], transform="movielens.rating", service_url="localhost:6650") db.create_stream(stream) db.start_stream(stream)