Settings
/
Managing Data Sources

Managing Data Sources

Once you connect at least one data source, you can manage the resources and functions associated with that source. You can also adjust how you want to sync the data source, and update connection details if needed. 

Access this through Company Settings → Data Sources. You can add a new data source or view the function library.

Click on a data source to manage its settings.

Connectivity

Click “View” to see your current connection settings for this data source and make any updates - hit “Save” after you’re done. 

Sync

Click “Sync” to start a manual sync of the data from your data source into Internal. This will update the schema and associated data changes. 

Click “View” to see more details about your sync history, and to change your sync from “Automatic” to “Manual”. If set to Automatic, Internal will sync the data source daily (at the time shown). On Manual, Internal will only sync when you come to this page and trigger a manual sync of your data. 


Resources 

Resources refer to the datasets contained within each data source, like a table within a database, the Organizations data from Salesforce, or the Tickets data from Zendesk.

Example: Your PostgreSQL database contains a Customers table and an Orders table; both of these tables are resources. 


Resources are generated automatically where possible, and you can also define your own custom resources using SQL. When you connect a database, a resource is generated for each table in that database. When you connect a business app, resources are generated based on the specific app.

Example: Salesforce will generate “Deals”, “Contacts”, “Organizations”, while Stripe will generate “Charges”, “Refunds”, etc. Check out the documentation for a specific data source to see what’s generated automatically. 


Managing resources

Click “View” to see a list of the resources contained in this data source.

The name of the resource on the left comes from your data source - you can update the display name on the right. Expand each resource to see the individual fields (columns) within each, and update the display names for each field. In addition, you can use the checkbox to choose what field(s) should be the primary key(s) for this resource. 


A primary key is a field (column) whose data uniquely identifies each row in the table. Often, these fields are IDs, like a user ID or customer ID, but can also be uniquely identifying fields like email addresses. Internal displays the primary key by default in the first column, and defaults the primary key as the header in the record view of a resource. 


Create a new resource

You can also create your own resources through several different methods:

1) Define a new resource using SQL. This custom resource allows you to use fields that come from multiple existing resources. For example, you may want to create a resource that uses the “Company Name” from your Companies table and the “Order Amount” from your Orders table.

2) Populate a resource through an HTTP request. This allows you to create a new resource using data that is read through an HTTP request.

3) Use aggregation pipeline (MongoDB).

Functions

Functions let you perform various actions on your data. You can manage and create functions here (within Data Sources), and then connect your components to functions in Spaces. A function can update a specific record, bulk update multiple records that fit a certain criteria, or even call an API endpoint and pass parameters. 


When you connect a database, basic CRUD functions are generated automatically, allowing you to insert, update, and delete a single record. These functions will appear as long as the credentials used to connect to the database have these privileges. Connecting a business app will generate similar CRUD functions. Check out the documentation for a specific data source to see what functions are generated automatically. 


Managing functions

You’ll see buttons to “Add New” and “View”: these apply to custom functions you can create (see below). You won’t see auto-generated functions in the function library. 


In some cases, you may want a function to act on more than one record (bulk update). You can do that by creating a custom function for a database


Internal also gives you the ability to create functions from your existing APIs or graphQL mutations. This can greatly extend the functionality of the tools you build. To do this, you can create a custom function for a HTTP data source.