Retrieving Salesforce Reports, Objects, and Metadata
The Simba Salesforce JDBC Connector makes Salesforce reports, objects, and metadata accessible by mapping them to virtual tables. You can query these tables to retrieve various data and metadata or retrieve objects for data replication.
Retrieving Reports
You can retrieve data or metadata from Salesforce reports by querying the virtual tables provided by the connector. The query must specify either the report ID, or the names of the report and the folder where it is stored.
To retrieve a report using an ID:
- To retrieve a list of IDs, report names, and folder names for the reports that are available through your connection, run the following query:
- To retrieve data from a report, run the following query, where [ReportID] is the ID for the report:
- To retrieve column metadata from a report, run the following query, where [ReportID] is the ID for the report:
select * from sf_report_list
select * from sf_report_data where id = '[ReportID]'
select * from sf_report_columns_metadata where id = '[ReportID]'
To retrieve a report using a folder name and report name:
- To retrieve a list of report names, folder names, and IDs for the reports that are available through your connection, run the following query:
- To retrieve data from a report that does not have an ID, run the following query, where [FolderName] is the name of the folder where the report is stored and [ReportName] is the name of the report:
- To retrieve column metadata from a report that does not have an ID, run the following query, where [FolderName] is the name of the folder where the report is stored and [ReportName] is the name of the report:
select * from sf_report_list
select * from sf_report_data where folder = '[FolderName]' and name = '[Name]'
select * from sf_report_columns_metadata folder = '[FolderName]' and name = '[Name]'
Retrieving Objects
You can retrieve objects for data replication or retrieve metadata from objects by querying the virtual tables provided by the connector.
For information about the data replication feature in Salesforce, see "Data Replication" in the SOAP API Developer Guide: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_guidelines_datareplication.htm.
To retrieve objects for data replication:
- To retrieve a list of objects that have been updated or deleted during a specific timespan, run the appropriate query from the following table, where [TableName] is the name of a table in the object and [Timestamp] is the date and time specified using the format yyyy.mm.dd 24h:mm:ss:
Objects to Retrieve | Query to Run |
---|---|
Updated objects |
For example:
|
Deleted objects |
For example:
|
To retrieve metadata from objects:
- Depending on the metadata that you want to retrieve, run the appropriate query from the following table, where [TableName] is the name of a table in the object, and [ColumnName] is the name of a column in the object:
Metadata to Retrieve | Query to Run |
---|---|
Primary keys metadata |
|
Exported keys metadata |
|
Imported keys metadata |
|
Column metadata |
To retrieve all the column metadata from a table, run the following query: select * from sf_column_metadata where table = '[TableName]' Or, to retrieve the metadata of a specific column, run the following query: select * from sf_column_metadata where table = '[TableName]' and column = '[ColumnName]' |
Retrieving Connection Metadata
You can retrieve the server timestamp or information about the Salesforce user that is currently logged in by querying the virtual tables provided by the connector.
To retrieve the server timestamp:
- Run the following query:
select * from sf_server
To retrieve information about the current user:
- Run the following query:
select * from sf_current_user_info