Database syncer
Sync user data from an external database into Hanzo IAM.
The database syncer connects to an external database and syncs user data into Hanzo IAM. A demo users table can be imported from the template XLSX.

Create a syncer
Go to Syncers and create a new syncer with the following. Save when done.

:::tip
Fill at least ID and Name in the Hanzo IAM column mapping. Other useful fields include createdTime, Password, and DisplayName.
:::
Required fields
| Field | Description |
|---|---|
| Organization | Organization to import users into. |
| Name | Syncer name. |
| Type | database. |
| Host, Port, User, Password | Source database connection. |
| Database type | MySQL, PostgreSQL, SQL Server, Oracle, or SQLite (Xorm-supported). |
| Database | Source database name. |
| Table | Source user table name. |
| Table columns | Column name (source), Column type (source), Hanzo IAM Column (Hanzo IAM user field). |
Optional fields
| Field | Description |
|---|---|
| Is hashed | If enabled, sync runs only when fields included in the hash change; other field-only changes do not trigger sync. |
| Is key | Marks the primary key used to match source and Hanzo IAM users. At least one column must be key; if none is set, the first is used. |
| Avatar base URL | If set and source user.avatar does not start with http, Hanzo IAM stores Avatar base URL + user.avatar. |
| Affiliation table | Table used to sync user affiliation. Int codes can be mapped to names; see getAffiliationMap() and syncer_util (e.g. score for int→string mapping). |
Enable Is enable and save; the syncer will run. You can also trigger a sync with the Sync button.

Update
With Table columns configured for key mapping, differences on the key between source and Hanzo IAM trigger updates:
- Update in source table — changes sync to Hanzo IAM.
- Update in Hanzo IAM — changes sync back to source.
Add
When row counts differ, the syncer adds rows to the table with fewer rows, using the key to match:
- Add user in source table:
- Add user in Hanzo IAM table:
How is this guide?
Last updated on