# Path: memsql_loader/loader_db/jobs.py
# PRIMARY_TABLE = apsw_sql_utility.TableDefinition('jobs', """\
# CREATE TABLE IF NOT EXISTS jobs (
#     id BINARY(32) PRIMARY KEY,
#     created DATETIME NOT NULL,
#     spec TEXT NOT NULL
# )""", index_columns=('created',))
# def hash_64_bit(value):
#     def __init__(self):
#     def save(self, job):
#     def delete(self, job):
#     def get(self, job_id):
#     def all(self):
#     def query_target(self, host, port, database, table):
#     def __init__(self, spec, job_id=None):
#     def json_spec(self):
#     def get_file_id(self, key):
#     def has_file_id(self):
#     def get_files(self, s3_conn=None):
# class Jobs(apsw_sql_utility.APSWSQLUtility):
# class Job(object):
# 
# Path: memsql_loader/loader_db/tasks.py
# class TaskHandler(apsw_sql_step_queue.TaskHandler):
# class Tasks(apsw_sql_step_queue.APSWSQLStepQueue):
#     def __init__(self, *args, **kwargs):
#     def protect(self):
#     def error(self, message):
#     def requeue(self):
#     def __init__(self):
#     def bulk_finish(self, result='cancelled', extra_predicate=None):
#     def get_tasks_in_state(self, state, extra_predicate=None):
# 
# Path: memsql_loader/loader_db/storage.py
# MEMSQL_LOADER_DB = 'memsql_loader.db'
# def get_loader_db_path():
#     def __new__(cls, *args, **kwargs):
#     def drop_database(cls):
#     def fork_wrapper(cls):
#     def __init__(self):
# class LoaderStorage(APSWStorage):
# 
# Path: memsql_loader/util/apsw_helpers.py
# class _NoDefault(object):
# class _RowBase(object):
# class Row(_RowBase):
# class SelectResult(list):
#     def __init__(self, fields, values):
#     def get(self, name, default=_NoDefault):
#     def set(self, name, value):
#     def __getattr__(self, name):
#     def __setattr__(self, name, value):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __contains__(self, name):
#     def __iter__(self):
#     def __len__(self):
#     def keys(self):
#     def values(self):
#     def items(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def as_dict(self):
#     def for_json(self):
#     def nope(self, *args, **kwargs):
#     def __init__(self, fields, rows, is_rows=False, RowClass=Row):
#     def width(self):
#     def __getitem__(self, i):
# def query(cursor, query, *params, **kwparams):
# def get(cursor, query, *params, **kwparams):
# 
# Path: memsql_loader/util/log.py
# def setup(log_path=None, stdout_enabled=True):
# def update_verbosity(debug=False, extra_verbose=False):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
# def configure(parser):
# def get_logger(name, level=None):
#     def format(self, record):
#     def __init__(self, name, level=logging.DEBUG):
# class _SetDebug(argparse.Action):
# class _SetStdout(argparse.Action):
# class _SetLogPath(argparse.Action):
# class Formatter(logging.Formatter):
# class Logger(logging.Logger):


from memsql_loader.loader_db import jobs, tasks
from memsql_loader.loader_db import storage
from memsql_loader.util import apsw_helpers, log

MODELS = { 'jobs': jobs.Jobs, 'tasks': tasks.Tasks }

def check_bootstrapped():
    loader_storage = storage.LoaderStorage()
    with loader_storage.cursor() as cursor:

# Path: memsql_loader/loader_db/jobs.py
# PRIMARY_TABLE = apsw_sql_utility.TableDefinition('jobs', """\
# CREATE TABLE IF NOT EXISTS jobs (
#     id BINARY(32) PRIMARY KEY,
#     created DATETIME NOT NULL,
#     spec TEXT NOT NULL
# )""", index_columns=('created',))
# def hash_64_bit(value):
#     def __init__(self):
#     def save(self, job):
#     def delete(self, job):
#     def get(self, job_id):
#     def all(self):
#     def query_target(self, host, port, database, table):
#     def __init__(self, spec, job_id=None):
#     def json_spec(self):
#     def get_file_id(self, key):
#     def has_file_id(self):
#     def get_files(self, s3_conn=None):
# class Jobs(apsw_sql_utility.APSWSQLUtility):
# class Job(object):
# 
# Path: memsql_loader/loader_db/tasks.py
# class TaskHandler(apsw_sql_step_queue.TaskHandler):
# class Tasks(apsw_sql_step_queue.APSWSQLStepQueue):
#     def __init__(self, *args, **kwargs):
#     def protect(self):
#     def error(self, message):
#     def requeue(self):
#     def __init__(self):
#     def bulk_finish(self, result='cancelled', extra_predicate=None):
#     def get_tasks_in_state(self, state, extra_predicate=None):
# 
# Path: memsql_loader/loader_db/storage.py
# MEMSQL_LOADER_DB = 'memsql_loader.db'
# def get_loader_db_path():
#     def __new__(cls, *args, **kwargs):
#     def drop_database(cls):
#     def fork_wrapper(cls):
#     def __init__(self):
# class LoaderStorage(APSWStorage):
# 
# Path: memsql_loader/util/apsw_helpers.py
# class _NoDefault(object):
# class _RowBase(object):
# class Row(_RowBase):
# class SelectResult(list):
#     def __init__(self, fields, values):
#     def get(self, name, default=_NoDefault):
#     def set(self, name, value):
#     def __getattr__(self, name):
#     def __setattr__(self, name, value):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __contains__(self, name):
#     def __iter__(self):
#     def __len__(self):
#     def keys(self):
#     def values(self):
#     def items(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def as_dict(self):
#     def for_json(self):
#     def nope(self, *args, **kwargs):
#     def __init__(self, fields, rows, is_rows=False, RowClass=Row):
#     def width(self):
#     def __getitem__(self, i):
# def query(cursor, query, *params, **kwparams):
# def get(cursor, query, *params, **kwparams):
# 
# Path: memsql_loader/util/log.py
# def setup(log_path=None, stdout_enabled=True):
# def update_verbosity(debug=False, extra_verbose=False):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
# def configure(parser):
# def get_logger(name, level=None):
#     def format(self, record):
#     def __init__(self, name, level=logging.DEBUG):
# class _SetDebug(argparse.Action):
# class _SetStdout(argparse.Action):
# class _SetLogPath(argparse.Action):
# class Formatter(logging.Formatter):
# class Logger(logging.Logger):


# Path: memsql_loader/util/bootstrap.py
from memsql_loader.loader_db import jobs, tasks
from memsql_loader.loader_db import storage
from memsql_loader.util import apsw_helpers, log


MODELS = { 'jobs': jobs.Jobs, 'tasks': tasks.Tasks }

def check_bootstrapped():
    loader_storage = storage.LoaderStorage()
    with loader_storage.cursor() as cursor:

        rows = apsw_helpers.query(