Feeling stuck with Segment? Say 👋 to RudderStack.

SVG
Log in

How to load data from Pipedrive to Snowflake

How to Extract my data from Pipedrive

Pipedrive exposes its complete platform to developers through their API. As a Web API following the RESTful architecture principles, it can be accessed through HTTP.

As a RESTful API, interacting with it can be achieved by using tools like CURL or Postman or by using HTTP clients for your favorite language or framework. A few suggestions:

  • Apache HttpClient for Java
  • Spray-client for Scala
  • Hyper for Rust
  • Ruby rest-client
  • Python http-client

Pipedrive API Authentication

Pipedrive API Authentication is API-Key based. You acquire an API Key from the platform and you can use it to securely authenticate to the API. All the calls are executed over secure HTTPS.

Pipedrive rate limiting

Rate limiting is considered per API token. API allows performing 100 requests per 10 seconds.

Every API response includes the following headers:

  1. X-RateLimit-Limit: the amount of requests the current API token can perform for the 10 seconds window.
  2. X-RateLimit-Remaining: the amount of requests left for the 10 seconds window.
  3. X-RateLimit-Reset: the amount of seconds before the limit resets.

In case the limit is exceeded for the time window, the Pipedrive API will return an error response with HTTP code 429 and Retry-After header that will indicate the amount of seconds before the limit resets.

Endpoints and available resources

Pipedrive exposes a large number of endpoints from which we can interact with the platform. These endpoints can be used to execute commands like adding a new person to our contact list but also to pull data from it. A unique characteristic of the Pipedrive API is that for many of the resources a companion resource exists which manages the custom fields that you might have created for the resource. In this way, maximum flexibility is offered to the users of the platform.

The list of available resources follows:

  • Activities: Activities are appointments, tasks, and events in general that can be associated with a deal and your sales pipeline.
  • Activity Fields: custom fields created for your activities.
  • Activity Types: user-defined types for your activities
  • Authorization: Authorization objects can be fetched without an API token but using an email and password.
  • Currencies: Supported currencies which can be used to represent the monetary value of a Deal, or a value of any monetary type custom field.
  • Deals: Deals represent ongoing, lost, or won sales to an organization or to a Person.
  • Deal Fields: DealFields represent the near-complete schema for a Deal in the context of the company of the authorized user.
  • Email Messages: EmailMessages represent e-mail messages sent or received through Pipedrive designated e-mail account.
  • Email Threads: EmailThreads represent e-mail message threads that contain individual e-mail messages.
  • Files: Files are documents of any kind (images, spreadsheets, text files, etc) that are uploaded to Pipedrive
  • Filters: Each filter is essentially a set of data validation conditions.
  • Goals: Goals help your team meet your sales targets.
  • Mail Messages: MailMessages represent mail messages that are being synced with Piperive using the 2-way sync or the Smart Email BCC feature.
  • MailThreads: MailThreads represent mail threads that contain individual mail messages.
  • Notes: Notes are pieces of textual (HTML-formatted) information that can be attached to Deals, Persons, and Organizations.
  • Note Fields: Custom fields for Notes.
  • Organizations: Organizations are companies and other kinds of organizations you are making Deals with.
  • Organization Fields: OrganizationFields represent the near-complete schema for an Organization in the context of the company of the authorized user.
  • Persons: Persons are your contacts, the customers you are doing Deals with
  • Person Fields: Custom fields for persons.
  • Pipelines: Pipelines are essentially ordered collections of Stages.
  • Products: Products are the goods or services you are dealing with.
  • Product fields: ProductFields represent the near-complete schema for a Product.
  • Stages: Stage is a logical component of a Pipeline and essentially a bucket that can hold a number of Deals.
  • Users: Users are people with access to your Pipedrive account.

For a detailed list of all endpoints together with a way to make requests to them without a client to see any data they return, if you have a Pipedrive account. Please check here.

It is clear that with such a rich platform and API, any data that can be pulled out of Pipedrive are both valuable and come in large quantities. So, let’s assume that we want to pull all the persons out of Pipedrive to use the associated data for further analysis. To do so we need to make a GET request with your favorite client to the Persons’ endpoint like this.

JAVASCRIPT
GET https://api.pipedrive.com/v1/persons?start=0&api_token=YOUR_KEY

The response headers and the actual response will look like the following:

JAVASCRIPT
{
"server": "nginx",
"date": "Tue, 06 Sep 2016 15:46:38 GMT",
"content-type": "application/json",
"transfer-encoding": "chunked",
"connection": "keep-alive",
"x-frame-options": "SAMEORIGIN",
"x-xss-protection": "1; mode=block",
"x-ratelimit-limit": "100",
"x-ratelimit-remaining": "99",
"x-ratelimit-reset": "10",
"access-control-allow-origin": "*"
}
{
"success": true,
"data": [
{
"id": 1,
"company_id": 1180166,
"owner_id": {
"id": 1682699,
"name": "Kostas",
"email": "costas.pardalis@gmail.com",
"has_pic": true,
"pic_hash": "39bf355364aacbde4fdfed3cef8a4589",
"active_flag": true,
"value": 1682699
},
"org_id": null,
"name": "Fotiz",
"first_name": null,
"last_name": "Fotiz",
"open_deals_count": 0,
"closed_deals_count": 0,
"participant_open_deals_count": 0,
"participant_closed_deals_count": 0,
"email_messages_count": 0,
"activities_count": 0,
"done_activities_count": 0,
"undone_activities_count": 0,
"reference_activities_count": 0,
"files_count": 0,
"notes_count": 0,
"followers_count": 1,
"won_deals_count": 0,
"lost_deals_count": 0,
"active_flag": true,

Inside the response, there will be an array of objects with each one representing one Person as it is represented in Pipedrive. Please note that all data are serialized in JSON.

[@portabletext/react] Unknown block type "aboutNodeBlock", specify a component for it in the `components.types` prop

Pipedrive Data Preparation for Snowflake

The first step, before you start ingesting your data into a Snowflake data warehouse instance, is to have a well-defined schema of your data.

Data in Snowflake is organized around tables with a well-defined set of columns with each one having a specific data type.

Snowflake supports a rich set of data types. It is worth mentioning that a number of semi-structured data types is also supported. With Snowflake, it is possible to load data directly in JSON, Avro, ORC, Parquet, or XML format. Hierarchical data is treated as a first-class citizen, similar to what Google BigQuery offers.

There are also one notable common data type that is not supported by Snowflake. LOB or large object data type is not supported. Instead, you should use a BINARY or VARCHAR type. But these types are not that useful for data warehouse use cases.

A typical strategy for loading data from Pipedrive to Snowflake is to create a schema where you will map each API endpoint to a table.

Each key inside the Pipedrive API endpoint response should be mapped to a column of that table and you should ensure the right conversion to a Snowflake data type.

Of course, you will have to ensure that as any data types from the Pipedrive API might change, you will adapt your database tables accordingly. There’s no such thing as automatic data type casting.

After you have a complete and well-defined data model or schema for Snowflake, you can move forward and start loading your data into the database.

[@portabletext/react] Unknown block type "aboutNodeBlock", specify a component for it in the `components.types` prop

Load data from Pipedrive to Snowflake

Usually, data is loaded into Snowflake in a bulk way, using the COPY INTO command. Files containing data, usually in JSON format, are stored in a local file system or in Amazon S3 buckets. Then a COPY INTO command is invoked on the Snowflake instance, and data is copied into a data warehouse.

The files can be pushed into Snowflake using the PUT command into a staging environment before the COPY command is invoked.

Another alternative is to upload every data directly into a service like Amazon S3, from where Snowflake can access data directly.

Finally, Snowflake offers a web interface as a data loading wizard where someone can visually setup and copy of data into the data warehouse. Just keep in mind that the functionality of this wizard is limited compared to the rest of the methods.

Snowflake in contrast to other technologies like Redshift does not require a data schema to be packed together with the data that will be copied. Instead, the schema is part of the query that will copy data into the data warehouse. This simplifies the data loading process and offers more flexibility on data type management.

Updating your Pipedrive data on Snowflake

As you will be generating more data on Pipedrive, you will have to update your older data on Snowflake. This includes new records together with updates to older records that for any reason have been updated on Pipedrive.

You ought to periodically check Pipedrive for new data and repeat the process that has been described previously while updating your currently available data if needed. Updating an already existing row on a Snowflake table is achieved by creating UPDATE statements.

Snowflake has a great tutorial on the different ways of handling updates, especially using primary keys.

Another issue that you need to take care of is the identification and removal of any duplicate records on your database. Either because Pipedrive does not have a mechanism to identify new and updated records or because of errors on your data pipelines, duplicate records might be introduced to your database.

In general, ensuring the quality of data inserted in your database is a big and difficult issue.

The best way to load data from Pipedrive to Snowflake

So far, we just scraped the surface of what you can do with Snowflake and how to load data into it. Things can get even more complicated if you want to integrate data coming from different sources.

Are you striving to achieve results right now?

Instead of writing, hosting, and maintaining a flexible data infrastructure use RudderStack that can handle everything automatically for you.

RudderStack, with one click, integrates with sources or services, creates analytics-ready data, and syncs your Pipedrive to Snowflake right away. Don't want to go through the pain of direct integration? RudderStack’s Pipedrive to Snowflake integration makes it easy to send data from Pipedrive to Snowflake.

Sign Up For Free And Start Sending Data

Test out our event stream, ELT, and reverse-ETL pipelines. Use our HTTP source to send data in less than 5 minutes, or install one of our 12 SDKs in your website or app.

Don't want to go through the pain of direct integration?

RudderStack's Pipedrive integration

makes it easy to send data from Pipedrive to Snowflake.