Simple_Salesforce: making bulk SQL calls within a date range

Viewed 1175

I'm using Simple_Salesforce to grab a chunk of data using the salesforce api. I was wondering if there was anyway to specify a date range when making calls. I keep getting the following error.

query = 'SELECT Id, Name FROM Account WHERE createddate > 1451621381000'

sf.bulk.Account.query(query)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/simple_salesforce/bulk.py", line 157, in _get_batch_results
    url_query_results = "{}{}{}".format(url, '/', result.json()[0])
IndexError: list index out of range

query = 'SELECT Id, Name FROM Account WHERE createddate > 2017-01-01'

This works, so I can filter on conditions

query = "SELECT Id, CreatedDate FROM Tbl WHERE Id = '500G0000008LeHzIAK'"
dd = sf.bulk.Tbl.query(query)
df = pd.DataFrame(dd)

However, date seems to be saved in an odd manner and this throws an error

query = "SELECT Id, CreatedDate FROM Case Tbl CreatedDate = '1328828872000L'"
query = "SELECT Id, CreatedDate FROM Case Tbl CreatedDate > '1328828872000L'"
dd = sf.bulk.Tbl.query(query)
df = pd.DataFrame(dd)

Date values look like this: 1463621383000L

1 Answers
Related