@@ -11,7 +11,7 @@ def list_dbcs(self, cluster_id):
1111 return self .sdk .call (
1212 svc = 'dw' , func = 'list_dbcs' , ret_field = 'dbcs' , squelch = [
1313 Squelch (value = 'NOT_FOUND' , default = list ()),
14- Squelch (field = 'status_code' , value = '504' , default = list (), warning = "No dbcs in this Cluster" ),
14+ Squelch (field = 'status_code' , value = '504' , default = list (), warning = "No Data Catalogs found in this Cluster" ),
1515 ],
1616 clusterId = cluster_id
1717 )
@@ -20,7 +20,7 @@ def list_vws(self, cluster_id):
2020 return self .sdk .call (
2121 svc = 'dw' , func = 'list_vws' , ret_field = 'vws' , squelch = [
2222 Squelch (value = 'NOT_FOUND' , default = list ()),
23- Squelch (field = 'status_code' , value = '504' , default = list (), warning = "No vws in this Cluster" ),
23+ Squelch (field = 'status_code' , value = '504' , default = list (), warning = "No Virtual Warehouses found in this Cluster" ),
2424 ],
2525 clusterId = cluster_id
2626 )
@@ -36,7 +36,7 @@ def describe_cluster(self, cluster_id):
3636 def describe_vw (self , cluster_id , vw_id ):
3737 return self .sdk .call (
3838 svc = 'dw' , func = 'describe_vw' , ret_field = 'vw' , squelch = [
39- Squelch ('NOT_FOUND' ), Squelch ('INVALID_ARGUMENT' )
39+ Squelch ('NOT_FOUND' ), Squelch ('INVALID_ARGUMENT' ), Squelch ( 'UNKNOWN' )
4040 ],
4141 clusterId = cluster_id ,
4242 vwId = vw_id
@@ -45,7 +45,7 @@ def describe_vw(self, cluster_id, vw_id):
4545 def describe_dbc (self , cluster_id , dbc_id ):
4646 return self .sdk .call (
4747 svc = 'dw' , func = 'describe_dbc' , ret_field = 'dbc' , squelch = [
48- Squelch ('NOT_FOUND' ), Squelch ('INVALID_ARGUMENT' )
48+ Squelch ('NOT_FOUND' ), Squelch ('INVALID_ARGUMENT' ), Squelch ( 'UNKNOWN' )
4949 ],
5050 clusterId = cluster_id ,
5151 dbcId = dbc_id
@@ -101,37 +101,47 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:
101101 autoscaling_min_cluster :int = None , autoscaling_max_cluster :int = None ,
102102 common_configs :dict = None , application_configs :dict = None , ldap_groups :list = None ,
103103 enable_sso :bool = None , tags :dict = None ):
104- autoscaling = {}
105- if autoscaling_min_cluster != 0 :
106- autoscaling ['minClusters' ] = autoscaling_min_cluster
107- if autoscaling_max_cluster != 0 :
108- autoscaling ['maxClusters' ] = autoscaling_max_cluster
109-
110- tag_list = []
111- for key ,value in tags .items ():
112- tag_list .append ({'key' : key , 'value' : value })
113-
114- config = {}
115- if not common_configs is None and not common_configs :
116- config ['commonConfigs' ] = common_configs
117- if not application_configs is None and not application_configs :
118- config ['applicationConfigs' ] = application_configs
119- if not ldap_groups is None and not ldap_groups :
120- config ['ldapGroups' ] = ldap_groups
121- if not enable_sso is None :
122- config ['enableSSO' ] = enable_sso
104+
105+ if any (x is not None for x in [autoscaling_min_cluster , autoscaling_max_cluster ]):
106+ autoscaling = {}
107+ if autoscaling_min_cluster is not None and autoscaling_min_cluster != 0 :
108+ autoscaling ['minClusters' ] = autoscaling_min_cluster
109+ if autoscaling_max_cluster is not None and autoscaling_max_cluster != 0 :
110+ autoscaling ['maxClusters' ] = autoscaling_max_cluster
111+ else :
112+ autoscaling = None
113+
114+ if tags is not None :
115+ tag_list = []
116+ for key ,value in tags .items ():
117+ tag_list .append ({'key' : key , 'value' : value })
118+ else :
119+ tag_list = None
120+
121+ if any (x is not None for x in [common_configs , application_configs , ldap_groups , enable_sso ]):
122+ config = {}
123+ if common_configs is not None and not common_configs :
124+ config ['commonConfigs' ] = common_configs
125+ if application_configs is not None and not application_configs :
126+ config ['applicationConfigs' ] = application_configs
127+ if ldap_groups is not None and not ldap_groups :
128+ config ['ldapGroups' ] = ldap_groups
129+ if enable_sso is not None :
130+ config ['enableSSO' ] = enable_sso
131+ else :
132+ config = None
123133
124134 return self .sdk .call (
125135 svc = 'dw' , func = 'create_vw' , ret_field = 'vwId' , clusterId = cluster_id , dbcId = dbc_id ,
126- vwType = vw_type , name = name , template = template , autoscaling = autoscaling ,
127- config = config , tags = tag_list
136+ vwType = vw_type , name = name , template = template , autoscaling = autoscaling , config = config ,
137+ tags = tag_list
128138 )
129139
130140 def delete_vw (self , cluster_id :str , vw_id :str ):
131141 return self .sdk .call (
132142 svc = 'dw' , func = 'delete_vw' , squelch = [Squelch ('NOT_FOUND' )], clusterId = cluster_id , vwId = vw_id
133143 )
134-
144+
135145 def create_dbc (self , cluster_id :str , name :str , load_demo_data : bool = None ):
136146 return self .sdk .call (
137147 svc = 'dw' , func = 'create_dbc' , ret_field = 'dbcId' , clusterId = cluster_id , name = name ,
0 commit comments