You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/11/25 05:01:18 UTC

[GitHub] [incubator-superset] betodealmeida commented on a change in pull request #11803: feat: handle new export in CLI

betodealmeida commented on a change in pull request #11803:
URL: https://github.com/apache/incubator-superset/pull/11803#discussion_r530109277



##########
File path: superset/cli.py
##########
@@ -260,10 +261,30 @@ def import_dashboards(path: str, recursive: bool, username: str) -> None:
     "--dashboard-file", "-f", default=None, help="Specify the the file to export to"
 )
 @click.option(
-    "--print_stdout", "-p", is_flag=True, default=False, help="Print JSON to stdout"
+    "--print_stdout", "-p", is_flag=True, default=False, help="Print JSON to stdout",
 )
-def export_dashboards(dashboard_file: str, print_stdout: bool) -> None:
+def export_dashboards(
+    dashboard_file: Optional[str], print_stdout: bool = False
+) -> None:
     """Export dashboards to JSON"""
+    if app.config["DEFAULT_FEATURE_FLAGS"].get("VERSIONED_EXPORT"):
+        from superset.dashboards.commands.export import ExportDashboardsCommand
+        from superset.models.dashboard import Dashboard
+
+        g.user = security_manager.find_user(username="admin")
+
+        dashboard_ids = [id_ for (id_,) in db.session.query(Dashboard.id).all()]

Review comment:
       I think without the `()` it's easy to overlook what's happening:
   
   ```python
   dashboard_ids = [id_ for id_, in db.session.query(Dashboard.id).all()] 
   ```
   
   Adding parentheses make the intent more clear, IMHO.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org