Code Monkey home page Code Monkey logo

Comments (2)

abondar avatar abondar commented on July 23, 2024

Hi!

I am not sure, but if understand correct - we already support that:

You can see example at
https://github.com/tortoise/tortoise-orm/blob/develop/examples/relations_recursive.py#L24

Please write if I am wrong on what's issue

from tortoise-orm.

laggron42 avatar laggron42 commented on July 23, 2024

Hi, thanks for your response!

The example you linked shows recursdive relations, but they're not symmetrical. talks_to and gets_talked_to are two different sets despite being the same relation, if it's symmetrical then both sets should be identical.

Once again, I like the example of "If X is my friend, then I am the friend of X". If talks_to was symmetrical, this would work:

>>> await _1.talks_to.add(_2, _1_1_1, loose)
>>> await _1.talks_to.all()
[<Employee: 4>, <Employee: 6>, <Employee: 2>]
>>> await _2.talks_to.all()  # right now this returns an empty list
[<Employee: 3>]

from tortoise-orm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.