Storing Images and Files in a Relational Database

A relational database table can be used as a cloud object store. Customers who choose this option typically do so to capture images via the app and keep them along with the data in the same repository (convenient for backup and data management). The downside is that images stored within a relational database are not easy to access directly --- they can only be accessed via the app.

Each image or file is saved as a separate row in a database table. Instead of a table, you can use an updateable view. You need a varchar(max) column which can hold the content (in base-64 encoded text format). You also need a column (at least nvarchar(256)) to hold a unique text "label" that is used to identify and retrieve the image. AppSheet will only read and write these columns. Any other columns in the database table should therefore be nullable.

How to configure a Relational Database as a Cloud Object Store

When you configure AppSheet, you will need to specify the database data source, the name of the table, and the names of the label column and the content column. If you expect this table to hold a large number of rows, it is a good idea to create a database index on the label column of this table.

Step 1: Add a relational database as a data source

Please read the existing documentation on adding data sources

Step 2: Add a database Object Store

From the Account -> Integrations -> Stores pane, choose Add and then choose "DB Content". This brings up a dialog where you can choose a database data source, a database table or view name, the label column name and the content column name.

Step 3: Configure the app table

In the AppSheet app editor, go to the Data -> Tables pane, open the definition for the specific table, and change its storage definition property called 'Store for image and file capture'. Select the database object store you just added. 

Did this answer your question?