@@ -245,7 +245,7 @@ def get_plugin(self, plugin_id):
245245 # SQL queries
246246 ########################################################
247247
248- def sql_query (self , query , connection = None , database = None , dataset_full_name = None , pre_queries = None , post_queries = None , type = 'sql' , extra_conf = {} , script_steps = None , script_input_schema = None , script_output_schema = None , script_report_location = None , read_timestamp_without_timezone_as_string = True , read_date_as_string = False ):
248+ def sql_query (self , query , connection = None , database = None , dataset_full_name = None , pre_queries = None , post_queries = None , type = 'sql' , extra_conf = None , script_steps = None , script_input_schema = None , script_output_schema = None , script_report_location = None , read_timestamp_without_timezone_as_string = True , read_date_as_string = False ):
249249 """
250250 Initiate a SQL, Hive or Impala query and get a handle to retrieve the results of the query.
251251 Internally, the query is run by DSS. The database to run the query on is specified either by
@@ -262,6 +262,8 @@ def sql_query(self, query, connection=None, database=None, dataset_full_name=Non
262262
263263 :returns: A :class:`dataikuapi.dss.sqlquery.DSSSQLQuery` query handle
264264 """
265+ if extra_conf is None :
266+ extra_conf = {}
265267 return DSSSQLQuery (self , query , connection , database , dataset_full_name , pre_queries , post_queries , type , extra_conf , script_steps , script_input_schema , script_output_schema , script_report_location , read_timestamp_without_timezone_as_string , read_date_as_string )
266268
267269 ########################################################
@@ -290,7 +292,7 @@ def get_user(self, login):
290292 """
291293 return DSSUser (self , login )
292294
293- def create_user (self , login , password , display_name = '' , source_type = 'LOCAL' , groups = [] , profile = 'DATA_SCIENTIST' ):
295+ def create_user (self , login , password , display_name = '' , source_type = 'LOCAL' , groups = None , profile = 'DATA_SCIENTIST' ):
294296 """
295297 Create a user, and return a handle to interact with it
296298
@@ -305,6 +307,8 @@ def create_user(self, login, password, display_name='', source_type='LOCAL', gro
305307
306308 :return: A :class:`dataikuapi.dss.admin.DSSUser` user handle
307309 """
310+ if groups is None :
311+ groups = []
308312 resp = self ._perform_text (
309313 "POST" , "/admin/users/" , body = {
310314 "login" : login ,
@@ -386,7 +390,7 @@ def get_connection(self, name):
386390 """
387391 return DSSConnection (self , name )
388392
389- def create_connection (self , name , type , params = {} , usable_by = 'ALL' , allowed_groups = [] ):
393+ def create_connection (self , name , type , params = None , usable_by = 'ALL' , allowed_groups = None ):
390394 """
391395 Create a connection, and return a handle to interact with it
392396
@@ -402,6 +406,10 @@ def create_connection(self, name, type, params={}, usable_by='ALL', allowed_grou
402406
403407 :returns: A :class:`dataikuapi.dss.admin.DSSConnection` connection handle
404408 """
409+ if params is None :
410+ params = {}
411+ if allowed_groups is None :
412+ allowed_groups = []
405413 resp = self ._perform_text (
406414 "POST" , "/admin/connections/" , body = {
407415 "name" : name ,
@@ -659,13 +667,15 @@ def get_log(self, name):
659667 return self ._perform_json (
660668 "GET" , "/admin/logs/%s" % name )
661669
662- def log_custom_audit (self , custom_type , custom_params = {} ):
670+ def log_custom_audit (self , custom_type , custom_params = None ):
663671 """
664672 Log a custom entry to the audit trail
665673
666674 :param str custom_type value for customMsgType in audit trail item
667675 :param dict custom_params value for customMsgParams in audit trail item
668676 """
677+ if custom_params is None :
678+ custom_params = {}
669679 return self ._perform_empty ("POST" ,
670680 "/admin/audit/custom/%s" % custom_type ,
671681 body = custom_params )
@@ -780,10 +790,12 @@ def get_apideployer(self):
780790 # Data Catalog
781791 ########################################################
782792
783- def catalog_index_connections (self , connection_names = [] , all_connections = False , indexing_mode = "FULL" ):
793+ def catalog_index_connections (self , connection_names = None , all_connections = False , indexing_mode = "FULL" ):
784794 """
785795 Triggers an indexing of multiple connections in the data catalog
786796 """
797+ if connection_names is None :
798+ connection_names = []
787799 return self ._perform_json ("POST" , "/catalog/index" , body = {
788800 "connectionNames" : connection_names ,
789801 "indexAllConnections" : all_connections ,
@@ -939,7 +951,7 @@ def __init__(self, client, import_id):
939951 self .client = client
940952 self .import_id = import_id
941953
942- def execute (self , settings = {} ):
954+ def execute (self , settings = None ):
943955 """
944956 Executes the import with provided settings.
945957
@@ -966,7 +978,7 @@ def execute(self, settings = {}):
966978 @warning: You must check the 'success' flag
967979 """
968980 # Empty JSON dicts can't be parsed properly
969- if settings == {} :
970- settings [ "_" ] = "_"
981+ if settings is None :
982+ settings = { "_" : "_" }
971983 return self .client ._perform_json ("POST" , "/projects/import/%s/process" % (self .import_id ),
972984 body = settings )
0 commit comments