Publish a visualization from a private table

This example illustrate how to publish a visualization using a private table. Using private tables requires to create Maps API keys for the visualization. By default it creates a custom Maps API key for all the private tables used in the visualization if not provided.

Read more about Maps API Keys: https://carto.com/developers/auth-api/guides/types-of-API-Keys/

Note: CARTO Account credentials are needed to reproduce this example. https://carto.com/signup


In [1]:
from cartoframes.auth import set_default_credentials

set_default_credentials('creds.json')

In [2]:
from cartoframes.viz import Map, Layer

map_viz = Map(Layer('private_table'))

In [3]:
map_viz.publish(
    name='map_private_table',
    password='1234',
    if_exists='replace')


The map has been published. The "cartoframes_997c05771fd4e0916de49826722e51cd" Maps API key with value "7rj9ftFsOKUjSotnygh2jg" is being used for the datasets: "private_table". You can manage your API keys on your account.
Out[3]:
{'id': 'd5511e5e-f64f-4b87-b970-3ba7a36a62f1',
 'url': 'https://cartoframes-org.carto.com/u/cartoframes/kuviz/d5511e5e-f64f-4b87-b970-3ba7a36a62f1',
 'name': 'map_private_table',
 'privacy': 'password'}

The Maps API key can be created in the CARTO Dashboard and provided to the method.


In [4]:
map_viz.publish(
    name='map_private_table',
    password='1234',
    if_exists='replace',
    maps_api_key='7rj9ftFsOKUjSotnygh2jg')


Out[4]:
{'id': 'd5511e5e-f64f-4b87-b970-3ba7a36a62f1',
 'url': 'https://cartoframes-org.carto.com/u/cartoframes/kuviz/d5511e5e-f64f-4b87-b970-3ba7a36a62f1',
 'name': 'map_private_table',
 'privacy': 'password'}