diff options
author | Frederick Yin <fkfd@fkfd.me> | 2021-10-27 21:51:50 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2021-10-27 21:51:50 +0800 |
commit | e53830b4bf7c0f7b7999860e3a2cdc03a03544c7 (patch) | |
tree | 1d1c89f4714f2f2b3f14ee140688c23c7aeb9432 | |
parent | 328e7891bbdcb4c869112fa44438d8da5ea1ce5e (diff) |
Implement CsvTable._append
-rw-r--r-- | jimbrella/csv_table.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jimbrella/csv_table.py b/jimbrella/csv_table.py index 6f431a7..3c420ff 100644 --- a/jimbrella/csv_table.py +++ b/jimbrella/csv_table.py @@ -86,8 +86,15 @@ class CsvTable: self.lockfile.unlock() + def _append(self, row) -> list: + """Append one row, and return the entire updated table.""" + rows = self._read() + rows.append(row) + self._write(rows) + return rows + def _update(self, update: dict) -> list: - """Update status of one row, and return the entire updated table.""" + """Update one row, and return the entire updated table.""" rows = self._read() index_column = self.schema[0]["name"] for idx, row in enumerate(rows): |