vaticle / typedb-driver-python

TypeDB Driver for Python
https://typedb.com
Apache License 2.0
67 stars 25 forks source link

Concept get_iid() method returns incorrect IID #262

Closed sjpritchard closed 1 year ago

sjpritchard commented 1 year ago

Description

The concept get_iid() method returns the wrong IID.

Environment

  1. OS (where TypeDB server runs): Ubuntu 22.04 under WSL2
  2. TypeDB version (and platform): TypeDB 2.11.0 on Ubuntu
  3. TypeDB client-python version: typedb-client 2.11.1
  4. Python version: 3.10
  5. Other environment details:

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Insert an object ("catalog")
  2. Extract "catalog" concept from concept map iterator returned by the insert() function
  3. Call get_iid() method on catalog

Expected Output

0x826e80028000000000000029 (obtained by running "match $x isa catalog;" in TypeDB Studio and viewing the log)

Actual Output

0x826e80027fffffffffffffff

Additional information

Could it be related to precision conversion, or unsigned->signed casting?

alexjpwalker commented 1 year ago

@sjpritchard Are you retrieving the IID before committing in typedb_client?

The IID before a commit is different to the one after a commit.

In general, if you want to uniquely identify an object in TypeDB, we'd recommend the usage of a unique key attribute. We advise against using the internal identifier and intend to deprecate it in the future.

sjpritchard commented 1 year ago

Yes, it was retrieved before commit. I've followed your advice and added my own unique key attribute.

alexjpwalker commented 1 year ago

Excellent - marking this issue as resolved