aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk/utils/tracking/db/writer
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-06-16 23:32:24 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-06-16 23:32:24 +0300
commiteb930123454771b80465505579d723c92b3dd84c (patch)
tree9aeded9c85edc2ae9c00ae904d252558731d93f7 /vk/utils/tracking/db/writer
parentmake "last seen" timestamps timezone-aware (diff)
downloadvk-scripts-eb930123454771b80465505579d723c92b3dd84c.tar.gz
vk-scripts-eb930123454771b80465505579d723c92b3dd84c.zip
refactoring & support more user fields
And a bunch of other minor improvements.
Diffstat (limited to 'vk/utils/tracking/db/writer')
-rw-r--r--vk/utils/tracking/db/writer/csv.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/vk/utils/tracking/db/writer/csv.py b/vk/utils/tracking/db/writer/csv.py
index 8dc2299..8c635b4 100644
--- a/vk/utils/tracking/db/writer/csv.py
+++ b/vk/utils/tracking/db/writer/csv.py
@@ -36,8 +36,12 @@ class Writer:
def write_record(self, user):
if not self:
return
- self._write_row(Record.from_user(user).to_row())
+ self._write_row(self._record_to_row(Record.from_user(user)))
self.flush()
def _write_row(self, row):
self._writer.writerow(row)
+
+ @staticmethod
+ def _record_to_row(record):
+ return [str(record.get_timestamp())] + [str(record[field]) for field in record]