dashboard_api.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env python
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. import logging
  18. LOG = logging.getLogger(__name__)
  19. def get_engine(user, engine='solr'):
  20. if isinstance(engine, dict):
  21. engine = engine.get('engine', 'solr')
  22. if engine != 'solr':
  23. from impala.dashboard_api import SQLApi
  24. return SQLApi(user, engine)
  25. else:
  26. from search.dashboard_api import SearchApi
  27. return SearchApi(user)
  28. class DashboardApi(object):
  29. def __init__(self, user):
  30. self.user = user
  31. def datasets(self, show_all=False): pass
  32. def query(self, collection, query, facet=None): pass
  33. def suggest(self, collection, query): pass
  34. def schema_fields(self, collection): pass
  35. def fields(self, collection): pass
  36. def luke(self, collection, query): pass
  37. def update(self, collection, json_edits, content_type, version): pass
  38. def stats(self, collection, field, query=None, facet=''): pass
  39. def terms(self, collection, field, properties): pass
  40. def fetch_result(self, collection, query, facet=None): pass
  41. def get(self, collection, doc_id): pass