Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

salesforce-dbsync-1.4.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

salesforce_dbsync-1.4.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file salesforce-dbsync-1.4.1.tar.gz.

File metadata

  • Download URL: salesforce-dbsync-1.4.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for salesforce-dbsync-1.4.1.tar.gz
Algorithm Hash digest
SHA256 bfa667781149920a7232e17c94bd64c292241730f1ba8ca5e00cb5e1c87d6474
MD5 abd85b0c36543180b3fb363785c36690
BLAKE2b-256 5957fbeb46ad76bf3d430bb0681071ff390ac76434816b53fc70509c7025ddf7

See more details on using hashes here.

File details

Details for the file salesforce_dbsync-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: salesforce_dbsync-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for salesforce_dbsync-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64ca330e6d42364440c6e28725145b154b311a99acb7c1f8fcd902f4c7434757
MD5 5156318dbc04987af4e0ade134b7d3e6
BLAKE2b-256 56c333fbca6820d93e47d0f127627acbfde1cd98c52ce5aa7fa398ad67bd4eb8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page