问题
I am trying to query from salesforce using python using simple_salesforce package. When I do wildcard, it is throwing me Malfunction error.
soql = """SELECT {} FROM Contact where LastModifiedDate like "%2020-06-16%" """.format(','.join(field_names))
results = sf.query_all(soql)
Error
line 1:1374 no viable alternative at character
回答1:
The date filter is wrong, This field is of type DateTime, not Date
You need to end up with something like
SELECT Id, FirstName, LastName, Email
FROM Contact
WHERE DAY_ONLY(LastModifiedDate) = 2020-06-15
Or
WHERE LastModifiedDate >= 2020-06-15T00:00:00Z
AND LastModifiedDate < 2020-06-16T00:00:00Z
There's a bunch of date conversion functions and special literals (not-really-constants) like TODAY, YESTERDAY, LAST_N_DAYS:123
来源:https://stackoverflow.com/questions/62402924/wildcard-in-soql-python