(self, args, entities_collection)
| 1905 | return _adapt_clause |
| 1906 | |
| 1907 | def _join(self, args, entities_collection): |
| 1908 | for right, onclause, from_, flags in args: |
| 1909 | isouter = flags["isouter"] |
| 1910 | full = flags["full"] |
| 1911 | |
| 1912 | right = inspect(right) |
| 1913 | if onclause is not None: |
| 1914 | onclause = inspect(onclause) |
| 1915 | |
| 1916 | if isinstance(right, interfaces.PropComparator): |
| 1917 | if onclause is not None: |
| 1918 | raise sa_exc.InvalidRequestError( |
| 1919 | "No 'on clause' argument may be passed when joining " |
| 1920 | "to a relationship path as a target" |
| 1921 | ) |
| 1922 | |
| 1923 | onclause = right |
| 1924 | right = None |
| 1925 | elif "parententity" in right._annotations: |
| 1926 | right = right._annotations["parententity"] |
| 1927 | |
| 1928 | if onclause is None: |
| 1929 | if not right.is_selectable and not hasattr(right, "mapper"): |
| 1930 | raise sa_exc.ArgumentError( |
| 1931 | "Expected mapped entity or " |
| 1932 | "selectable/table as join target" |
| 1933 | ) |
| 1934 | |
| 1935 | if isinstance(onclause, interfaces.PropComparator): |
| 1936 | # descriptor/property given (or determined); this tells us |
| 1937 | # explicitly what the expected "left" side of the join is. |
| 1938 | |
| 1939 | of_type = getattr(onclause, "_of_type", None) |
| 1940 | |
| 1941 | if right is None: |
| 1942 | if of_type: |
| 1943 | right = of_type |
| 1944 | else: |
| 1945 | right = onclause.property |
| 1946 | |
| 1947 | try: |
| 1948 | right = right.entity |
| 1949 | except AttributeError as err: |
| 1950 | raise sa_exc.ArgumentError( |
| 1951 | "Join target %s does not refer to a " |
| 1952 | "mapped entity" % right |
| 1953 | ) from err |
| 1954 | |
| 1955 | left = onclause._parententity |
| 1956 | |
| 1957 | prop = onclause.property |
| 1958 | if not isinstance(onclause, attributes.QueryableAttribute): |
| 1959 | onclause = prop |
| 1960 | |
| 1961 | # check for this path already present. don't render in that |
| 1962 | # case. |
| 1963 | if (left, right, prop.key) in self._already_joined_edges: |
| 1964 | continue |
no test coverage detected