mistercrunch commented on a change in pull request #7448: Adds 'superset 
export_dashboards --dashboard-id/-i --dashboard-title/-t' options to CLI
URL: 
https://github.com/apache/incubator-superset/pull/7448#discussion_r281739259
 
 

 ##########
 File path: superset/utils/dashboard_import_export.py
 ##########
 @@ -38,12 +38,17 @@ def import_dashboards(session, data_stream, 
import_time=None):
     session.commit()
 
 
-def export_dashboards(session):
+def export_dashboards(session, dashboard_id=None, dashboard_title=None):
     """Returns all dashboards metadata as a json dump"""
     logging.info('Starting export')
     dashboards = session.query(Dashboard)
     dashboard_ids = []
     for dashboard in dashboards:
-        dashboard_ids.append(dashboard.id)
-    data = Dashboard.export_dashboards(dashboard_ids)
+        if dashboard_id or dashboard_title:
 
 Review comment:
   In envs with lots of dashboards, it'd be more efficient to add a query 
filter, as in:
   
   [untested]
   ```python
   query = session.query(Dashboard)
   if dashboard_ids:
       query = query.filter(Dasbhoard.id.in_(dashboard_ids))
   if dashboard_titles:
       query = query.filter(Dasbhoard.title.in_(dashboard_titles))
   ```

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to