HubSpot database schema
You can select to sync any of HubSpotâs standard CRM objects to your Sequin database:- Companies
- Contacts
- Deals
- Line items
- Owners
- Products
- Quotes
- Tickets
- Meetings
- Calls
- Tasks
- Postal Mail
- Communications
- Notes
The syncing process
HubSpot OAuth Apps like Sequin have dedicated rate limits:API | Syncs | Request limit | Interval |
---|---|---|---|
Standard | Owners, Pipelines, Associations | 100 | 10 seconds |
Search | Objects (e.g. Company, Contact, custom objects) | 4 | 1 second |
Because your synced tables share these rate limits, we recommend syncing what you need. If you realize you arenât using one or more synced HubSpot tables, removing it from your sync may speed up the other tables!
Associations
When you associate two objects in HubSpot, the association is undirected. When Contact A is associated with Company X, Company X is reciprocally associated with Contact A. You can use association labels to indicate the kind of association between two objects. For example, Contact A can be a Manager at Company X and also a Former Employee at Company Y; you would associate Contact A with both companies but label the associations differently. For any pair of object types, Sequin syncs all associations between objects of those types to an associative table. For example, every association between a Contact and a Company syncs to the tableassociations_company_contact
with the following structure:additional-fields
Column name | Postgres type | Example value | Description |
---|---|---|---|
company_id | text | â9457785876â | The associated companyâs HubSpot ID. |
contact_id | text | â36701â | The associated contactâs HubSpot ID. |
labels | text[] | The associationâs labels. |
associations_company_contact
, there wonât be a table with the opposite order (associations_contact_company
). These table names are a fixed function of the type names.
You can JOIN
using the associations tables:
associations_car_request
table with the columns car_id
and request_id
.
Writes
To write back to HubSpot, youâll connect via Sequinâs Postgres Proxy. The Proxy listens for changes. When you make a mutation, the Proxy applies the mutation to HubSpotâs API first. If the mutation succeeds, your database is updated as well. If it fails, your database mutation will be rolled back, and youâll receive a Postgres error. With this architecture, HubSpot is the source of truth. All your database changes are validated by HubSpotâs API first. Thereâs never a chance for the two to get out-of-sync.insert
To create a new record in the API, youâll use the insert
command. Hereâs how to insert a HubSpot contact
:
Without transactional batch inserts, bulk inserting records could get your data into an inconsistent state. For example, imagine you batch inserted 20 HubSpot contacts. 2 of them failed. Is your code going to pull those out and try them again? What about the other 18 you created successfully â should they remain created or do you want to roll them back?
update
To update a record in the API, youâll use the update
command. Hereâs how to update a HubSpot contact
:
delete
To delete a record in the API, youâll use the delete
command. Hereâs how to delete a HubSpot contact
:
- There may be other fields in your table, like
_sync_hash
,_sync_inserted_at
, and_sync_updated_at
. Donât be alarmed: Sequin uses these columns to keep data flowing into Postgres smoothly. Just donât tamper with this data