I am running a Python script that uses the simple-salesforce package to query all data in my Salesforce account. For context, the script reads a dictionary stored in a CSV file and stores a specific value, which is a string, in a variable (see below).
with open('/Users/username/Documents/filename.csv', 'rU') as f:
mydict = dict(filter(None, csv.reader(f)))
myString = mydict['key']
Then, I want to pass the variable (myString) into an SOQL select query. However, when I try to pass the variable into the query, I get the following error: Bind variables only allowed in Apex code. Below, you can see the query I tried running in simple-salesforce's format for SOQL queries.
sf.query("SELECT Id, Name FROM deal__c WHERE contact__c = myString")
My question is: How do I pass my variable into the SOQL select query? I am open to using Apex or Dynamic SOQL if that is the best solution, but if that is the best solution, please advise how to use Apex code in my Python script (i.e. if I need to specify where I switch to Apex or install Apex somehow).