Discussion Forum

AttributeError: '_Entity' object has no attribute 'get_value'

The implementation is here: Colab

Ultimately I’m trying to demo TypeDB’s inference capabilities to confirm it’s right for our project.

Before that though I want to show the mother, father, child relationship I created but I’m getting an error trying to access the values.

If there is some detailed documentation on how to get query results in python, please point me to it (something more than what’s here).

Honestly, your code is looking pretty great! We’re also excited to see us being used in Google Colab – is it ok if we keep a link to your colab and reference it in our community of an example of how to run TypeDB, and a client, in one Colab? Happy to credit if we get a name/company as well!

The error is right at the bottom:
db_val = answer.get("father1").get_value()
father1 is only going to represent entity instances, which do not have an get_value() method available on them - only attributes have this method.

The only other thing I’d feedback is that re-opening a client in method is not particularly efficient. It’s more idiomatic to open and store a client for the whole class, or even a session if you know all the methods will be used in proximity to each other, then open a session+transaction or just a transaction.

There’s a couple more example projects here: GitHub - vaticle/typedb-examples: TypeDB Examples Projects and Tutorials

Cheers!

Sure, you can reference my code. You can credit it to Chris Smyth.

I suggest using this one instead. It works and is cleaner:

Thanks!

Did you get it working after those suggestions?