How to load data from NetSuite to Redshift
Access your data on NetSuite
The first step in loading data from NetSuite to any data warehouse solution is accessing them and starting extracting them. NetSuite’s data model comes into to three following versions:
- SuiteScript Model: Suitable if working with Script or the Workflow Tool.
- Web Service Model: Suitable when external applications need to connect to NetSuite.
- ODBC/JDBC Model: Available when SuiteAnalytics module is purchased. This allows you to connect to a read-only version of NetSuite to use ODBC or JDBC drivers.
Although differences do exist among the models mentioned above, the main types of information are always present and, among others, include the following:
- Accounts
- Transactions
- Campaigns
- Revenue Recognition
When working with the SuiteScript Model, you can extend the SuiteScript API using RESTlet.This way, you can deploy server-side scripts that interact with NetSuite data following RESTful principles. RESTlet offer ease of adoption for developers familiar with SuiteScript and support more behaviors than NetSuite’s SOAP-based web services, which are limited to those defined as SuiteTalk operations.
On the other hand, if you choose the Web Service model you will have to work with NetSuite's web services API, which is implemented using the SOAP protocol, adding some complexity to your development as you will have to manage SOAP and XML responses.
Also, keep in mind that you will have to respect the API usage limits as in every other API and make sure that you handle errors correctly.
Transform and prepare your NetSuite data for Amazon Redshift
After you have accessed data on NetSuite, you will have to transform it based on two main factors,
- The limitations of the database that is going to be used
- The type of analysis that you plan to perform
Each system has specific limitations on the data types and data structures that it supports. If you want to push data into Google BigQuery, you can send nested data like JSON directly. Keep in mind that you will get XML responses if you are working with the web services SOAP API. Of course, when dealing with tabular data stores, like Microsoft SQL Server, this is not an option. Instead, you will have to flatten out your data, just as in the case of JSON, before loading it into the database.
Of course, when dealing with tabular data stores, like Microsoft SQL Server, this is not an option. Instead, you will have to flatten out data, just as in the case of JSON, before loading it into the database.
Also, you have to choose the right data types. Again, depending on the system, you will send data to and the data types that the API exposes to you, you will have to make the right choices. These choices are important because they can limit the expressivity of your queries and limit your analysts on what they can do directly out of the database.
With the NetSuite web services API, you also have two main additional sources of complexity. When it comes to data types, you have to keep in mind that SOAP is using XML to describe the service and data. So, the data types you have to map are coming from XML and might have automatically been transformed into the primitive data types of the language you are using.
Export data from NetSuite to Amazon Redshift
Amazon Redshift is built around industry-standard SQL with added functionality to manage very large data sets and high-performance analysis. So, to load any data into it, you will have to follow its data model, a typical relational database model. Data you extract from your data source should be mapped into tables and columns where you can consider the table as a map to the resource you want to store and columns the attributes of that resource.
Also, each attribute should adhere to the data types that are supported by Redshift.
As data is probably coming in a representation like JSON - that supports a much smaller range of data types - you have to be careful about what data you feed into Redshift. You also need to make sure that you have mapped your types into one of the data that Redshift supports.
Designing a Schema for Redshift and mapping every data from your preferred data source to it is a process that you should take seriously as it can both affect the performance of your cluster and the questions you can answer. It’s always a good idea to have in your mind the best practices that Amazon has published regarding the design of a Redshift database. When you have concluded on the design of your database, you need to load data on one of the data sources that are supported as input by Redshift, and these are the following:
Load your data from NetSuite into Amazon Redshift
To upload any data to Amazon S3, you will have to use the AWS REST API. APIs play an important role in both the extraction and the loading of data into our data warehouse. The first task you have to perform is to create a bucket, and you do that by executing an HTTP PUT on the Amazon AWS REST API endpoints for S3.
You can do this by using a tool like CURL or Postman or use the libraries provided by Amazon for your favorite language. You can find more information by reading the API reference for the Bucket operations on Amazon AWS documentation.
After you have created your bucket, you can start sending data to Amazon S3, using the same AWS REST API again but using the endpoints for Object operations. As in the Bucket case, you can either access the HTTP endpoints directly or use your preferred library.
Amazon Redshift supports two methods for loading data into it. The first one is by invoking an INSERT command. You can connect to your Redshift instance with your client using either a JDBC or ODBC connection, and then you perform an INSERT command for your data.
The way you invoke the INSERT command is the same as you would do with any other SQL database. For more information, you can check the INSERT examples page on the Redshift documentation.
Redshift is not designed for INSERT-like operations. On the contrary, the most efficient way of loading data into it is by doing bulk uploads using a COPY command.
You can perform a COPY command for data that lives as flat files on S3 or from an Amazon DynamoDB table. When you perform COPY commands, Redshift can read multiple files simultaneously, and it automatically distributes the workload to the cluster nodes and performs the load in parallel.
The best way to load data from NetSuite to Redshift
So far, we just scraped the surface of what you can do with Redshift 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 NetSuite to Redshift right away.