Export

View as Markdown

Exporting users to applications

The export of Krenalis users to an application is performed through a user export pipeline on an application connection.

When run, this pipeline determines the matches between Krenalis users and application users, and it then updates the application users' properties specified in the pipeline (or creates a new user if one did not already exist in the application) with the values returned by the pipeline's transformation.

In this scenario, therefore, Krenalis represents the authoritative source of data on the application, limited to the exported users (determined by the filter, the matching and the export mode) and limited to the properties exported to the application (determined by the pipeline transformation and the application connector).

Note that it is possible to specify for an export pipeline whether to update only users already existing on the application, create only new ones, or perform both operations,s depending on the match result.

Users matching

Exporting users to an application occurs by determining, through the matching of values of a property of Krenalis users and a property of users in the application, which Krenalis users correspond to the users of the application.

   Property of Krenalis's users            Property of application's users
 ┌────────────────────────────┐         ┌─────────────────────────────┐
 │                            │    =    │                             │
 └────────────────────────────┘         └─────────────────────────────┘

The property of application's users cannot be transformed; it is Krenalis, in case of creation, to export a value for that property based on the property of Krenalis's users.

Matching properties requirements

The two properties used for matching must meet the following requirements:

  • Type: both must have type string, int, or uuid. Other types, such as decimal, ip, array, map, and object, cannot be used. A property of an object can be used, referring to it by its path, for example contact.email.
  • Compatible types: an int property cannot be matched with a uuid property, and vice versa. All other combinations are allowed.
  • Semantics: both must have the same semantics, or both must have none. If the semantics has an option, it must also be the same: the format for country, and the unit for duration and measurement. For example, a property with email semantics can only be matched with another property with email semantics, and not with a string without semantics.
  • Not transformed: the property of the application's users cannot be set by the transformation, neither directly nor through the object that contains it.

Also, if the pipeline creates users in the application, the property of the application's users must be writable. Otherwise, the creation of users in the application fails.

Users conflicts

When exporting to an app, two different types of conflicts can occur, which are handled differently.

Case Consequences
Multiple users within Krenalis have the same value for the specified property. These users are not exported and an error is shown.
Multiple users on the application have the same value for the specified property. Whether to proceed with the export of these users or not depends on the configuration set in the pipeline.

How matching occurs

The comparison is done by comparing the string representations of the user property values in Krenalis with the string representations of the user property values in the application.

For this reason, it is also possible to compare properties with different types (e.g. string and uuid, or string and int), as values with different types could still have the same string representation and match. The only exception is int and uuid, which cannot be compared, as their string representations can never be equal.

For example

  • a Krenalis user has a property my_app_id with type uuid and value 7315ad40-fbe9-4ae3-80eb-6fd06f22f1fd
  • a user on the application has a property custom_id with type string and value 7315ad40-fbe9-4ae3-80eb-6fd06f22f1fd

Even if the types of the two properties are different, the two values represented as strings are:

  • 7315ad40-fbe9-4ae3-80eb-6fd06f22f1fd
  • 7315ad40-fbe9-4ae3-80eb-6fd06f22f1fd

And this determines the fact that, in the example, the Krenalis user matches with the user on the application.

Exporting users to databases

It is possible to export user data from Krenalis to a database table, creating or updating them.

Note that exporting to the database does not handle the deletion of users who are no longer present in Krenalis. Such users will remain in the table to which they have been exported, and it is the user's responsibility to remove them if necessary.

When exporting users to a database, both a table name and a table key property must be specified.

The table key property must be a property of the table, and it will be used as key for the insert / update queries on the database. It must have one of the following types:

  • string
  • int(n)
  • uuid

A value for the table key property must be returned by the transformation, as, otherwise, would be impossible to match the user with the users on the database's table.

Table keys and primary keys. For some database connectors, for example, MySQL, it is the user's responsibility to choose the primary key of the table as the table key property, otherwise the export won't behave consistently. In this regard, refer to the specific documentation for each database.

Exporting users to files

Ordering

When exporting users to a file, the order of the users is indicated through a pipeline setting, where you can choose a property path to sort users by.

This property must have one of these types:

  • string
  • int(n)
  • decimal(p,s), but only if scale s is 0
  • uuid
  • ip