(self, args, entities_collection)
| 1837 | return _adapt_clause |
| 1838 | |
| 1839 | def _join(self, args, entities_collection): |
| 1840 | for right, onclause, from_, flags in args: |
| 1841 | isouter = flags["isouter"] |
| 1842 | full = flags["full"] |
| 1843 | |
| 1844 | right = inspect(right) |
| 1845 | if onclause is not None: |
| 1846 | onclause = inspect(onclause) |
| 1847 | |
| 1848 | if isinstance(right, interfaces.PropComparator): |
| 1849 | if onclause is not None: |
| 1850 | raise sa_exc.InvalidRequestError( |
| 1851 | "No 'on clause' argument may be passed when joining " |
| 1852 | "to a relationship path as a target" |
| 1853 | ) |
| 1854 | |
| 1855 | onclause = right |
| 1856 | right = None |
| 1857 | elif "parententity" in right._annotations: |
| 1858 | right = right._annotations["parententity"] |
| 1859 | |
| 1860 | if onclause is None: |
| 1861 | if not right.is_selectable and not hasattr(right, "mapper"): |
| 1862 | raise sa_exc.ArgumentError( |
| 1863 | "Expected mapped entity or " |
| 1864 | "selectable/table as join target" |
| 1865 | ) |
| 1866 | |
| 1867 | if isinstance(onclause, interfaces.PropComparator): |
| 1868 | # descriptor/property given (or determined); this tells us |
| 1869 | # explicitly what the expected "left" side of the join is. |
| 1870 | |
| 1871 | of_type = getattr(onclause, "_of_type", None) |
| 1872 | |
| 1873 | if right is None: |
| 1874 | if of_type: |
| 1875 | right = of_type |
| 1876 | else: |
| 1877 | right = onclause.property |
| 1878 | |
| 1879 | try: |
| 1880 | right = right.entity |
| 1881 | except AttributeError as err: |
| 1882 | raise sa_exc.ArgumentError( |
| 1883 | "Join target %s does not refer to a " |
| 1884 | "mapped entity" % right |
| 1885 | ) from err |
| 1886 | |
| 1887 | left = onclause._parententity |
| 1888 | |
| 1889 | prop = onclause.property |
| 1890 | if not isinstance(onclause, attributes.QueryableAttribute): |
| 1891 | onclause = prop |
| 1892 | |
| 1893 | # check for this path already present. don't render in that |
| 1894 | # case. |
| 1895 | if (left, right, prop.key) in self._already_joined_edges: |
| 1896 | continue |
no test coverage detected