Return a new `!Composed` interposing the `!joiner` with the `!Composed` items. The `!joiner` must be a `SQL` or a string which will be interpreted as an `SQL`. Example:: >>> fields = sql.Identifier('foo') + sql.Identifier('bar') # a Composed
(self, joiner: SQL | LiteralString)
| 150 | return NotImplemented |
| 151 | |
| 152 | def join(self, joiner: SQL | LiteralString) -> Composed: |
| 153 | """ |
| 154 | Return a new `!Composed` interposing the `!joiner` with the `!Composed` items. |
| 155 | |
| 156 | The `!joiner` must be a `SQL` or a string which will be interpreted as |
| 157 | an `SQL`. |
| 158 | |
| 159 | Example:: |
| 160 | |
| 161 | >>> fields = sql.Identifier('foo') + sql.Identifier('bar') # a Composed |
| 162 | >>> print(fields.join(', ').as_string(conn)) |
| 163 | "foo", "bar" |
| 164 | |
| 165 | """ |
| 166 | if isinstance(joiner, str): |
| 167 | joiner = SQL(joiner) |
| 168 | elif not isinstance(joiner, SQL): |
| 169 | raise TypeError( |
| 170 | "Composed.join() argument must be strings or SQL," |
| 171 | f" got {joiner!r} instead" |
| 172 | ) |
| 173 | |
| 174 | return joiner.join(self._obj) |
| 175 | |
| 176 | |
| 177 | class SQL(Composable): |