# Path: lib/db.py
# DB_VERSION = '2.0'


import os
from os.path import join
from .db import DB_VERSION

    db_name = join(db_dir, 'temp.sqlite.db')

    sql = """ATTACH DATABASE '{}' AS aux""".format(db_name)
    cxn.execute(sql)


def aux_detach(cxn):
    """Detach the temporary database."""
    cxn.execute('DETACH DATABASE aux')


# ########################## metadata table ##################################

def create_metadata_table(cxn, args):
    """
    Create the metadata table.

    Information used to tell how aTRAM was set up.
    """
    cxn.executescript("""
        DROP TABLE IF EXISTS metadata;

        CREATE TABLE metadata (
            label TEXT,
            value TEXT);
        """)

    with cxn:
        sql = """INSERT INTO metadata (label, value) VALUES (?, ?);"""

# Path: lib/db.py
# DB_VERSION = '2.0'


# Path: lib/db_preprocessor.py
import os
from os.path import join
from .db import DB_VERSION


    db_name = join(db_dir, 'temp.sqlite.db')

    sql = """ATTACH DATABASE '{}' AS aux""".format(db_name)
    cxn.execute(sql)


def aux_detach(cxn):
    """Detach the temporary database."""
    cxn.execute('DETACH DATABASE aux')


# ########################## metadata table ##################################

def create_metadata_table(cxn, args):
    """
    Create the metadata table.

    Information used to tell how aTRAM was set up.
    """
    cxn.executescript("""
        DROP TABLE IF EXISTS metadata;

        CREATE TABLE metadata (
            label TEXT,
            value TEXT);
        """)

    with cxn:
        sql = """INSERT INTO metadata (label, value) VALUES (?, ?);"""

        cxn.execute(sql, ('version', DB_VERSION))