目录
参考 创建药品 节点。
import logging
from utils.neo4j_provider import driver
logging.root.setLevel(logging.INFO)
# 并生成 CQL
def generate_cql() -> str:
cql = """
CREATE (symptom1:Symptom {name: "膝盖疼"}),
(symptom2:Symptom {name: "眼睛酸胀"}),
"""
return cql
# 执行写的命令
def execute_write(cql):
with driver.session() as session:
session.execute_write(execute_cql, cql)
driver.close()
# 执行 CQL 语句
def execute_cql(tx, cql):
tx.run(cql)
# 清除 Symptom 标签数据
def clear_data():
cql = "MATCH (n:Symptom) DETACH DELETE n"
execute_write(cql)
if __name__ == "__main__":
clear_data()
cql = generate_cql()
print(cql)
execute_write(cql)
标签:__,execute,cql,Python,FastAPI,write,def,Neo4j,Symptom
From: https://www.cnblogs.com/vipsoft/p/17699002.html