Put data in PixieBrix database

by @pixiebrix

Create/update a PixieBrix database record


How to Use

Use the Put data in PixieBrix database brick to create/update records in PixieBrix Team and Personal Databases. Databases enable you to store information across runs of a blueprint, your PixieBrix browser extension installs, and team members.

You can retrieve Database records using one of the following methods: - Use the Get Data from PixieBrix database brick - Retrieve/export the data via the PixieBrix Developer API - Export the database from the Admin Console

Key-Value

The two inputs required to put data in a PIxieBrix database are:

  • Key: a text key identifying the record. Used to retrieve the record in the future
  • Value: the value to store at the key

Database Keys

In practice, the following key formats are most commonly used:

  • URL key: @input.url useful for tracking additional information with a page, e.g., comments and annotations. Note that the @input.url corresponds to the site’s URL at the time the blueprint ran. To get current URL, use the Context reader brick
  • Entity identifier key: a reference number/identifier from the application you are using, e.g., a case number, account number, etc. These can often be parsed from the URL using the Regex Extractor brick, or from the page content using the jQuery Selector reader brick
  • Timestamp-based key: for logging events that you don’t need to lookup later, use a timestamp based key. You can generate a timestamp using the Generate a timestamp brick. For multi-user scenarios, you can combine with the email from the Session reader brick. For example {{@session.email}}-{{@instant.timestamp}}

Advanced: Merge Strategy

The Merge Strategy controls how the data is updated if a record with the key already exists. There are 4 merge strategies:

  • replace (default): replace record
  • shallow merge: replace the top-level properties in the record, but keep other values
  • deep merge: recursively merge nested properties
  • deep_append: recursively merge nested properties. For lists, append the new values to the end of the existing lists

Inputs

Name Required Type Description
key string A unique key for the record
value object The data to store in the database
service @pixiebrix/api integration
databaseId string The database id
mergeStrategy string Strategy to update the record if it already exists

Outputs

Name Required Type Description
No outputs for this brick defined.

@pixiebrix/data/put

Version

1.2.1

Created

Aug. 29, 2021

Updated

Nov. 13, 2022