Append rows fulfilling the condition to the dstTable table. dstTable must be capable of taking the rows resulting from the query, i.e. it must have columns with the expected names and compatible types. The meaning of the other arguments is the same as in the :meth:`T
(
self,
dstTable: Table, # noqa: N803
condition: str | None = None,
condvars: dict[str, Column | np.ndarray] | None = None,
start: str | None = None,
stop: str | None = None,
step: str | None = None,
)
| 1654 | return self.read_coordinates(coords, field) |
| 1655 | |
| 1656 | def append_where( |
| 1657 | self, |
| 1658 | dstTable: Table, # noqa: N803 |
| 1659 | condition: str | None = None, |
| 1660 | condvars: dict[str, Column | np.ndarray] | None = None, |
| 1661 | start: str | None = None, |
| 1662 | stop: str | None = None, |
| 1663 | step: str | None = None, |
| 1664 | ) -> int: |
| 1665 | """Append rows fulfilling the condition to the dstTable table. |
| 1666 | |
| 1667 | dstTable must be capable of taking the rows resulting from the query, |
| 1668 | i.e. it must have columns with the expected names and compatible |
| 1669 | types. The meaning of the other arguments is the same as in the |
| 1670 | :meth:`Table.where` method. |
| 1671 | |
| 1672 | The number of rows appended to dstTable is returned as a result. |
| 1673 | |
| 1674 | .. versionchanged:: 3.0 |
| 1675 | The *whereAppend* method has been renamed into *append_where*. |
| 1676 | |
| 1677 | """ |
| 1678 | self._g_check_open() |
| 1679 | |
| 1680 | # Check that the destination file is not in read-only mode. |
| 1681 | dstTable._v_file._check_writable() |
| 1682 | |
| 1683 | # Row objects do not support nested columns, so we must iterate |
| 1684 | # over the flat column paths. When rows support nesting, |
| 1685 | # ``self.colnames`` can be directly iterated upon. |
| 1686 | col_names = tuple(col_name for col_name in self.colpathnames) |
| 1687 | dst_row = dstTable.row |
| 1688 | nrows = 0 |
| 1689 | if condition is not None: |
| 1690 | src_rows = self._where(condition, condvars, start, stop, step) |
| 1691 | else: |
| 1692 | src_rows = self.iterrows(start, stop, step) |
| 1693 | for src_row in src_rows: |
| 1694 | for col_name in col_names: |
| 1695 | dst_row[col_name] = src_row[col_name] |
| 1696 | dst_row.append() |
| 1697 | nrows += 1 |
| 1698 | dstTable.flush() |
| 1699 | return nrows |
| 1700 | |
| 1701 | def get_where_list( |
| 1702 | self, |