Named Sources
Last updated
Last updated
With Named Sources you can make sure that your applications communicate with CARTO without exposing SQL queries in the code or through the network requests.
Using Named Sources in your application does not change the overall architecture, which will remain very efficient, lightweight and modern — in most cases, it won't require additional backend services.
Named Sources work by using a very simple principle:
Store a SQL query in CARTO as a Named Source.
Use your new Named Source in a CARTO for Developers application by simply referencing its name instead of a SQL Query, in any function or endpoint that accepts a sqlQuery
parameter.
To create a new Named Source, go to Developers > Named Sources and click on "Create New". For each Named Source, you'll need to define:
Name: this will be the reference you will be using in your application's code.
SQL statement: the SQL query that will be used when this Named Source is referenced. Please note that all SQL functionalities are supported, including query parameters.
Click on "Save Changes" and your Named Source will be ready to be used.
When using API Access Tokens, remember to add the Named Sources to the grant of the token. Otherwise, the token won't be authorized to use your Named Source.
Named Sources can be edited or deleted at any time. To manage them, simply click the three-dot menu next to each Named Source.
You can programmatically manage and deploy Named Sources using the Named Sources API. You can also programmatically assign Named Sources to the grants in API Access Tokens using the Tokens API. For more information, check the CARTO API Reference.