Skip to content

Access your HubSpot data from PostgreSQL or MySQL

Last updated: October 26, 2026

Available with any of the following subscriptions, except where noted:

Use Data Out for PostgreSQL and MySQL to export selected HubSpot CRM data to tables in a database that you own. Each sync run writes a full snapshot of the selected data and replaces the previous snapshot. After the sync, you can query the tables with SQL or with your preferred BI and analytics tools to combine HubSpot data with other business data.

Please note: if you're a Super Admin, opt your account into the Data Studio beta to use this feature.

HubSpot Credits required for certain features syncing data directly from a single warehouse source in Data Studio to the HubSpot CRM doesn't consume HubSpot Credits. If you prepare the data in Data Studio before syncing (for example, by creating calculated fields or joining it with other data sources), those actions consume HubSpot Credits.



Understand limitations & considerations

Before you begin working with this feature, make sure to fully understand what steps should be taken ahead of time, as well as the limitations of the feature and potential consequences of using it.

  • Each sync replaces the destination tables with the latest snapshot. HubSpot doesn't keep previous snapshots.
  • Each object, event type, or association pair can be included in one recurring PostgreSQL sync and one recurring MySQL sync per HubSpot account. These syncs are independent of each other and of other Data Out providers.
  • Sensitive data isn't supported yet. Sensitive properties may be excluded from exports.
  • Object-specific tables, such as OBJECTS_CONTACTS, aren't supported yet.
  • Table and column names are case-sensitive in PostgreSQL and may be case-sensitive in MySQL. Review the query syntax before you write queries.

Understand the data you can export

You can sync the following data from HubSpot to PostgreSQL or MySQL:

  • Objects: standard and custom objects, such as contacts, companies, deals, tickets, and products.
  • Records: individual records for the selected objects.
  • Properties: selected property values and property history on records.
  • Associations: selected relationships between records, including association definitions.
  • Events: selected standard HubSpot events and custom behavioral events, including selected event properties.

Data for different objects is combined in the object tables. When you read an object table, use OBJECTTYPEID to filter to a specific object. For example, contacts use 0-1. Custom objects are assigned an ID when they're created and are identified as 2-{unique_id}, such as 2-12345.

Understand the export format

During setup, you choose:

  • The destination database. This applies to PostgreSQL only. For MySQL, HubSpot creates the database.
  • The data sources to sync: objects, events, associations, or a combination of these sources.
  • The sync schedule.

HubSpot exports the data as Parquet files and loads it directly into tables in your database. PostgreSQL and MySQL don't use a customer-owned staging bucket. HubSpot manages staging internally.

Find your data in your database

HubSpot creates one table per data source in a HubSpot-managed schema named after your destination. You can find the exact schema name on the configuration page of your sync.

  • PostgreSQL: <database>.hubspot_data_out_<destination-id>.<table-name>
  • MySQL: hubspot_data_out_<destination-id>.<table-name>. In MySQL, schema and database are the same concept, and HubSpot creates it. There's no separate database level to choose.

For example, in PostgreSQL:

  • your_database.hubspot_data_out_456.OBJECT_WITH_OBJECT_PROPERTIES
  • your_database.hubspot_data_out_456.EVENTS_VISITED_PAGE
  • your_database.hubspot_data_out_456.ASSOCIATIONS_CONTACTS_TO_COMPANIES

For example, in MySQL:

  • hubspot_data_out_456.OBJECT_WITH_OBJECT_PROPERTIES
  • hubspot_data_out_456.EVENTS_VISITED_PAGE
  • hubspot_data_out_456.ASSOCIATIONS_CONTACTS_TO_COMPANIES

Each sync replaces the table with the latest snapshot. HubSpot doesn't keep previous snapshots. If a table fails during a sync, its previous data stays in place until the next successful sync.

Table and column names

Table and column names come from the exported data. PostgreSQL identifiers are limited to 63 characters, and MySQL identifiers are limited to 64 characters. HubSpot shortens longer names to fit.

Identifier case

Identifier case matters. HubSpot creates all tables and columns with quoted, case-preserved names in uppercase, matching the tables in this article.

  • PostgreSQL: wrap names in double quotes exactly as shown. PostgreSQL folds unquoted names to lowercase, so they won't match.
  • MySQL: use backticks and match the case shown. Table name case sensitivity depends on your server configuration.

PostgreSQL example:

SELECT * FROM your_database.hubspot_data_out_456."OBJECT_WITH_OBJECT_PROPERTIES" WHERE "OBJECTTYPEID" = '0-1';

MySQL example:

SELECT * FROM `hubspot_data_out_456`.`OBJECT_WITH_OBJECT_PROPERTIES` WHERE `OBJECTTYPEID` = '0-1';

Column types

Column types follow the exported data and map to PostgreSQL and MySQL types as follows:

Exported type PostgreSQL MySQL
String TEXT LONGTEXT
Number (32-bit) INTEGER INT
Number (64-bit) BIGINT BIGINT
Timestamp TIMESTAMP DATETIME(6)
Boolean BOOLEAN TINYINT(1)
Decimal NUMERIC DECIMAL

Please note: the PROPERTIES column in OBJECT_WITH_OBJECT_PROPERTIES is exported as a JSON-formatted string. It's stored as TEXT in PostgreSQL or LONGTEXT in MySQL, not as a JSON column type. For query examples, see the FAQs.

Review object tables

If you select object data, HubSpot exports the following tables.

OBJECT_PROPERTIES

This table contains one row per property value. To read a specific object, filter by OBJECTTYPEID.

Column name Type Description
OBJECTTYPEID String The ID of the object. For example, contacts use 0-1.
OBJECTID Number The ID of the record.
NAME String The property name.
VALUE String The property value.
UPDATEDAT Timestamp The date and time when the property value was last updated in HubSpot.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

OBJECT_WITH_OBJECT_PROPERTIES

This table contains one row per record, with the selected property values grouped into a single PROPERTIES column. To read a specific object, filter by OBJECTTYPEID.

Column name Type Description
OBJECTTYPEID String The ID of the object. For example, contacts use 0-1.
OBJECTID Number The ID of the record.
PROPERTIES Text (JSON) The selected property values for the record, as a JSON-formatted string.
UPDATEDAT Timestamp The date and time when the selected properties of the record were last updated in HubSpot.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

OBJECT_PROPERTIES_HISTORY

This table contains property change history. Unlike OBJECT_PROPERTIES, which holds only the current value, this table has one row for each historical value of a property. To see the full timeline for a single record and property, order by UPDATEDAT.

Column name Type Description
OBJECTTYPEID String The ID of the object.
OBJECTID Number The ID of the record.
NAME String The property name.
VALUE String The property value at that point in time.
UPDATEDAT Timestamp The date and time when the value was set in HubSpot.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

Review association tables

If you select association data, HubSpot exports association records and association definitions.

ASSOCIATIONS

This table contains one row per selected association between two records.

Column name Type Description
COMBINEDASSOCIATIONTYPEID String The unique identifier for the association definition.
ASSOCIATIONCATEGORY String The origin of the association type. Values can include HUBSPOT_DEFINED, USER_DEFINED, or INTEGRATOR_DEFINED.
ASSOCIATIONTYPEID Number The identifier for the association definition within its category.
FROMOBJECTID Number The ID of the source record.
TOOBJECTID Number The ID of the destination record.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

ASSOCIATION_DEFINITIONS

This table contains one row per selected association definition.

Column name Type Description
COMBINEDASSOCIATIONTYPEID String The unique identifier for the association definition.
CATEGORY String The origin of the association type. Values can include HUBSPOT_DEFINED, USER_DEFINED, or INTEGRATOR_DEFINED.
ID Number The identifier for the association definition within its category.
FROMOBJECTTYPEID String The ID of the source object.
TOOBJECTTYPEID String The ID of the destination object.
NAME String The name of the association definition.
LABEL String The label of the association definition.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.
ISMAINASSOCIATIONDEFINITION Boolean Whether HubSpot displays this association definition as the primary association on associated records.

ASSOCIATIONS_<FROM_OBJECT>_TO_<TO_OBJECT>

For selected association pairs, HubSpot can also export pair-specific association tables, such as ASSOCIATIONS_CONTACTS_TO_COMPANIES. These tables include association records together with association definition metadata.

Column name Type Description
COMBINEDASSOCIATIONTYPEID String The unique identifier for the association definition.
ASSOCIATIONCATEGORY String The origin of the association type. Values can include HUBSPOT_DEFINED, USER_DEFINED, or INTEGRATOR_DEFINED.
ASSOCIATIONTYPEID Number The identifier for the association definition within its category.
[FROMOBJECT]_OBJECTID Number The ID of the source record. For example, CONTACT_OBJECTID.
[TOOBJECT]_OBJECTID Number The ID of the destination record. For example, COMPANY_OBJECTID.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.
TOOBJECTTYPEID String The ID of the destination object.
FROMOBJECTTYPEID String The ID of the source object.
NAME String The name of the association definition.
LABEL String The label of the association definition.
ISMAINASSOCIATIONDEFINITION Boolean Whether HubSpot displays this association definition as the primary association on associated records.

Review event tables

If you select event data, HubSpot exports one table per event type. Table names use the format EVENTS_<EVENT_NAME>, such as EVENTS_VISITED_PAGE.

Each event table contains standard event columns and one column for each selected event property.

Column name Type Description
EVENTTYPEID String The event type ID.
ID String The unique event ID.
OBJECTTYPEID String The ID of the object associated with the event.
OBJECTID Number The ID of the record associated with the event.
INGESTEDAT Timestamp The date and time when the event was ingested into the export source.
OCCURREDATDATEINT Number The event date as an integer in YYYYMMDD format.
OCCURREDAT Timestamp The date and time when the event occurred.
PROPERTY_<PROPERTY_NAME> String A selected event property. For example, a property named page_title is exported as PROPERTY_PAGE_TITLE.

Manage the sync schedule

You configure the sync schedule during setup in HubSpot. You can also manually trigger a re-sync from HubSpot. Each sync run produces a full snapshot of the selected data. To control data volume, choose which objects, events, associations, and properties to include.

Please note: during the beta, only a limited set of sync frequencies may be available, such as once, every 6 hours, every 12 hours, daily, weekly, and monthly. Additional frequency options may be added in future releases.

Monitor syncs and handle errors

You can monitor PostgreSQL and MySQL syncs in HubSpot. A sync can have one of the following states:

State Meaning
Syncing A sync run is currently in progress.
Synced The last sync completed successfully.
Failed The last sync run encountered an error.
Archived The sync configuration was archived or removed.

When a sync fails:

  • HubSpot shows a Failed status with per-table details showing which tables succeeded or failed.
  • A table is updated only after HubSpot finishes loading all of its data, so you never see a partially loaded table.
  • If a table fails, its previous data stays in place until the next successful sync.
  • The next scheduled sync automatically reattempts a full sync.
  • You can manually trigger a re-sync at any time in HubSpot.

Tables that succeeded in a previous run aren't modified when a later run fails.

FAQs

How do I query the data?

Query the tables in your destination schema with SQL.

PostgreSQL

Read all contact records:

SELECT * FROM your_database.hubspot_data_out_456."OBJECT_WITH_OBJECT_PROPERTIES" WHERE "OBJECTTYPEID" = '0-1';

Read a specific property from the PROPERTIES JSON column. Cast the column to JSON first, because it's stored as text:

SELECT "OBJECTID", json_extract_path_text("PROPERTIES"::json, 'email') AS email FROM your_database.hubspot_data_out_456."OBJECT_WITH_OBJECT_PROPERTIES" WHERE "OBJECTTYPEID" = '0-1';

MySQL

Read all contact records:

SELECT * FROM `hubspot_data_out_456`.`OBJECT_WITH_OBJECT_PROPERTIES` WHERE `OBJECTTYPEID` = '0-1';

Read a specific property from the PROPERTIES JSON column:

SELECT `OBJECTID`, JSON_EXTRACT(`PROPERTIES`, '$.email') AS email FROM `hubspot_data_out_456`.`OBJECT_WITH_OBJECT_PROPERTIES` WHERE `OBJECTTYPEID` = '0-1';

Can I export one data type in multiple syncs?

Each object, event type, or association pair can be included in one recurring PostgreSQL sync and one recurring MySQL sync per HubSpot account. These syncs are independent of each other and of other Data Out providers. For example, if contacts are already exported to a recurring PostgreSQL destination, you can't add contacts to another recurring PostgreSQL sync until you archive the first sync. You can still export contacts to a recurring MySQL sync at the same time.

Are object-specific tables supported?

No. Object-specific tables, such as OBJECTS_CONTACTS, aren't supported yet. Use OBJECT_WITH_OBJECT_PROPERTIES and filter by OBJECTTYPEID to get records for a specific object.

Is sensitive data supported?

No. Sensitive data isn't supported for Data Out yet. Sensitive properties may be excluded from exports.

Does HubSpot keep previous snapshots?

No. Each sync replaces the destination table with the latest snapshot, so previous snapshots aren't kept.

Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.