#!/usr/bin/env python # coding: utf-8 # ## 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: You'll need [CARTO Account](https://carto.com/signup) credentials to reproduce this example._ # 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 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')