Storing Data with Team Databases
PixieBrix supports Team Database for storing data across mod runs, browsers, and team members.
A team database is a key-value store. Each record is referenced by a unique key, and stores a JSON object.
Creating a Team Database
To create a Team Database, open the Databases screen from the side nav.
Then, click the Create Database button:
Exporting a Team Database
PixieBrix supports exporting a Team Database as:
CSV
JSON
To export a database, click the Export button on the Database’s detail page:
In the modal, optionally select a date range to export:
Creating/Retrieving/Updating Database Records
Team Database records can be used within PixieBrix mods or with the Developer API
PixieBrix marketplace listing for database bricks:
Schemas
By default, Team Databases allow any shape of data to be stored in the database. However, you can also set a schema for the database, and optionally enforce that schema.
A schema describes the data shape and types that are contained in the Database.
In PixieBrix, database schemas are defined using the JSON Schema standard (the same standard used for defining brick input and output schemas in PixieBrix).
Default Schema
The default schema allows objects of any shape to be stored:
Copy
Required Fields
To require fields, use JSON Schema’s required attribute. For example:
Copy
Additional Properties
By default, JSON Schema objects allows additional fields that aren’t defined on the schema. To forbid additional properties, set additionalProperties: false
Forbidding additional properties is useful for preventing errors due to field name typos/misspelled fields
Copy
Enforcing a Schema
👮Enforcing a schema applies to new records and updates to existing records
To enforce a schema, toggle the “Enforce schema” toggle on the Database detail screen’s Schema tab:
When using the shallow
, deep
, and deep_append
merge strategies, PixieBrix enforces the schema for the resulting data (i.e., as opposed to the partial data in the update).
Last updated