Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 30 additions & 25 deletions singlestoredb/fusion/handlers/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,37 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:

workspace_id = workspace.id

# Set workspace and database
if params.get('with_database'):
if params.get('in_group'):
# Use 3-element tuple: (workspace_group_id, workspace_name_or_id,
# database)
portal.connection = ( # type: ignore[assignment]
workspace_group.id,
workspace_name or workspace_id,
params['with_database'],
)
else:
# Use 2-element tuple: (workspace_name_or_id, database)
portal.connection = (
workspace_name or workspace_id,
params['with_database'],
)
else:
if params.get('in_group'):
# Use 2-element tuple: (workspace_group_id, workspace_name_or_id)
portal.workspace = ( # type: ignore[assignment]
workspace_group.id,
workspace_name or workspace_id,
)
try:
# Set workspace and database
if params.get('with_database'):
if params.get('in_group'):
# Use 3-element tuple: (workspace_group_id, workspace_name_or_id,
# database)
portal.connection = ( # type: ignore[assignment]
workspace_group.id,
workspace_name or workspace_id,
params['with_database'],
)
else:
# Use 2-element tuple: (workspace_name_or_id, database)
portal.connection = (
workspace_name or workspace_id,
params['with_database'],
)
else:
# Use string: workspace_name_or_id
portal.workspace = workspace_name or workspace_id
if params.get('in_group'):
# Use 2-element tuple: (workspace_group_id, workspace_name_or_id)
portal.workspace = ( # type: ignore[assignment]
workspace_group.id,
workspace_name or workspace_id,
)
else:
# Use string: workspace_name_or_id
portal.workspace = workspace_name or workspace_id

except RuntimeError as exc:
if 'timeout' not in str(exc):
raise

return None

Expand Down
4 changes: 2 additions & 2 deletions singlestoredb/notebook/_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def _call_javascript(
args: Optional[List[Any]] = None,
wait_on_condition: Optional[Callable[[], bool]] = None,
timeout_message: str = 'timed out waiting on condition',
wait_interval: float = 0.2,
timeout: float = 5.0,
wait_interval: float = 2.0,
timeout: float = 60.0,
) -> None:
if not has_ipython or not func:
return
Expand Down