# Path: multiscanner/config.py
# CONFIG = determine_configuration_path(None)


import codecs
import configparser
import json
import os
from contextlib import contextmanager
from datetime import datetime
from datatables import ColumnDT, DataTables
from sqlalchemy import (Column, DateTime, Integer, String, and_, create_engine,
                        func)
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import aliased, sessionmaker
from sqlalchemy_utils import create_database, database_exists
from multiscanner import CONFIG
            for key_ in config:
                config_from_file[key_] = config[key_]
        self.config = config_from_file

    def _rewrite_config(self, config_parser, configfile, usr_override_config):
        """
        Regenerates the Database-specific part of the API config file
        """
        if os.path.isfile(configfile):
            # Read in the old config
            config_parser.read(configfile)
        if not config_parser.has_section(self.__class__.__name__):
            config_parser.add_section(self.__class__.__name__)
        if not usr_override_config:
            usr_override_config = self.DEFAULTCONF
        # Update config
        for key_ in usr_override_config:
            config_parser.set(self.__class__.__name__, key_, str(usr_override_config[key_]))

        with codecs.open(configfile, 'w', 'utf-8') as conffile:
            config_parser.write(conffile)

    def init_db(self):
        """
        Initializes the database connection based on the configuration parameters
        """
        db_type = self.config['db_type']
        db_name = self.config['db_name']
        if db_type == 'sqlite':
            # we can ignore host, username, password, etc

# Path: multiscanner/config.py
# CONFIG = determine_configuration_path(None)


# Path: multiscanner/storage/sql_driver.py
import codecs
import configparser
import json
import os
from contextlib import contextmanager
from datetime import datetime
from datatables import ColumnDT, DataTables
from sqlalchemy import (Column, DateTime, Integer, String, and_, create_engine,
                        func)
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import aliased, sessionmaker
from sqlalchemy_utils import create_database, database_exists
from multiscanner import CONFIG

            for key_ in config:
                config_from_file[key_] = config[key_]
        self.config = config_from_file

    def _rewrite_config(self, config_parser, configfile, usr_override_config):
        """
        Regenerates the Database-specific part of the API config file
        """
        if os.path.isfile(configfile):
            # Read in the old config
            config_parser.read(configfile)
        if not config_parser.has_section(self.__class__.__name__):
            config_parser.add_section(self.__class__.__name__)
        if not usr_override_config:
            usr_override_config = self.DEFAULTCONF
        # Update config
        for key_ in usr_override_config:
            config_parser.set(self.__class__.__name__, key_, str(usr_override_config[key_]))

        with codecs.open(configfile, 'w', 'utf-8') as conffile:
            config_parser.write(conffile)

    def init_db(self):
        """
        Initializes the database connection based on the configuration parameters
        """
        db_type = self.config['db_type']
        db_name = self.config['db_name']
        if db_type == 'sqlite':
            # we can ignore host, username, password, etc

            sql_lite_db_path = os.path.join(os.path.split(CONFIG)[0], db_name)