@@ -0,0 +1,1545 @@
+from carto.datasets import DatasetManager%0Afrom carto.auth import APIKeyAuthClient%0Aimport urllib%0Aimport operator%0A%0AAPIKEY = raw_input('enter API key: ')%0AUSERNAME = raw_input('enter username: ')%0AORGANIZATION = raw_input('enter team name: ')%0ASAVE_FOLDER = raw_input('enter the folder directory to save datasets: ')%0A%0ABASE_URL = %22https://%7Borganization%7D.carto.com/user/%7Buser%7D/%22. %5C%0A    format(organization=ORGANIZATION,%0A           user=USERNAME)%0AUSR_BASE_URL = %22https://%7Buser%7D.carto.com/%22.format(user=USERNAME)%0Aauth_client = APIKeyAuthClient(api_key=APIKEY, base_url=USR_BASE_URL, organization=ORGANIZATION)%0A%0Adataset_manager = DatasetManager(auth_client)%0Adatasets = dataset_manager.all()%0A%0Adatasets_dict = %7B%7D%0Amin_size = 0.000001 # for query by dataset size b/c already started sorted%0A%0Afor i in datasets:%0A    if round(i.table.size/1048576.00, 2) %3E min_size:%0A        case = %7B'size': round(i.table.size/1048576.00, 2)%7D%0A        datasets_dict%5Bi.table.name%5D = case%0A    else:%0A        pass%0A%0Asorted_datasets = sorted(datasets_dict.items(), key=operator.itemgetter(1))%0A%0Anon_exported = %5B%5D%0A%0Afor keys, values in sorted_datasets:%0A    print(keys, values%5B'size'%5D)%0A    tablename = keys%0A    url = 'https://%25s.carto.com/api/v2/sql?&api_key=%25s&filename=%25s.csv&format=csv&q=SELECT * FROM %25s' %25 (USERNAME, APIKEY, tablename, tablename) %0A    # print tablename%0A    try:%0A        dl_file = urllib.URLopener()%0A        dl_file.retrieve(url, SAVE_FOLDER+'/'+tablename+'.csv')%0A    except:%0A        non_exported.append(keys)%0A        %0Aprint 'List of non-exported datasets:', non_exported

add a script to export all datasets from account