Mitto allows users to create data editor pages in Mitto's UI. These simple, editable database tables allow you to add, edit, or delete rows from any table in any database Mitto has access to.

Source Table

The source table you wish to expose as a Mitto data editor must have a primary key.

Mitto uses this primary key when inserting, updating, and deleting rows from user action in the data editor UI.

If your source table does not have a primary key, it won't work as a data editor in Mitto. Add a primary key to your source table to remedy this.

Create a new Datasource

The first step in setting up a data editor in Mitto involves adding a row to an internal Mitto database table: public.datasource.

This datasource table stores information about all the data editors in Mitto. Unless you have an existing data editor, this table will be empty.

In your SQL client of choice connect to Mitto's PostgreSQL database named mitto. Alternatively, this SQL can be run as a Mitto SQL job.

Create a new row in the public.datasource table with an insert statement similar to this:

INSERT INTO
    public.datasource (name, dbo, "schema", "table", updated_at, created_at, markdown)
VALUES
('data_editor_name', 'postgresql://localhost/analytics', 'schema_name', 'table_name', NOW(), NOW(),
 'Data Source Example')
;

The datasource table expects the following columns:

  • id = primary key. We omit this and let it auto-increment
  • name = the name of the data editor (use lower case and no spaces - snake case)
  • dbo = the database url / connection string (Use postgresql://localhost/analytics if you want to reference a table in the built in database) See Database Inputs for more information.
  • schema = the database schema of the data editor table
  • table = the database table of the data editor table
  • markdown = description of the data editor
  • updated_at = use now's value
  • created_at = use now's value

Create a Navigation Item for the Data Editor

In the bottom left corner of the Mitto UI hover over the + Add button, then when it appears, click on Navigation.

Add Navigation Button
Add Navigation Button

A wizard to create a new navigation item will open.

Navigation Item Wizard
Navigation Item Wizard

For Data Editors the important fields to include are the following:

  • Name = The name/title of the Navigation Item. This name will appear in the navigation sidebar on the left side of the Mitto UI.
  • Type = App State
  • State = data({table:"<name from the datasource table>"})

Learn more about custom navigation items in Mitto.

Using the Data Editor

Once you have a row in the datasource table, and a Navigation Item for your Data Editor, a link will appear in the navigation bar on the left side of the Mitto UI. Clicking on the link will open the Data Editor.

Example Data Editor
Example Data Editor
  • Add Row - Add a new row to the data table.
  • Edit Row (Pencil) - Update a row
  • Delete Row (Trashcan) - Delete a row after a confirm dialogue.