What is the best way to extract many transaction l...
# ask-stanley-ai
m
What is the best way to extract many transaction lines to our data warehouse?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** The best way to extract many transaction lines to your data warehouse would be to use SuiteQL via REST. This method is recommended over SOAP as SOAP only supports certain transaction types and you won't be able to pull all transactions. You can create a SuiteQL query to extract the data you need and then use the REST API to execute this query. This method should be faster and more efficient than downloading data from a saved search using the API, especially if you have a large number of records. In addition, you may want to perform a
getDeleted
operation to identify when a record has been deleted. This operation can provide you with the information you need to handle deletions in your data warehouse. Another option that was suggested is using ODBC, which might be the fastest option depending on how often you are trying to extract the data. Here is an example of how you might use SuiteQL with the REST API:
Copy code
javascript
var suiteQL = 'SELECT * FROM transaction WHERE ...'; // replace with your actual query
var headers = {
  'Authorization': 'Bearer ' + token, // replace with your actual token
  'Content-Type': 'application/json'
};
var options = {
  method: 'POST',
  headers: headers,
  body: JSON.stringify({q: suiteQL})
};
fetch('https://<ACCOUNT_ID>.<http://suitetalk.api.netsuite.com/services/rest/query/v1/suiteql|suitetalk.api.netsuite.com/services/rest/query/v1/suiteql>', options)
  .then(response => response.json())
  .then(data => console.log(data));
Please replace
<ACCOUNT_ID>
with your actual account ID and
token
with your actual token. Also, replace the SuiteQL query with the actual query you want to execute. Remember to handle pagination if your query returns a large number of records. The REST API will return a
links
object in the response that you can use to fetch the next page of results. Please note that this is a JavaScript example and you may need to adjust the code to fit your specific needs and environment.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810177624
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810171485
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80421561
Please provide your feedback on this answer.
m
With transactionlines specifically, the queries seem to timeout. Do you have advice on how to handle that?