There are three ways to connect data to Preset:
- Create a Table / Dataset;
- Load a CSV; or,
- Create a Query in SQL Editor
In this article we will explore the most popular method to connecting your data to Preset: creating a table / dataset.
Step 1: Create a Database
Preset supports a wide variety of databases, so there's a good chance that your favorite database can already be used with Preset. Popular databases include SQL Server, Vertica, and PostgreSQL.
For a full list of supported databases, have a look at the Supported Databases article.
Step 2: Connect the Database to Preset
To start, in the Toolbar, select Data and, in the drop-down menu, select Databases.
The Data - Databases screen appears featuring a list of all databases connected to Preset within your selected workspace.
To start the process, select the green + DATABASE button.
The Add Database window appears.
This interface is used to establish a connection between your database and Preset. This is done by specifying a name for your database as well as including a SQLAlchemy URI — please have a look at the SQLAlchemy documentation to learn how to structure your URI so that it connects successfully.
Feel free to use the Test Connection button to confirm that your database is connected.
At this stage, you are all done, but it is recommended to spend some time exploring the other configuration tabs: Performance, SQL Lab Settings, Security, and Extra.
Of particular note is the SQL Lab Settings tab. These fields are used to enable your database to interact with Preset's SQL Lab, a powerful query management tool that integrates tightly with the chart & dashboard creation process.
We recommend the following baseline settings in order to take advantage of SQL Lab's capabilities:
When done, select Add. Your newly-connected database will appear in the list of databases on the Data - Database screen.
Step 3: Add a Dataset to Preset
We're not done yet!
Although your database is now connected—which is a great start—we need to tell Preset which tables within your database should be available for user selection. Doing this enables users to select a datasource when creating a new chart.
This step is pretty straightforward. From the Data - Databases screen above, select the Datasets tab.
Like before, select the + DATASET button to add a new dataset.
The Add Dataset window appears.
In the Datasource field, select your newly-connected database. Wait just a moment — in this window, Preset will populate the next field based on your selection.
In the Schema field, select a schema from your database. As above, wait a moment for the table options to populate the next field.
Lastly, in the Table field, select a table. When done, select Add.
Great work! Congratulations, your database is now connected with Preset and a table within that database is available for selection by users.
You, and any colleagues within your workspace, can now select the table and use that data to build out their own visualizations!