Documentation

Primary Keys

Primary keys are a table property used to ensure uniqueness of the rows in the table. Each of your tables has one or more primary keys that are used together to define what represents a single unique row in the database. The process guarantees that no two rows have the same value in their primary key.

When new data is inserted into a table, it’s first checked against the existing data to determine if a row with the same value in the primary key already exists. If it does, the new row is used to update the existing row, rather than inserting a new one. However, unlike many databases, Panoply.io doesn’t do that by rejecting attempts to insert the new conflicting row with a unique error. Instead, it uses the new row to update some, or all, of the attributes in the existing row. This means that all write operations in Panoply.io are in essence upsert-operations.

Default Primary Keys

All the APIs have a default primary key for each and every table created from them. All the data sources use a field named “id” as the default primary key with some exceptions (MongoDB, for example, uses the _id attribute). If no primary key was given and there’s no default one (id field, for example), then a random value is generated instead. To successfully set the primary key, place each attribute name in curly brackets, for example: {first_name}-{last_name} will use the first_name and last_name attributes as the primary key of each row.