ensure db get before query
This commit is contained in:
parent
6419df8b15
commit
2940ee9055
4 changed files with 18 additions and 10 deletions
|
|
@ -143,8 +143,7 @@ def find_record(path, ensemble, correlator_name, code, project=None, parameters=
|
|||
db = path + '/backlogger.db'
|
||||
if code not in codes:
|
||||
raise ValueError("Code " + code + "unknown, take one of the following:" + ", ".join(codes))
|
||||
if os.path.exists(db):
|
||||
dl.get(db, dataset=path)
|
||||
dl.get(db, dataset=path)
|
||||
results = _db_lookup(db, ensemble, correlator_name,code, project, parameters=parameters, created_before=created_before, created_after=created_after, updated_before=updated_before, updated_after=updated_after, revision=revision)
|
||||
if code == "sfcf":
|
||||
results = sfcf_filter(results, **kwargs)
|
||||
|
|
@ -152,12 +151,14 @@ def find_record(path, ensemble, correlator_name, code, project=None, parameters=
|
|||
return results.reset_index()
|
||||
|
||||
|
||||
def find_project(db, name):
|
||||
def find_project(path, db, name):
|
||||
dl.get(db, dataset=path)
|
||||
return _project_lookup_by_alias(db, name)
|
||||
|
||||
|
||||
def list_projects(path):
|
||||
db = path + '/backlogger.db'
|
||||
dl.get(db, dataset=path)
|
||||
conn = sqlite3.connect(db)
|
||||
c = conn.cursor()
|
||||
c.execute("SELECT id,aliases FROM projects")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue