code: def test_nested_joins(self):
      task, Task_Type, Joined, task_type, msg = (
          self.tables.task,
          self.classes.Task_Type,
          self.classes.Joined,
          self.tables.task_type,
          self.tables.msg,
      )
  
      # this is testing some subtle column resolution stuff,
      # concerning corresponding_column() being extremely accurate
      # as well as how mapper sets up its column properties
  
      self.mapper_registry.map_imperatively(Task_Type, task_type)
  
      j = sa.outerjoin(task, msg, task.c.id == msg.c.task_id)
      jj = (
          sa.select(
              task.c.id.label("task_id"),
              sa.func.count(msg.c.id).label("props_cnt"),
          )
          .select_from(j)
          .group_by(task.c.id)
          .alias("prop_c_s")
      )
      jjj = sa.join(task, jj, task.c.id == jj.c.task_id)
  
      self.mapper_registry.map_imperatively(
          Joined,
          jjj,
          properties=dict(type=relationship(Task_Type, lazy="joined")),
      )
  
      session = fixture_session()
  
      eq_(
          session.query(Joined)
          .order_by(Joined.id)
          .limit(10)
          .offset(0)
          .one(),
          Joined(id=1, title="task 1", props_cnt=0),
      )
  
imports: import datetime
  import sqlalchemy
  from sqlalchemy import ForeignKey
  from sqlalchemy import Integer
  from sqlalchemy import String
  from sqlalchemy import testing
  from sqlalchemy import text
  from sqlalchemy.orm import backref
  from sqlalchemy.orm import relationship
  from sqlalchemy.orm import Session
  from sqlalchemy.testing import eq_
  from sqlalchemy.testing import fixtures
  from sqlalchemy.testing.fixtures import fixture_session
  from sqlalchemy.testing.schema import Column
  from sqlalchemy.testing.schema import Table
label_desc: Use image node_id 4 for calling the EagerTest8 obj's underlying member method code with example usage: obj.test_nested_joins() without return types