simple-salesforce / simple-salesforce

A very simple Salesforce.com REST API client for Python
Other
1.69k stars 686 forks source link

format_soql for field Names not work #417

Open shtalinberg opened 4 years ago

shtalinberg commented 4 years ago

simple-salesforce==1.10.1

format_soql(
            "SELECT Id from Contact WHERE AccountId={account_id} AND {myfield}=TRUE",
            account_id=account_id,
            myfield=get_myfield_name()
        )

I get simple_salesforce.exceptions.SalesforceMalformedRequest with this request /services/data/v42.0/query/?q=SELECT+Id+from+Contact+WHERE+AccountId%3D%VALUE%27+AND+%27FIELDNAMEVALUE__c%27%3DTRUE

Quotes ( %27 ) every time added to FIELDNAMEVALUE__c.

also I tried with {myfield:like}. and {myfield:literal} and get the same in SF request URL

maybe need add new like {myfield:field}.

Ideally also need resolve case (allow any data) like this

format_soql(
            'SELECT Id FROM {sftype} WHERE {condition}',
                sftype=sftype,
                condition=condition
            )
        )

maybe need add new like {condition:raw}.

ahmed-u-khan commented 4 years ago

i'm having a similar issue