# Path: monasca_api/common/repositories/sqla/models.py
# def get_all_metadata():
# def create_a_model(metadata=None):
# def create_sadd_model(metadata=None):
# def create_aa_model(metadata=None):
# def create_md_model(metadata=None):
# def create_mde_model(metadata=None):
# def create_nm_model(metadata=None):
# def create_nmt_model(metadata=None):
# def create_mdd_model(metadata=None):
# def create_am_model(metadata=None):
# def create_ad_model(metadata=None):
# def create_sa_model(metadata=None):
# def create_sad_model(metadata=None):
#     def __init__(self, columns, separator=',', order_by=None):
# def _group_concat_oracle(element, compiler_, **kw):
# def _group_concat_postgresql(element, compiler_, **kw):
# def _group_concat_sybase(element, compiler_, **kw):
# def _group_concat_mysql(element, compiler_, **kw):
# def _group_concat_default(element, compiler_, **kw):
#     def __init__(self, column, fields):
# def _field_sort_mysql(element, compiler_, **kw):
# def _field_sort_general(element, compiler_, **kw):
# class group_concat(expression.ColumnElement):
# class field_sort(expression.ColumnElement):


import datetime
import time
import fixtures
from oslo_config import cfg
from oslo_db.sqlalchemy.engines import create_engine
from sqlalchemy import delete, MetaData, insert, bindparam
from monasca_api.common.repositories.sqla import models
from monasca_api.tests import base
        from monasca_api.common.repositories.sqla import alarms_repository as ar
        from monasca_api.common.repositories import exceptions
        from monasca_api.common.repositories import exceptions
        from monasca_api.common.repositories import exceptions
        from monasca_api.common.repositories import exceptions
                    self.alarm3,
                    self.alarm_compound]
        self.assertEqual(expected, res)

        query_parms = {'metric_name': 'cpu.idle_perc',
                       'sort_by': ['alarm_definition_name']}
        res = self.repo.get_alarms(tenant_id=tenant_id,
                                   query_parms=query_parms,
                                   limit=1000)
        expected = [self.alarm_compound,
                    self.alarm1,
                    self.alarm2,
                    self.alarm3]
        res = self.helper_builder_result(res)
        self.assertEqual(expected, res)

        query_parms = {'metric_name': 'cpu.idle_perc',
                       'sort_by': ['severity']}
        res = self.repo.get_alarms(tenant_id=tenant_id,
                                   query_parms=query_parms,
                                   limit=1000)
        expected = [self.alarm1,
                    self.alarm2,
                    self.alarm3,
                    self.alarm_compound]
        res = self.helper_builder_result(res)
        self.assertEqual(expected, res)

        query_parms = {'metric_name': 'cpu.idle_perc',
                       'sort_by': ['state']}

# Path: monasca_api/common/repositories/sqla/models.py
# def get_all_metadata():
# def create_a_model(metadata=None):
# def create_sadd_model(metadata=None):
# def create_aa_model(metadata=None):
# def create_md_model(metadata=None):
# def create_mde_model(metadata=None):
# def create_nm_model(metadata=None):
# def create_nmt_model(metadata=None):
# def create_mdd_model(metadata=None):
# def create_am_model(metadata=None):
# def create_ad_model(metadata=None):
# def create_sa_model(metadata=None):
# def create_sad_model(metadata=None):
#     def __init__(self, columns, separator=',', order_by=None):
# def _group_concat_oracle(element, compiler_, **kw):
# def _group_concat_postgresql(element, compiler_, **kw):
# def _group_concat_sybase(element, compiler_, **kw):
# def _group_concat_mysql(element, compiler_, **kw):
# def _group_concat_default(element, compiler_, **kw):
#     def __init__(self, column, fields):
# def _field_sort_mysql(element, compiler_, **kw):
# def _field_sort_general(element, compiler_, **kw):
# class group_concat(expression.ColumnElement):
# class field_sort(expression.ColumnElement):


# Path: monasca_api/tests/test_a_repository.py
import datetime
import time
import fixtures
from oslo_config import cfg
from oslo_db.sqlalchemy.engines import create_engine
from sqlalchemy import delete, MetaData, insert, bindparam
from monasca_api.common.repositories.sqla import models
from monasca_api.tests import base
        from monasca_api.common.repositories.sqla import alarms_repository as ar
        from monasca_api.common.repositories import exceptions
        from monasca_api.common.repositories import exceptions
        from monasca_api.common.repositories import exceptions
        from monasca_api.common.repositories import exceptions

                    self.alarm3,
                    self.alarm_compound]
        self.assertEqual(expected, res)

        query_parms = {'metric_name': 'cpu.idle_perc',
                       'sort_by': ['alarm_definition_name']}
        res = self.repo.get_alarms(tenant_id=tenant_id,
                                   query_parms=query_parms,
                                   limit=1000)
        expected = [self.alarm_compound,
                    self.alarm1,
                    self.alarm2,
                    self.alarm3]
        res = self.helper_builder_result(res)
        self.assertEqual(expected, res)

        query_parms = {'metric_name': 'cpu.idle_perc',
                       'sort_by': ['severity']}
        res = self.repo.get_alarms(tenant_id=tenant_id,
                                   query_parms=query_parms,
                                   limit=1000)
        expected = [self.alarm1,
                    self.alarm2,
                    self.alarm3,
                    self.alarm_compound]
        res = self.helper_builder_result(res)
        self.assertEqual(expected, res)

        query_parms = {'metric_name': 'cpu.idle_perc',
                       'sort_by': ['state']}

        res = self.repo.get_alarms(tenant_id=tenant_id,