[英]Adding packages to memgraph transformation
我正在 python 中編寫 memgraph 轉換。
當我導入諸如“requests”或 .networkx 之類的模塊時,轉換會按預期進行。
我有帶有模式注冊表的 avro 數據,所以我需要反序列化它。 我在這里遵循了 memgraph 示例: https://memgraph.com/docs/memgraph/2.3.0/import-data/kafka/avro#deserialization
當我用這些導入保存轉換時,我收到錯誤:
[Error] Unable to load module "/memgraph/internal_modules/test_try_plz.py";
Traceback (most recent call last): File "/memgraph/internal_modules/test_try_plz.py", line 4,
in <module> from confluent_kafka.schema_registry import SchemaRegistryClient ModuleNotFoundError:
No module named 'confluent_kafka' . For more details, visit https://memgr.ph/modules.
如何更新我的 transform 或 memgraph 實例以包含 confluent_kafka 模塊?
答案中提供的鏈接沒有提供任何線索,至少對我而言是這樣。
您不能將 python 依賴項添加到 memgraph 雲中的 memgraph(至少免費試用..)
相反,創建您自己的 docker 圖像並使用它,例如,
FROM memgraph/memgraph:2.5.2
USER root
# Install Python
RUN apt-get update && apt-get install -y \
python3-pip \
python3-setuptools \
python3-dev \
&& pip3 install -U pip
# Install pip packages
COPY requirements.txt ./
RUN pip3 install -r requirements.txt
# Copy the local query modules
COPY transformations/ /usr/lib/memgraph/query_modules
COPY procedures/ /usr/lib/memgraph/query_modules
USER memgraph
還有我的 requirements.txt,所有這些都是利用 confluent schema-registry/avro 包進行轉換所必需的:
confluent_kafka==2.0.2
fastavro==1.7.1
requests==2.28.2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.