Quick Start
Here's a quick primer on how to start with data query and load operations in Speediful.
Complete the Installation
All the installation steps must be completed successfully before using Speediful
With the support of a system administrator, complete the installation steps.
When using Speediful for the first time in a database, or after upgrading, be sure to run the included SQL scripts to set up your environment.
Add a Salesforce Connection
Use the SLAM_add_connection procedure to add a Salesforce connection. The credentials will be tested. If successful, they will be stored and activated for use.
Follow the Salesforce documentation to obtain or reset your Salesforce security token, if needed.
All Speediful Salesforce operations made from this database environment will use the activated connection and execute on Salesforce as its associated user. This has important impacts in terms of permissions, sharing and access, and default values (such as CreatedById and LastModifiedById fields).
EXEC dbo.SLAM_add_connection
@username = 'username',
@password = 'password',
@token = 'security_token',
@domain = 'test', -- One of: login, test (for sandboxes), or the Salesforce custom domain. Developer orgs use login
@environment_name = 'partial' -- Alias that appears in activity log table
-- Check the active Username in SLAM_Settings
SELECT * FROM SLAM_Settings
Query Data
Use any one of the following procedures to query data:
- SLAM_query_bulk (uses the Salesforce Bulk v1 API)
- SLAM_query_bulkv2 (uses the Salesforce Bulk V2 API)
- SLAM_query_soap (uses the Salesforce SOAP API)
- SLAM_query (for when you prefer to specify the API to use as a parameter)
The above operations use different Salesforce APIs. The best API to use depends on the operation profile. Refer to the API Selection Guidelines for additional information.
The query documentation explains advanced usage, including:
- Enabling PK Chunking
- Controlling the batch size
- Retrieving deleted and archived records
- What to do if the destination table already exists
Perform a full copy of a Salesforce object:
EXEC dbo.SLAM_query_bulk
@query = 'Account', -- When just the sObject name is provided, this is treated as SELECT * FROM sObject
@table = 'Account_query'; -- The destination table. By default, if the table exists, it will be overwritten
SELECT * FROM Account_query;
Or, providing a query string:
EXEC dbo.SLAM_query
@query = 'SELECT Id, Name, Email, Account.Name FROM Contact WHERE CreatedDate = TODAY',
@table = 'Contact_query',
@api = 'soap';
SELECT * FROM Contact_query;
You will notice that every SLAM operation is logged:
SELECT * FROM SLAM_Activity_Log;
Replication
Use SLAM_replicate for fast, parallelized multi-object extraction from Salesforce
-- Initiate simultaneous bulk replication of the objects below
EXEC dbo.SLAM_replicate
@sObjects = 'Account,Contact,Opportunity';
SELECT COUNT(*) FROM Account_replicated;
SELECT COUNT(*) FROM Contact_replicated;
SELECT COUNT(*) FROM Opportunity_replicated;
Loading Data
Use any one of the following procedures to load data:
- SLAM_load_bulk (uses the Salesforce Bulk v1 API)
- SLAM_load_bulkv2 (uses the Salesforce Bulk V2 API)
- SLAM_load_soap (uses the Salesforce SOAP API)
- SLAM_load (for when you prefer to specify the API to use as a parameter)
- SLAM_lockbuster (to prevent row-locking errors on bulk data loads)
For additional information on the advanced load parameters and behavior, see the specific Load Operations sections. This includes:
- Data manipulation types
- Batch size
- Null and blank value handling
- SOAP option headers
- Dwell time between loads
- LockBuster usage
Basic behavior of all loading operations
General Requirements for Loading Data
The input table should have an Id column defined as an NCHAR(18) or NVARCHAR(18) to receive the Salesforce Id returned by Salesforce.
When loading data to Salesforce, if the SLAM_Message column exists, Speediful ignores any records in the input table where SLAM_Message = 'Operation Successful.'. This allows the same input table to be re-run after a partial failure as it will simply ignore any rows that were previously successful. This approach makes it simple for users to correct data issues in-situ without risk of creating duplicate records, while also keeping Salesforce data processing volumes efficient
Effect of Load Operations
Every data load operation results in the following columns being added to the input table:
SLAM_Message- the end result of the operation:'Operation Successful.'or an error message return by SalesforceSLAM_unique_id(as needed) - a generated unique identifier if there is no available key column in the input table
The two SLAM_* fields are not loaded into the Salesforce object, but as responses are received from Salesforce, the SLAM_* fields are populated and the Id column is written with the Salesforce Id from the response.
-- Create some test data
IF OBJECT_ID('Account_Test_LOAD', 'U') IS NOT NULL
DROP TABLE Account_Test_LOAD;
CREATE TABLE Account_Test_LOAD ([Id] NVARCHAR(18), [Name] NVARCHAR(80), [Phone] NVARCHAR(255), [AnnualRevenue] DECIMAL(18, 0));
INSERT INTO Account_Test_LOAD
([Id], [Name], [Phone], [AnnualRevenue]) VALUES
(NULL, 'Universal Containers (Test)', '5553129876', 12450000 ),
(NULL, 'Northern Trail Outfitters (Test)', '5554168652', 5470000 ),
(NULL, 'Ursa Major Solar (Test)', '5552126842', 17500000 ),
(NULL, 'Get Cloudy Consulting (Test)', '5556581385', 10000000 );
-- Preview data to load
SELECT * FROM Account_Test_LOAD;
EXEC dbo.SLAM_load_soap
@sObject = 'Account',
@table = 'Account_Test_LOAD',
@operation = 'insert';
-- Id, SLAM_Message and SLAM_unique_id will be populated
SELECT * FROM Account_Test_LOAD;
-- If you run a SLAM load operation on this table again, only unsuccessful records will be sent!
-- Every activity gets logged
SELECT * FROM SLAM_Activity_Log;
What Next?
This was a quick overview of the basic data read and write capabilities of Speediful. Want to explore further? Check the topics on the sidebar. Here are some of our favorite topics we wouldn't want you to miss!
SLAM_mapping_templateto generate customizable mapping documentsSLAM_table_templateto generate data-type correct tables for loading operationsSLAM_metadata_fieldsto retrieve field definitions for all sObjects in bulk- File Operations for working with Salesforce files