can now read and write simple sfcf measurements
This commit is contained in:
parent
5ec34ad98b
commit
c3aa7577fb
7 changed files with 408 additions and 0 deletions
46
backlogger/initialization.py
Normal file
46
backlogger/initialization.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import sqlite3
|
||||
import datalad.api as dl
|
||||
import os
|
||||
|
||||
|
||||
def _create_db(path):
|
||||
"""
|
||||
Create the database file and the table.
|
||||
|
||||
"""
|
||||
conn = sqlite3.connect(path)
|
||||
c = conn.cursor()
|
||||
c.execute('''CREATE TABLE IF NOT EXISTS backlogs
|
||||
(id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
ensemble TEXT,
|
||||
code TEXT,
|
||||
path TEXT,
|
||||
project TEXT,
|
||||
parameters TEXT,
|
||||
parameter_file TEXT,
|
||||
created_at TEXT,
|
||||
updated_at TEXT)''')
|
||||
c.execute('''CREATE TABLE IF NOT EXISTS projects
|
||||
(id TEXT PRIMARY KEY,
|
||||
aliases TEXT,
|
||||
code TEXT,
|
||||
created_at TEXT,
|
||||
updated_at TEXT)''')
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
|
||||
def create(path):
|
||||
"""
|
||||
Create folder of backlogs.
|
||||
|
||||
"""
|
||||
dl.create(path)
|
||||
_create_db(path + '/backlogger.db')
|
||||
os.chmod(path + '/backlogger.db', 0o666)
|
||||
os.makedirs(path + '/projects')
|
||||
os.makedirs(path + '/projects/tmp')
|
||||
os.makedirs(path + '/archive')
|
||||
os.makedirs(path + '/import_scripts/template.py')
|
||||
dl.save(path, dataset=path, message="Initialize backlogger directory.")
|
Loading…
Add table
Add a link
Reference in a new issue