Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Transaction is_open method throws an exception if called after transaction is committed #685

Open
james-whiteside opened this issue Sep 24, 2024 · 0 comments

Comments

@james-whiteside
Copy link
Contributor

Description

If the is_open method of a TypeDBTransaction is called after the transaction is committed, an exception is thrown instead of returning False. This is not the case if the transaction is instead closed, after which is_open functions as expected.

Environment

  1. TypeDB distribution: Core
  2. TypeDB version: 2.27.0
  3. Environment: MacOS

Reproducible Steps

with TypeDB.core_driver("localhost:1729") as driver:
    with driver.session("test", SessionType.DATA) as session:
        with session.transaction(TransactionType.WRITE) as transaction:
            print(f"Deleting existing data.")
            transaction.query.delete(query="match $x isa $t; delete $x isa $t;").resolve()
            transaction.commit()
            print(transaction.is_open())

Additional information

Traceback (most recent call last):
  File "...", line 51, in <module>
    print(transaction.is_open())
          ^^^^^^^^^^^^^^^^^^^^^
  File ".../typedb/connection/transaction.py", line 80, in is_open
    if not self.native_object.thisown:
           ^^^^^^^^^^^^^^^^^^
  File ".../typedb/common/native_wrapper.py", line 42, in native_object
    raise self._native_object_not_owned_exception
typedb.common.exception.TypeDBDriverException: Driver Error: The transaction has been closed and no further operation is allowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants