Python library to download data from Salesforce and synchronize with a relational database
Project description
salesforce-dbsync
Python library to download data from Salesforce and synchronize with a relational database
Example
This example performs the following steps for Salesforce Object 'Account' when run for the first time:
- Downloads Table Metadata from Salesforce
- Downloads Table Data from Salesforce, limited to a maximum of 10000 rows
- Creates a MySQL Database if one does not already exist
- Creates Tables in MySQL alongwith Indexes if the Table does not already exist
- Uploads the data into the MySQL Table
In the subsequent runs, it performs the following steps:
- Downloads Table Data from Salesforce
- Refreshes data in MySQL with new records or updates that from Salesforce
- Note: Deletes in Salesforce are ignored
import sys
from screenwriter import Screenwriter
from salesforce_dbsync import Sync_Manager
def do_init ():
global sw, sync_mgr
sw = Screenwriter ()
db_creds = {'user':'mysql_uid', 'passwd':'mysql_pwd', 'db':'TESTDB'}
sf_creds = {'user':'sf_uid', 'passwd':'pb_pwd', 'token':'sf_tok'}
control_map = {'min-SystemModstamp-date':'2019-01-01', 'dml-limit':10000}
sync_mgr = Sync_Manager (sw, db_creds, sf_creds, control_map)
def do_main ():
global sw, sync_mgr
sync_mgr.add_sync_profile ('Account', ['Name','BillingStreet','BillingCountry'], ["BillingCountry = 'Canada'"])
sync_mgr.init_mysql ()
sync_mgr.init_sfdc ()
sync_mgr.create_missing_db_tables ()
sync_mgr.sync ()
do_init ()
do_main ()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for salesforce_dbsync-1.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e27715e5ec62d95bd843eac070e8e2110e4401c884fba111045249dd62ae3be9 |
|
MD5 | ea163d170cf7e06f394a597852bbe957 |
|
BLAKE2b-256 | a60b543a4b1b38b7fd2138ef3ed4d8cd49ce438ae99702ebe008152404d9ee7b |