Resolves to and from column names and table names. Produces on_clause. Performs actual join updating select_from parameter. Adds aliases of required column to list of columns to include in query. Updates the used aliases list directly. Process or
(self)
| 278 | return new_part |
| 279 | |
| 280 | def _process_join(self) -> None: # noqa: CFQ002 |
| 281 | """ |
| 282 | Resolves to and from column names and table names. |
| 283 | |
| 284 | Produces on_clause. |
| 285 | |
| 286 | Performs actual join updating select_from parameter. |
| 287 | |
| 288 | Adds aliases of required column to list of columns to include in query. |
| 289 | |
| 290 | Updates the used aliases list directly. |
| 291 | |
| 292 | Process order_by causes for non m2m relations. |
| 293 | |
| 294 | """ |
| 295 | to_key, from_key = self._get_to_and_from_keys() |
| 296 | |
| 297 | on_clause = self._on_clause( |
| 298 | previous_alias=self.own_alias, |
| 299 | from_table_name=self.target_field.owner.ormar_config.tablename, |
| 300 | from_column_name=from_key, |
| 301 | to_table_name=self.to_table.name, |
| 302 | to_column_name=to_key, |
| 303 | ) |
| 304 | target_table = self.alias_manager.prefixed_table_name( |
| 305 | self.next_alias, self.to_table |
| 306 | ) |
| 307 | self.select_from = sqlalchemy.sql.outerjoin( |
| 308 | self.select_from, # type: ignore |
| 309 | target_table, |
| 310 | on_clause, |
| 311 | ) |
| 312 | |
| 313 | self._get_order_bys() |
| 314 | |
| 315 | self_related_fields = self.next_model.own_table_columns( |
| 316 | model=self.next_model, |
| 317 | excludable=self.excludable, |
| 318 | alias=self.next_alias, |
| 319 | use_alias=True, |
| 320 | ) |
| 321 | self.columns.extend( |
| 322 | self.alias_manager.prefixed_columns( # type: ignore |
| 323 | self.next_alias, |
| 324 | target_table, # type: ignore |
| 325 | self_related_fields, |
| 326 | ) |
| 327 | ) |
| 328 | self.used_aliases.append(self.next_alias) |
| 329 | |
| 330 | def _set_default_primary_key_order_by(self) -> None: |
| 331 | for order_by in self.next_model.ormar_config.orders_by: |
no test coverage detected