@@ -107,32 +107,37 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
107107
108108 workspace_id = workspace .id
109109
110- # Set workspace and database
111- if params .get ('with_database' ):
112- if params .get ('in_group' ):
113- # Use 3-element tuple: (workspace_group_id, workspace_name_or_id,
114- # database)
115- portal .connection = ( # type: ignore[assignment]
116- workspace_group .id ,
117- workspace_name or workspace_id ,
118- params ['with_database' ],
119- )
120- else :
121- # Use 2-element tuple: (workspace_name_or_id, database)
122- portal .connection = (
123- workspace_name or workspace_id ,
124- params ['with_database' ],
125- )
126- else :
127- if params .get ('in_group' ):
128- # Use 2-element tuple: (workspace_group_id, workspace_name_or_id)
129- portal .workspace = ( # type: ignore[assignment]
130- workspace_group .id ,
131- workspace_name or workspace_id ,
132- )
110+ try :
111+ # Set workspace and database
112+ if params .get ('with_database' ):
113+ if params .get ('in_group' ):
114+ # Use 3-element tuple: (workspace_group_id, workspace_name_or_id,
115+ # database)
116+ portal .connection = ( # type: ignore[assignment]
117+ workspace_group .id ,
118+ workspace_name or workspace_id ,
119+ params ['with_database' ],
120+ )
121+ else :
122+ # Use 2-element tuple: (workspace_name_or_id, database)
123+ portal .connection = (
124+ workspace_name or workspace_id ,
125+ params ['with_database' ],
126+ )
133127 else :
134- # Use string: workspace_name_or_id
135- portal .workspace = workspace_name or workspace_id
128+ if params .get ('in_group' ):
129+ # Use 2-element tuple: (workspace_group_id, workspace_name_or_id)
130+ portal .workspace = ( # type: ignore[assignment]
131+ workspace_group .id ,
132+ workspace_name or workspace_id ,
133+ )
134+ else :
135+ # Use string: workspace_name_or_id
136+ portal .workspace = workspace_name or workspace_id
137+
138+ except RuntimeError as exc :
139+ if 'timeout' not in str (exc ):
140+ raise
136141
137142 return None
138143
0 commit comments