From d51c989cf726b0799183bad85ccb2cc9eeda581e Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Fri, 16 Oct 2015 09:19:34 +0000 Subject: [PATCH] Task #8291: added rootDirectoriesForSite select method --- LTA/ltastorageoverview/lib/store.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LTA/ltastorageoverview/lib/store.py b/LTA/ltastorageoverview/lib/store.py index b954c614436..16a1376f8e9 100644 --- a/LTA/ltastorageoverview/lib/store.py +++ b/LTA/ltastorageoverview/lib/store.py @@ -244,6 +244,14 @@ class LTAStorageDb: join directory dir on dir.id = storage_site_root.directory_id join storage_site site on site.id = storage_site_root.storage_site_id''').fetchall() + def rootDirectoriesForSite(self, site_id): + '''returns list of all root directories (id, name) for given site_id''' + with sqlite3.connect(self.db_filename) as conn: + return conn.execute('''SELECT dir.id, dir.name + FROM storage_site_root + join directory dir on dir.id = storage_site_root.directory_id + where storage_site_root.storage_site_id = ?''', [site_id]).fetchall() + def subDirectories(self, directory_id, depth = 1, includeSelf=False): '''returns list of all sub directories up to the given depth (id, name, site_id, site_name, depth) for the given directory_id''' with sqlite3.connect(self.db_filename) as conn: -- GitLab