def import_dashboards(session: Session, content: str, database_id: Optional[int]=None, import_time: Optional[int]=None) -> None:
    'Imports dashboards from a stream to databases'
    current_tt = int(time.time())
    import_time = (current_tt if (import_time is None) else import_time)
    data = json.loads(content, object_hook=decode_dashboards)
    if (not data):
        raise DashboardImportException(_('No data in file'))
    dataset_id_mapping: Dict[(int, int)] = {}
    for table in data['datasources']:
        new_dataset_id = import_dataset(table, database_id, import_time=import_time)
        params = json.loads(table.params)
        dataset_id_mapping[params['remote_id']] = new_dataset_id
    session.commit()
    for dashboard in data['dashboards']:
        import_dashboard(dashboard, dataset_id_mapping, import_time=import_time, database_id=database_id)
    session.commit()
Imports dashboards from a stream to databases
def import_dashboards(session: Session, content: str, database_id: Optional[int]=None, import_time: Optional[int]=None) -> None:
    
    current_tt = int(time.time())
    import_time = (current_tt if (import_time is None) else import_time)
    data = json.loads(content, object_hook=decode_dashboards)
    if (not data):
        raise DashboardImportException(_('No data in file'))
    dataset_id_mapping: Dict[(int, int)] = {}
    for table in data['datasources']:
        new_dataset_id = import_dataset(table, database_id, import_time=import_time)
        params = json.loads(table.params)
        dataset_id_mapping[params['remote_id']] = new_dataset_id
    session.commit()
    for dashboard in data['dashboards']:
        import_dashboard(dashboard, dataset_id_mapping, import_time=import_time, database_id=database_id)
    session.commit()