1

I am trying to see if I can fetch all columns in Reports object. I have the before

import pandas as pd
from simple_salesforce import Salesforce
sf_data_cursor = Salesforce(username='mail@mail.com', password='password',security_token='abc', sandbox=False)

df = sf_data_cursor.bulk.Report.query("""SELECT * from Report where Id ='report_id'""")

I am trying to see if I can pull all columns in report or is there a way where I can view all existing columns in reports. Could anyone assist. Thanks..

  • This may help you: salesforce.stackexchange.com/questions/146296/… – Pragati Jain Oct 16 '18 at 14:09
  • Are you looking for the column names, or for the content of a report run? – David Reed Oct 16 '18 at 14:18
  • @DavidReed trying to view the list of all columns currently created so that I could use that in my query – Kevin Nash Oct 16 '18 at 14:22
  • @DavidReed, actually looking to get extract content of the report as well... – Kevin Nash Oct 16 '18 at 14:31
0

simple_salesforce doesn't have direct access to the Reports and Analytics API, which is what you need, but it can call arbitrary Salesforce REST endpoints using the method simple_salesforce.Salesforce.restful(). I've used it successfully to talk to the Tooling API, for example.

It looks like you want to be hitting the Report Describe endpoint to get details about the report's structure,

/services/data/44.0/analytics/reports/YOUR_REPORT_ID/describe

as well as the Execute Sync endpoint to extract the rows from an actual run of this report. If you don't care about the column names or report metadata independent of the report run, you may need only Execute Sync.

/services/data/44.0/analytics/reports/YOUR_REPORT_ID

There's a lengthy example of getting report run data synchronously in the documentation.

Note that there are a variety of limitations on the Reports and Analytics API, including particularly

The API returns up to the first 2,000 report rows. You can narrow results using filters.

The report metadata that is returned to you is also, in my opinion, quite complex and can be challenging to work with.

When you query the Report sObject as you are in your question, you don't get back that detailed metadata. Note also that SOQL doesn't support wildcards in the SELECT clause, and you probably don't want to be using the Bulk API to query a single record - regular SOQL will be more expeditious.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.