Clean up db.py
This commit is contained in:
parent
3ae90db4a8
commit
3a99a14a0a
@ -1,26 +1,9 @@
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from . import db
|
from . import store
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
|
|
||||||
# Calling code will build up a large DAG then at the very last step, call
|
|
||||||
# nancy.save_data(). Only at that point will we determine where to save the
|
|
||||||
# data by asking the user for an output dir. However, we need a database
|
|
||||||
# initialized in order to build up the DAG in the first place, so here we
|
|
||||||
# initialize an in-memory database to use until we have an output directory.
|
|
||||||
_conn = db.init(":memory:")
|
|
||||||
|
|
||||||
|
|
||||||
def persist_db(dbpath):
|
|
||||||
global _conn
|
|
||||||
|
|
||||||
dst_conn = sqlite3.connect(dbpath)
|
|
||||||
_conn.backup(dst_conn)
|
|
||||||
_conn.close()
|
|
||||||
_conn = dst_conn
|
|
||||||
|
|
||||||
|
|
||||||
def save_data(
|
def save_data(
|
||||||
destination_mapping,
|
destination_mapping,
|
||||||
desc=f"Provenance-tracking with nancy v{__version__}",
|
desc=f"Provenance-tracking with nancy v{__version__}",
|
||||||
|
|||||||
@ -3,7 +3,9 @@ import os
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
|
|
||||||
schema_version = 2
|
# This matches the recorded user_version in any nancy.db initialized in this
|
||||||
|
# process.
|
||||||
|
schema_version = 0
|
||||||
|
|
||||||
|
|
||||||
def init(path):
|
def init(path):
|
||||||
|
|||||||
@ -1 +1,4 @@
|
|||||||
__version__ = "0.0.1pre"
|
from .db import schema_version
|
||||||
|
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user