def METHOD_NAME():
    '''Purge orphaned resources from the datastore using the datastore_delete
    action, which drops tables when called without filters.'''
    site_user = logic.get_action('get_site_user')({'ignore_auth': True}, {})
    result = logic.get_action('datastore_search')(
        {'user': site_user['name']},
        {'resource_id': '_table_metadata'}
    )
    resource_id_list = []
    for record in result['records']:
        try:
            # ignore 'alias' records (views) as they are automatically
            # deleted when the parent resource table is dropped
            if record['alias_of']:
                continue
            logic.get_action('resource_show')(
                {'user': site_user['name']},
                {'id': record['name']}
            )
        except logic.NotFound:
            resource_id_list.append(record['name'])
            click.echo("Resource '%s' orphaned - queued for drop" %
                       record[u'name'])
        except KeyError:
            continue
    orphaned_table_count = len(resource_id_list)
    click.echo('%d orphaned tables found.' % orphaned_table_count)
    if not orphaned_table_count:
        return
    click.confirm('Proceed with purge?', abort=True)
    # Drop the orphaned datastore tables. When datastore_delete is called
    # without filters, it does a drop table cascade
    drop_count = 0
    for resource_id in resource_id_list:
        logic.get_action('datastore_delete')(
            {'user': site_user['name']},
            {'resource_id': resource_id, 'force': True}
        )
        click.echo("Table '%s' dropped)" % resource_id)
        drop_count += 1
    click.echo('Dropped %s tables' % drop_count)