john-bodley commented on a change in pull request #11803:
URL:
https://github.com/apache/incubator-superset/pull/11803#discussion_r530086949
##########
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()]
+ timestamp = datetime.now().strftime("%Y%m%dT%H%M%S")
+ root = f"dashboard_export_{timestamp}"
+ dashboard_file = dashboard_file or f"{root}.zip"
Review comment:
Should the default (fallback) be expressed as a click option?
##########
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:
You can drop the `()` if you want.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]