memgraph / memgraph

Open-source graph database, tuned for dynamic analytics environments. Easy to adopt, scale and own.
https://memgraph.com
Other
2.45k stars 122 forks source link

Some extras fields specified via the python driver are ignored #939

Open andrejtonev opened 1 year ago

andrejtonev commented 1 year ago

Memgraph version 2.7.0

Environment Ran Memgraph locally on Ubuntu 20.04, used python neo4j drivers 4.4.0 and 5.8.0

Describe the bug The user can define a timeout when sending a single query or starting a new transaction. This information gets ignored and the query/transaction runs till completed.

To Reproduce Steps to reproduce the behavior with single queries:

  1. start up memgraph
  2. pip install neo4j
  3. setup script timeout_single_query.py
    
    import neo4j

MEMGRAPH_URL = "bolt://localhost:7687" TIMEOUT_SEC = 0.1

driver = neo4j.GraphDatabase.driver(MEMGRAPH_URL, auth=None)

def single_query(s): try: query = neo4j.Query("...query...", timeout=TIMEOUT_SEC) result = s.run(query) result.values() except: print("Timed out!") return

with driver.session() as session: single_query(session)

4. python3 timeout_single_query.py

Steps to reproduce the behavior with transactions:
1. start up memgraph
2. pip install neo4j
3. setup script timeout_transaction.py

import neo4j

MEMGRAPH_URL = "bolt://localhost:7687" TIMEOUT_SEC = 0.1

driver = neo4j.GraphDatabase.driver(MEMGRAPH_URL, auth=None)

def single_query(tx): result = tx.run("...query...") result.values() return

with driver.session() as session: tx = session.begin_transaction(timeout=TIMEOUT_SEC) try: single_query(tx) tx.commit() except: print("Timed out!")


4. python3 timeout_transaction.py

**Expected behavior**
Query/transaction should abort after the set time and a FAILURE message should be returned.
andrejtonev commented 1 year ago

The issue isn't that only the timeout is being ignored, in fact, the whole extra dictionary is being ignored. Affected Bolt messages: BEGIN RUN

DavIvek commented 4 months ago

Timeout was added in meantime, also metadata field is also supported, but most of the mentioned dictionary fields still aren't supported.