コード例 #1
0
ファイル: es_utils.py プロジェクト: zbidi/commcare-hq
class ElasticsearchIndexInfo(jsonobject.JsonObject):
    index = jsonobject.StringProperty(required=True)
    alias = jsonobject.StringProperty()
    type = jsonobject.StringProperty()
    meta = jsonobject.DictProperty()
    mapping = jsonobject.DictProperty()

    def __unicode__(self):
        return u'{} ({})'.format(self.alias, self.index)
コード例 #2
0
ファイル: es_utils.py プロジェクト: soitun/commcare-hq
class ElasticsearchIndexInfo(jsonobject.JsonObject):
    index = jsonobject.StringProperty(required=True)
    alias = jsonobject.StringProperty()
    type = jsonobject.StringProperty()
    mapping = jsonobject.DictProperty()
    hq_index_name = jsonobject.StringProperty()

    def __str__(self):
        return '{} ({})'.format(self.alias, self.index)

    @property
    def meta(self):
        meta_settings = deepcopy(ES_INDEX_SETTINGS['default'])
        meta_settings.update(ES_INDEX_SETTINGS.get(self.hq_index_name, {}))
        meta_settings.update(
            ES_INDEX_SETTINGS.get(settings.SERVER_ENVIRONMENT,
                                  {}).get(self.hq_index_name, {}))

        if settings.ES_SETTINGS is not None:
            for hq_index_name in ['default', self.hq_index_name]:
                for key, value in settings.ES_SETTINGS.get(hq_index_name,
                                                           {}).items():
                    if value is REMOVE_SETTING:
                        del meta_settings['settings'][key]
                    else:
                        meta_settings['settings'][key] = value

        return meta_settings

    def to_json(self):
        json = super(ElasticsearchIndexInfo, self).to_json()
        json['meta'] = self.meta
        return json
コード例 #3
0
class ElasticsearchIndexInfo(jsonobject.JsonObject):
    index = jsonobject.StringProperty(required=True)
    alias = jsonobject.StringProperty()
    type = jsonobject.StringProperty()
    mapping = jsonobject.DictProperty()

    def __unicode__(self):
        return u'{} ({})'.format(self.alias, self.index)

    @property
    def meta(self):
        meta_settings = deepcopy(settings.ES_META['default'])
        meta_settings.update(settings.ES_META.get(self.alias, {}))
        meta_settings.update(
            settings.ES_META.get(settings.SERVER_ENVIRONMENT,
                                 {}).get(self.alias, {}))
        return meta_settings

    def to_json(self):
        json = super(ElasticsearchIndexInfo, self).to_json()
        json['meta'] = self.meta
        return json
コード例 #4
0
class SqlColumnProperties(jsonobject.JsonObject):
    datatype = DataTypeProperty(required=True)
    statement = jsonobject.StringProperty(required=True)
    statement_params = jsonobject.DictProperty()
コード例 #5
0
class SecondaryColumnSpec(jsonobject.JsonObject):
    column_id = jsonobject.StringProperty(required=True)
    aggregation_type = jsonobject.StringProperty(required=True)
    config_params = jsonobject.DictProperty()
コード例 #6
0
class PrimaryColumnSpec(jsonobject.JsonObject):
    column_id = jsonobject.StringProperty(required=True)
    type = jsonobject.StringProperty(required=True)
    config_params = jsonobject.DictProperty()