Skip to content

[BUG] #4635

@theKingEpic

Description

@theKingEpic

from neo4j import GraphDatabase
import time

def execute_query(query_string: str:
"""
简单执行 Cypher 查询并显示结果

Args:
    query_string: 完整的 Cypher 查询字符串(包含具体参数值)
    connection_uri: Neo4j 连接 URI
"""
 connection_uri: str = "neo4j://127.0.0.1:7687"
driver = GraphDatabase.driver(connection_uri)

try:
    with driver.session() as session:
        print("执行查询:")
        print("-" * 50)
        print(query_string)
        print("-" * 50)

        start_time = time.time()
        result = session.run(query_string)
        execution_time = time.time() - start_time

        # 显示结果
        records = list(result)
        print(f"查询完成,耗时: {execution_time:.4f}秒")
        print(f"返回结果数: {len(records)}条")

        if records:
            print("\n结果:")
            for i, record in enumerate(records):
                print(f"记录 {i+1}: {dict(record)}")
        else:
            print("无结果返回")

except Exception as e:
    print(f"查询执行失败: {e}")
finally:
    driver.close()

通过此连接执行LDBC SNB测试查询,报错语法错误

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions