From 626ee994bf2e817ca9f6ffb4cb91896836136485 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Tue, 28 Jul 2020 20:33:39 +0100 Subject: [PATCH] twint: open database in read only mode --- my/bluemaestro/__init__.py | 2 ++ my/twitter/twint.py | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/my/bluemaestro/__init__.py b/my/bluemaestro/__init__.py index 882c675..51ac78d 100755 --- a/my/bluemaestro/__init__.py +++ b/my/bluemaestro/__init__.py @@ -123,3 +123,5 @@ def main(): if __name__ == '__main__': main() + +# TODO copy a couble of databases (one old, one new) to my public data repository? diff --git a/my/twitter/twint.py b/my/twitter/twint.py index 1b5c73e..53240eb 100644 --- a/my/twitter/twint.py +++ b/my/twitter/twint.py @@ -91,11 +91,9 @@ ORDER BY T.created_at ''' def _get_db(): - import dataset # type: ignore + from ..core.dataset import connect_readonly db_path = get_db_path() - # TODO check that exists? - db = dataset.connect(f'sqlite:///{db_path}') - return db + return connect_readonly(db_path) def tweets() -> Iterable[Tweet]: