# Path: monasca_notification/common/repositories/base/base_repo.py
# class BaseRepo(object):
#     def __init__(self, config):


from oslo_log import log as logging
from monasca_notification.common.repositories.base import base_repo
from monasca_notification.common.repositories import exceptions as exc
import psycopg2
# Copyright 2015-2017 FUJITSU LIMITED
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.



log = logging.getLogger(__name__)


class PostgresqlRepo(base_repo.BaseRepo):
    def __init__(self, config):
        super(PostgresqlRepo, self).__init__(config)
        self._pgsql_params = config['postgresql']
        self._pgsql = None

    def _connect_to_pgsql(self):
        self._pgsql = None
        try:

# Path: monasca_notification/common/repositories/base/base_repo.py
# class BaseRepo(object):
#     def __init__(self, config):


# Path: monasca_notification/common/repositories/postgres/pgsql_repo.py
from oslo_log import log as logging
from monasca_notification.common.repositories.base import base_repo
from monasca_notification.common.repositories import exceptions as exc
import psycopg2

# Copyright 2015-2017 FUJITSU LIMITED
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.



log = logging.getLogger(__name__)


class PostgresqlRepo(base_repo.BaseRepo):
    def __init__(self, config):
        super(PostgresqlRepo, self).__init__(config)
        self._pgsql_params = config['postgresql']
        self._pgsql = None

    def _connect_to_pgsql(self):
        self._pgsql = None
        try:

            self._pgsql = psycopg2.connect(**self._pgsql_params)