Ejemplo n.º 1
0
  def setup_class(cls):

    if not is_optimizer_enabled():
      raise SkipTest

    cls.client = make_logged_in_client(username='******', is_superuser=False)
    cls.user = User.objects.get(username='******')
    add_to_group('test')
    grant_access("test", "test", "metadata")
    grant_access("test", "test", "optimizer")

    cls.api = OptimizerApi()
Ejemplo n.º 2
0
    def setup_class(cls):
        if not is_live_cluster() or not is_optimizer_enabled():
            raise SkipTest

        cls.client = make_logged_in_client(username='******', is_superuser=False)
        cls.user = User.objects.get(username='******')
        cls.user = rewrite_user(cls.user)
        add_to_group('test')
        grant_access("test", "test", "metadata")
        grant_access("test", "test", "optimizer")

        cls.api = OptimizerApi()
Ejemplo n.º 3
0
  if request.REQUEST.get("format", "html") == "json":
    resp = JsonResponse({
        'status': 0,
        'database_meta': database_meta,
        'tables': tables,
        'table_names': table_names,
        'search_filter': search_filter
    })
  else:
    resp = render("metastore.mako", request, {
    'breadcrumbs': [],
    'database': None,
    'partitions': [],
    'has_write_access': has_write_access(request.user),
    'is_optimizer_enabled': is_optimizer_enabled() and request.user.is_superuser
    })

  return resp


def get_table_metadata(request, database, table):
  db = dbms.get(request.user)
  response = {'status': -1, 'data': ''}
  try:
    table_metadata = db.get_table(database, table)
    response['status'] = 0
    response['data'] = {
      'comment': table_metadata.comment,
      'hdfs_link': table_metadata.hdfs_link,
      'is_view': table_metadata.is_view