@@ -825,9 +825,18 @@ def get_object_discussions(self):
825825 ########################################################
826826
827827 def init_tables_import (self ):
828- return TablesImportBuffer (self .client , self .project_key )
828+ """
829+ Start an operation to import Hive or SQL tables as datasets into this project
830+
831+ :returns: a :class:`TablesImportDefinition` to add tables to import
832+ :rtype: :class:`TablesImportDefinition`
833+ """
834+ return TablesImportDefinition (self .client , self .project_key )
829835
830- class TablesImportBuffer (object ):
836+ class TablesImportDefinition (object ):
837+ """
838+ Temporary structure holding the list of tables to import
839+ """
831840
832841 def __init__ (self , client , project_key ):
833842 """Do not call this directly, use :meth:`DSSProject.init_tables_import`"""
@@ -836,19 +845,30 @@ def __init__(self, client, project_key):
836845 self .keys = []
837846
838847 def add_hive_table (self , hive_database , hive_table ):
848+ """Add a Hive table to the list of tables to import"""
839849 self .keys .append ({
840850 "connectionName" : "@virtual(hive-jdbc):" + hive_database ,
841851 "name" : hive_table
842852 })
843853
844854 def add_sql_table (self , connection , schema , table ):
855+ """Add a SQL table to the list of table to import"""
845856 self .keys .append ({
846857 "connectionName" : connection ,
847858 "schema" : schema ,
848859 "name" : table
849860 })
850861
851862 def prepare (self ):
863+ """
864+ Run the first step of the import process. In this step, DSS will check
865+ the tables whose import you have requested and prepare dataset names and
866+ target connections
867+
868+ :returns: a :class:`TablesPreparedImport` object that allows you to finalize the import process
869+ :rtype: :class:`TablesPreparedImport`
870+
871+ """
852872 ret = self .client ._perform_json ("POST" , "/projects/%s/datasets/tables-import/actions/prepare-from-keys" % (self .project_key ),
853873 body = {"keys" : self .keys } )
854874
@@ -857,16 +877,19 @@ def prepare(self):
857877 return TablesPreparedImport (self .client , self .project_key , future .get_result ())
858878
859879class TablesPreparedImport (object ):
860- """Do not call this directly, use :meth:`DSSProject.init_tables_import` and then prepare"""
880+ """Result of preparing a tables import. Import can now be finished"""
881+
861882 def __init__ (self , client , project_key , candidates ):
883+ """Do not call this directly, use :meth:`DSSProject.init_tables_import` and then prepare"""
862884 self .client = client
863885 self .project_key = project_key
864886 self .candidates = candidates
865887
866888 def execute (self ):
867889 """
868- Executes the import in background
890+ Starts executing the import in background and returns a :class:`dataikuapi.dss.future.DSSFuture` to wait on the result
869891
892+ :returns: a future to wait on the result
870893 :rtype: :class:`dataikuapi.dss.future.DSSFuture`
871894 """
872895 ret = self .client ._perform_json ("POST" , "/projects/%s/datasets/tables-import/actions/execute-from-candidates" % (self .project_key ),
0 commit comments