【问题标题】:SOQL IN query from Python来自 Python 的 SOQL IN 查询
【发布时间】:2016-05-17 21:31:39
【问题描述】:

我想知道是否有人知道如何使用beatbox 或简单的salesforce 来格式化IN 查询。示例:

select id from lead where id in ('00Q3000000zLxkFEAS', '00Q3000000eODvUEAW')

在简单的销售人员中,我有:

sf.get_sfcontacts_all(param="where Id in ({0})".format())

我尝试使用 arg 格式的列表、元组和字符串,但不断收到格式错误的请求。

有什么帮助吗?

【问题讨论】:

    标签: python salesforce soql beatbox simple-salesforce


    【解决方案1】:

    使用 Beatbox 和 python 2.7,您不应该得到格式错误的查询。找到下面使用的代码,没有任何错误:

    import beatbox
    
    "salesforceusername and password"
    username = 'xxx'
    password = "xxx"
    token    = 'xxx'
    
    """conenct and authenticate"""
    svc = beatbox.PythonClient()
    svc.login(username, password+token)
    
    """execut SOQL query"""
    res = svc.query("select id from lead where id in ('00Q3000000zLxkFEAS', '00Q3000000eODvUEAW')")
    
    """prints results in console"""
    print(res)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多