# Path: freezer_api/db/base.py
# CONF = cfg.CONF
# LOG = log.getLogger(__name__)
#     _OPTS = [
#         cfg.StrOpt('host',
#                    required=True,
#                    default='0.0.0.0',
#                    help="Database host"),
#         cfg.StrOpt("username",
#                    help="Database username"),
#         cfg.StrOpt("password",
#                    help="Database Password")
#     ]
# class DBDriver(metaclass=abc.ABCMeta):
#     def __init__(self, backend, is_created=False):
#     def connect(self):
#     def name(self):
#     def get_instance(self):
# 
# Path: freezer_api/db/sqlalchemy/api.py
# CONF = cfg.CONF
# LOG = log.getLogger(__name__)
# def _get_db_conf(conf_group, connection=None):
# def get_backend():
# def create_context_manager(connection=None):
# def _context_manager_from_context(context):
# def get_context_manager(context):
# def get_engine(use_slave=False, context=None):
# def get_db_session(context=None):
# def get_api_engine():
# def model_query(session, model,
#                 args=None,
#                 read_deleted='no',
#                 project_id=None):
# def delete_tuple(tablename, user_id, tuple_id, project_id=None):
# def get_tuple(tablename, user_id, tuple_id, project_id=None):
# def add_tuple(tuple):
# def update_tuple(tablename, user_id, tuple_id, tuple_values, project_id=None):
# def replace_tuple(tablename, user_id, tuple_id, tuple_values, project_id=None):
# def search_tuple(tablename, user_id, project_id=None, offset=0,
#                  limit=100, search=None):
# def get_recursively(source_dict, search_keys):
# def valid_and_get_search_option(search=None):
# def filter_tuple_by_search_opt(tuples, offset=0, limit=100, search=None):
# def get_client_byid(user_id, client_id, project_id=None):
# def get_client(user_id, project_id=None, client_id=None, offset=0,
#                limit=100, search=None):
# def add_client(user_id, doc, project_id=None):
# def delete_client(user_id, client_id, project_id=None):
# def delete_action(user_id, action_id, project_id=None):
# def add_action(user_id, doc, project_id=None):
# def get_action(user_id, action_id, project_id=None):
# def search_action(user_id, project_id=None, offset=0,
#                   limit=100, search=None):
# def update_action(user_id, action_id, patch_doc, project_id=None):
# def replace_action(user_id, action_id, doc, project_id=None):
# def delete_job(user_id, job_id, project_id=None):
# def add_job(user_id, doc, project_id=None):
# def get_job(user_id, job_id, project_id=None):
# def search_job(user_id, project_id=None, offset=0,
#                limit=100, search=None):
# def update_job(user_id, job_id, patch_doc, project_id=None):
# def replace_job(user_id, job_id, doc, project_id=None):
# def get_backup(user_id, backup_id, project_id=None):
# def add_backup(user_id, user_name, doc, project_id=None):
# def delete_backup(user_id, backup_id, project_id=None):
# def search_backup(user_id, project_id=None, offset=0,
#                   limit=100, search=None):
# def get_session(user_id, session_id, project_id=None):
# def delete_session(user_id, session_id, project_id=None):
# def add_session(user_id, doc, project_id=None):
# def update_session(user_id, session_id, patch_doc, project_id=None):
# def replace_session(user_id, session_id, doc, project_id=None):
# def search_session(user_id, project_id=None, offset=0,
#                    limit=100, search=None):
# 
# Path: freezer_api/db/sqlalchemy/models.py
# BASE = declarative_base()
# class FreezerBase(models.TimestampMixin,
#                   models.ModelBase):
# class Client(BASE, FreezerBase):
# class Action(BASE, FreezerBase):
# class Session(BASE, FreezerBase):
# class Job(BASE, FreezerBase):
# class ActionReport(BASE, FreezerBase):
# class Backup(BASE, FreezerBase):
#     def delete_values():
#     def delete(self, session):
# def register_models(engine):
# def unregister_models(engine):
# def get_tables(engine):


import os
import threading
from stevedore import driver
from oslo_config import cfg
from oslo_db import api as db_api
from oslo_db.sqlalchemy import migration
from oslo_log import log
from freezer_api.db import base as db_base
from freezer_api.db.sqlalchemy import api as db_session
from freezer_api.db.sqlalchemy import models
        return self.IMPL

    def get_backend(self):
        global _IMPL
        if _IMPL is None:
            with _LOCK:
                if _IMPL is None:
                    _IMPL = driver.DriverManager(
                        "freezer.database.migration_backend",
                        cfg.CONF.database.backend).driver
        return _IMPL

    def db_sync(self, version=None, init_version=INIT_VERSION, engine=None):
        """Migrate the database to `version` or the most recent version."""

        if not self._engine:
            self._engine = self.get_engine()
        return migration.db_sync(engine=self._engine,
                                 abs_path=MIGRATE_REPO_PATH,
                                 version=version,
                                 init_version=init_version)

    def db_show(self):
        if not self._engine:
            self._engine = self.get_engine()
        return models.get_tables(self._engine)

    def db_remove(self):
        if not self._engine:
            self._engine = self.get_engine()

# Path: freezer_api/db/base.py
# CONF = cfg.CONF
# LOG = log.getLogger(__name__)
#     _OPTS = [
#         cfg.StrOpt('host',
#                    required=True,
#                    default='0.0.0.0',
#                    help="Database host"),
#         cfg.StrOpt("username",
#                    help="Database username"),
#         cfg.StrOpt("password",
#                    help="Database Password")
#     ]
# class DBDriver(metaclass=abc.ABCMeta):
#     def __init__(self, backend, is_created=False):
#     def connect(self):
#     def name(self):
#     def get_instance(self):
# 
# Path: freezer_api/db/sqlalchemy/api.py
# CONF = cfg.CONF
# LOG = log.getLogger(__name__)
# def _get_db_conf(conf_group, connection=None):
# def get_backend():
# def create_context_manager(connection=None):
# def _context_manager_from_context(context):
# def get_context_manager(context):
# def get_engine(use_slave=False, context=None):
# def get_db_session(context=None):
# def get_api_engine():
# def model_query(session, model,
#                 args=None,
#                 read_deleted='no',
#                 project_id=None):
# def delete_tuple(tablename, user_id, tuple_id, project_id=None):
# def get_tuple(tablename, user_id, tuple_id, project_id=None):
# def add_tuple(tuple):
# def update_tuple(tablename, user_id, tuple_id, tuple_values, project_id=None):
# def replace_tuple(tablename, user_id, tuple_id, tuple_values, project_id=None):
# def search_tuple(tablename, user_id, project_id=None, offset=0,
#                  limit=100, search=None):
# def get_recursively(source_dict, search_keys):
# def valid_and_get_search_option(search=None):
# def filter_tuple_by_search_opt(tuples, offset=0, limit=100, search=None):
# def get_client_byid(user_id, client_id, project_id=None):
# def get_client(user_id, project_id=None, client_id=None, offset=0,
#                limit=100, search=None):
# def add_client(user_id, doc, project_id=None):
# def delete_client(user_id, client_id, project_id=None):
# def delete_action(user_id, action_id, project_id=None):
# def add_action(user_id, doc, project_id=None):
# def get_action(user_id, action_id, project_id=None):
# def search_action(user_id, project_id=None, offset=0,
#                   limit=100, search=None):
# def update_action(user_id, action_id, patch_doc, project_id=None):
# def replace_action(user_id, action_id, doc, project_id=None):
# def delete_job(user_id, job_id, project_id=None):
# def add_job(user_id, doc, project_id=None):
# def get_job(user_id, job_id, project_id=None):
# def search_job(user_id, project_id=None, offset=0,
#                limit=100, search=None):
# def update_job(user_id, job_id, patch_doc, project_id=None):
# def replace_job(user_id, job_id, doc, project_id=None):
# def get_backup(user_id, backup_id, project_id=None):
# def add_backup(user_id, user_name, doc, project_id=None):
# def delete_backup(user_id, backup_id, project_id=None):
# def search_backup(user_id, project_id=None, offset=0,
#                   limit=100, search=None):
# def get_session(user_id, session_id, project_id=None):
# def delete_session(user_id, session_id, project_id=None):
# def add_session(user_id, doc, project_id=None):
# def update_session(user_id, session_id, patch_doc, project_id=None):
# def replace_session(user_id, session_id, doc, project_id=None):
# def search_session(user_id, project_id=None, offset=0,
#                    limit=100, search=None):
# 
# Path: freezer_api/db/sqlalchemy/models.py
# BASE = declarative_base()
# class FreezerBase(models.TimestampMixin,
#                   models.ModelBase):
# class Client(BASE, FreezerBase):
# class Action(BASE, FreezerBase):
# class Session(BASE, FreezerBase):
# class Job(BASE, FreezerBase):
# class ActionReport(BASE, FreezerBase):
# class Backup(BASE, FreezerBase):
#     def delete_values():
#     def delete(self, session):
# def register_models(engine):
# def unregister_models(engine):
# def get_tables(engine):


# Path: freezer_api/db/sqlalchemy/driver.py
import os
import threading
from stevedore import driver
from oslo_config import cfg
from oslo_db import api as db_api
from oslo_db.sqlalchemy import migration
from oslo_log import log
from freezer_api.db import base as db_base
from freezer_api.db.sqlalchemy import api as db_session
from freezer_api.db.sqlalchemy import models

        return self.IMPL

    def get_backend(self):
        global _IMPL
        if _IMPL is None:
            with _LOCK:
                if _IMPL is None:
                    _IMPL = driver.DriverManager(
                        "freezer.database.migration_backend",
                        cfg.CONF.database.backend).driver
        return _IMPL

    def db_sync(self, version=None, init_version=INIT_VERSION, engine=None):
        """Migrate the database to `version` or the most recent version."""

        if not self._engine:
            self._engine = self.get_engine()
        return migration.db_sync(engine=self._engine,
                                 abs_path=MIGRATE_REPO_PATH,
                                 version=version,
                                 init_version=init_version)

    def db_show(self):
        if not self._engine:
            self._engine = self.get_engine()
        return models.get_tables(self._engine)

    def db_remove(self):
        if not self._engine:
            self._engine = self.get_engine()

        models.unregister_models(self._engine)