#NEWLINE# def create_table( self , impala_name , kudu_name , primary_keys = None , obj = None , schema = None , database = None , external = False , force = False ) : #NEWLINE# #INDENT# '\n        Create an Kudu-backed table in the connected Impala cluster. For\n        non-external tables, this will create a Kudu table with a compatible\n        storage schema.\n\n        This function is patterned after the ImpalaClient.create_table function\n        designed for physical filesystems (like HDFS).\n\n        Parameters\n        ----------\n        impala_name : string\n          Name of the created Impala table\n        kudu_name : string\n          Name of hte backing Kudu table. Will be created if external=False\n        primary_keys : list of column names\n          List of\n        obj : TableExpr or pandas.DataFrame, optional\n          If passed, creates table from select statement results\n        schema : ibis.Schema, optional\n          Mutually exclusive with expr, creates an empty table with a\n          particular schema\n        database : string, default None (optional)\n        external : boolean, default False\n          If False, a new Kudu table will be created. Otherwise, the Kudu table\n          must already exist.\n        ' #NEWLINE# self . _check_connected ( ) #NEWLINE# if ( ( not external ) and ( ( primary_keys is None ) or ( len ( primary_keys ) == 0 ) ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Must specify primary keys when DDL creates a new Kudu table' ) #NEWLINE# #UNINDENT# if ( obj is not None ) : #NEWLINE# #INDENT# if external : #NEWLINE# #INDENT# raise ValueError ( 'Cannot create an external Kudu-Impala table from an expression or DataFrame' ) #NEWLINE# #UNINDENT# if isinstance ( obj , pd . DataFrame ) : #NEWLINE# #INDENT# from ibis.impala.pandas_interop import write_temp_dataframe #NEWLINE# ( writer , to_insert ) = write_temp_dataframe ( self . impala_client , obj ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# to_insert = obj #NEWLINE# #UNINDENT# ast = self . impala_client . _build_ast ( to_insert ) #NEWLINE# select = ast . queries [ 0 ] #NEWLINE# stmt = CTASKudu ( impala_name , kudu_name , self . client . master_addrs , select , primary_keys , database = database ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if external : #NEWLINE# #INDENT# ktable = self . client . table ( kudu_name ) #NEWLINE# kschema = ktable . schema #NEWLINE# schema = schema_kudu_to_ibis ( kschema ) #NEWLINE# primary_keys = kschema . primary_keys ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( schema is None ) : #NEWLINE# #INDENT# raise ValueError ( 'Must specify schema for new empty Kudu-backed table' ) #NEWLINE# #UNINDENT# #UNINDENT# stmt = CreateTableKudu ( impala_name , kudu_name , self . client . master_addrs , schema , primary_keys , external = external , database = database , can_exist = False ) #NEWLINE# #UNINDENT# self . impala_client . _execute ( stmt )