Przeglądaj źródła

HUE-2862 [hbase] Allow to empty a cell

Romain Rigaux 10 lat temu
rodzic
commit
6e167aa1a0
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      apps/hbase/src/hbase/api.py

+ 4 - 4
apps/hbase/src/hbase/api.py

@@ -20,7 +20,6 @@ import logging
 import re
 import csv
 
-from django.core.urlresolvers import reverse
 from django.utils.translation import ugettext as _
 from django.utils.encoding import smart_str
 
@@ -28,7 +27,7 @@ from desktop.lib import thrift_util
 from desktop.lib.exceptions_renderable import PopupException
 
 from hbase import conf
-from hbase.hbase_site import get_server_principal, get_server_authentication, is_using_thrift_ssl, is_using_thrift_http, is_impersonation_enabled
+from hbase.hbase_site import get_server_principal, get_server_authentication, is_using_thrift_ssl, is_using_thrift_http
 from hbase.server.hbase_lib import get_thrift_type, get_client_type
 
 
@@ -200,10 +199,11 @@ class HbaseApi(object):
     mutations = []
     Mutation = get_thrift_type('Mutation')
     for column in data.keys():
-      mutations.append(Mutation(column=smart_str(column), value=smart_str(data[column]))) # must use str for API, does thrift coerce by itself?
+      value = smart_str(data[column]) if data[column] is not None else None
+      mutations.append(Mutation(column=smart_str(column), value=value)) # must use str for API, does thrift coerce by itself?
     return client.mutateRow(tableName, smart_str(row), mutations, None, doas=self.user.username)
 
-  def putColumn(self, cluster, tableName, row, column, value):
+  def putColumn(self, cluster, tableName, row, column, value=None):
     return self.putRow(cluster, tableName, smart_str(row), {column: value})
 
   def putUpload(self, cluster, tableName, row, column, value):