From ca5c45983ece4b043986a60f8cb4c3918536fced Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Wed, 12 Jan 2022 09:44:49 +0100 Subject: [PATCH 1/2] Port to GQLAlchemy 1.1 --- backend/python/requirements.txt | 4 ++-- memgraph/README.md | 5 +++++ memgraph/queries/create_stream.cypher | 2 +- memgraph/query_modules/{kafka.py => kafka_stream.py} | 0 4 files changed, 8 insertions(+), 3 deletions(-) rename memgraph/query_modules/{kafka.py => kafka_stream.py} (100%) diff --git a/backend/python/requirements.txt b/backend/python/requirements.txt index 69510ed..119bb73 100644 --- a/backend/python/requirements.txt +++ b/backend/python/requirements.txt @@ -1,2 +1,2 @@ -kafka-python -gqlalchemy +kafka-python==2.0.2 +gqlalchemy==1.0.8 diff --git a/memgraph/README.md b/memgraph/README.md index 26dcbfd..2f3e1c5 100644 --- a/memgraph/README.md +++ b/memgraph/README.md @@ -10,3 +10,8 @@ creates required indexes, constraints, and triggers. ```bash bash run.sh memgraph ``` + +## NOTES + +Memgraph transform script inside `query_modules` can NOT be called `kafka.py` +because of a conflict with the `KAFKA` clause. diff --git a/memgraph/queries/create_stream.cypher b/memgraph/queries/create_stream.cypher index deeea17..17c57f9 100644 --- a/memgraph/queries/create_stream.cypher +++ b/memgraph/queries/create_stream.cypher @@ -1 +1 @@ -CREATE STREAM kafkaStream TOPICS topic TRANSFORM kafka.transform; +CREATE KAFKA STREAM kafkaStream TOPICS topic TRANSFORM kafka_stream.transform; diff --git a/memgraph/query_modules/kafka.py b/memgraph/query_modules/kafka_stream.py similarity index 100% rename from memgraph/query_modules/kafka.py rename to memgraph/query_modules/kafka_stream.py From c893143881933d21eb6eba2207ec49622542db80 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Wed, 12 Jan 2022 14:20:48 +0100 Subject: [PATCH 2/2] Add placeholder for gqlalchmey based init --- backend/python/requirements.txt | 2 +- memgraph/gqlalchmey/main.py | 4 ++++ memgraph/gqlalchmey/requirements.txt | 1 + memgraph/run.sh | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 memgraph/gqlalchmey/main.py create mode 100644 memgraph/gqlalchmey/requirements.txt diff --git a/backend/python/requirements.txt b/backend/python/requirements.txt index 119bb73..3f383ee 100644 --- a/backend/python/requirements.txt +++ b/backend/python/requirements.txt @@ -1,2 +1,2 @@ kafka-python==2.0.2 -gqlalchemy==1.0.8 +git+https://github.com/memgraph/gqlalchemy.git@add-create-stream diff --git a/memgraph/gqlalchmey/main.py b/memgraph/gqlalchmey/main.py new file mode 100644 index 0000000..248c4f4 --- /dev/null +++ b/memgraph/gqlalchmey/main.py @@ -0,0 +1,4 @@ +from gqlalchemy import Memgraph + +if __name__ == "__main__": + pass diff --git a/memgraph/gqlalchmey/requirements.txt b/memgraph/gqlalchmey/requirements.txt new file mode 100644 index 0000000..97a244a --- /dev/null +++ b/memgraph/gqlalchmey/requirements.txt @@ -0,0 +1 @@ +git+https://github.com/memgraph/gqlalchemy.git@add-create-stream diff --git a/memgraph/run.sh b/memgraph/run.sh index 2442661..1eff64f 100755 --- a/memgraph/run.sh +++ b/memgraph/run.sh @@ -11,6 +11,7 @@ script_help_and_exit () { echo " action - takes a filename (excluding the extension) from the" echo " queries directory. The file contains a query that will" echo " be executed in the running Memgraph instance" + echo " init_gqlalchemy - initializes Memgraph using GQLAlchmey" exit 1 } @@ -83,6 +84,10 @@ case "$action" in init ;; + init_gqlalchemy) + python3 gqlalchmey/main.py + ;; + drop) drop ;;