Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jul 17, 2023
1 parent 27c2f3d commit db56f2a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _try_json_readsha(filepath: str, length: int) -> str | None:
# Configuration for scheduling queries from SQL Lab.
SCHEDULED_QUERIES: dict[str, Any] = {}

# Rate limiting
# FAB Rate limiting
RATELIMIT_ENABLED = True
AUTH_RATE_LIMITED = True
AUTH_RATE_LIMIT = "2 per 5 second"
Expand Down
2 changes: 1 addition & 1 deletion superset/dashboards/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def export(self, **kwargs: Any) -> Response:
Dashboard.id.in_(requested_ids)
)
query = self._base_filters.apply_all(query)
ids = [item.id for item in query.all()]
ids = {item.id for item in query.all()}
if not ids:
return self.response_404()
export = Dashboard.export_dashboards(ids)
Expand Down
5 changes: 3 additions & 2 deletions superset/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,12 @@ def clear_cache_for_datasource(cls, datasource_id: int) -> None:

@classmethod
def export_dashboards( # pylint: disable=too-many-locals
cls, dashboard_ids: list[int]
cls,
dashboard_ids: set[int],
) -> str:
copied_dashboards = []
datasource_ids = set()
for dashboard_id in set(dashboard_ids):
for dashboard_id in dashboard_ids:
# make sure that dashboard_id is an integer
dashboard_id = int(dashboard_id)
dashboard = (
Expand Down
4 changes: 2 additions & 2 deletions superset/utils/dashboard_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def export_dashboards(session: Session) -> str:
"""Returns all dashboards metadata as a json dump"""
logger.info("Starting export")
dashboards = session.query(Dashboard)
dashboard_ids = []
dashboard_ids = set()
for dashboard in dashboards:
dashboard_ids.append(dashboard.id)
dashboard_ids.add(dashboard.id)
data = Dashboard.export_dashboards(dashboard_ids)
return data
2 changes: 1 addition & 1 deletion superset/views/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def mulexport( # pylint: disable=no-self-use
@expose("/export_dashboards_form")
def download_dashboards(self) -> FlaskResponse:
if request.args.get("action") == "go":
ids = request.args.getlist("id")
ids = set(request.args.getlist("id"))
return Response(
DashboardModel.export_dashboards(ids),
headers=generate_download_headers("json"),
Expand Down

0 comments on commit db56f2a

Please sign in to comment.