Salesforce SOQL for retrieving cases - python

I am using pythons simple-salesforce to fetch information from sf. My requirement is to pul data about cases in queues set up by my organisation. I am unable to gather information from queues,cause I don’t know how to access them using SOQL,is there any online resource that might help me get there?

You can query queues from the Group object.
Select Id from Group where Type = 'Queue'
For a specific queue you can use:
Select Id from Group where Type = 'Queue' AND NAME = 'QueueName'
You can find all available fields for the Group object here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_group.htm

You should check out workbench.developerforce.com which lets you write SOQL queries and run them against SF objects.
So write your query there first, then replicate in Python

Related

Get description columns Oracle use sqlalchemy

To connect to BBDD (Oracle) through Python, I use the sqlalchemy library.
With the connection.execute(query) command I get the data without problems but I am not able to get the description that each field has.
For example, for the variable called ID_Customer=1111 and it has as description: it is the customer identifier.
How can I get that description?
Thanks!

Salesforce - Pull all deleted cases in Salesforce

I am trying to see if we can pull list of all Salesforce cases that have been deleted using their API using python.
The given below query returns back all Salesforce cases created, but I am trying to see how to retrieve all cases that have been deleted.
SELECT Id FROM Case
I tried doing the below, but it returned no data whereas I know there are deleted cases
SELECT Id FROM Case where isDeleted = true
Queries that include Recycle Bin need to be issued differently. In Apex you need to add "ALL ROWS"
In SOAP API it's queryAll vs normal query call. in REST API it's a different service, also "queryAll".
If you're using simple salesforce it's supposed to be
query = 'SELECT Id FROM Case LIMIT 10'
sf.bulk.Account.query_all(query)
If you're using another library - you'll need to check internals, which API it uses and whether it exposed queryAll to you.
(rememeber that records that are purged from recycle bin don't show up in these queries anymore and then your only hope is something like Data Replication API's getDeleted())

How can I fetch documents from a collection which contains a certain field using mongo engine

I want to fetch a document from a collection i.e Company which contains a certain field i.e Name.
I have tried the following query but it does not work. Can somebody help me in correcting this query or maybe suggest a different query to get what I need? Thanks
Company.objects.get(name__isnull=False)
You can use exists operator
Python.objects(name__exists=True)

How to find the database a Django record was loaded from?

How do you find the database that a record was loaded from, utilizing Django's multiple database support?
I know how to retrieve a record from the non-default database by doing:
record = MyModel.objects.using('otherdatabase').get(id=123)
But given the record, how do I lookup the using value? I tried:
record._default_manager.db
but this always returns default, regardless of the value I sent to using().
_state seems to hold what you're looking for.
record._state.db
If you're interested, it's used internally in the source code here: https://docs.djangoproject.com/en/dev/_modules/django/db/models/base/

Is it possible to query dynamodb with fields other than hash and range keys

I'm using boto to connect dynamodb in python. I'm not seeing any proper tutorials for querying dynamodb. " What i need is that i need to fetch the content of the table where given name is present in firstname or last name where first name and last name are the two fields using dynamodb "
DynamoDB's Query operation only allows you to specify the hash and range keys. Scan will let you provide other fields, but it isn't recommended for general application use. I'm not familiar with boto, but if you want to further filter your results, you'll have to query if you can, then post-process the results in your application. Otherwise, you'll have to scan, which would allow you to use the CONTAINS comparison on one field at a time. You can't check both fields at the same time because the name would have to be found in both fields, not just one. See the table entries called ScanFilter on the Scan page for more information on what's possible.

Categories

Resources