Data API
Read Operations
Basic Reads

Basic Read Operations

The read_data() method is the primary way to read data from DealCloud objects. Requests use intapp-rest-client (RestClient); tune timeouts, retries, and concurrency via Advanced configuration.

Basic Usage

from dealcloud_sdk import DealCloud, DealCloudConfig
 
config = DealCloudConfig(
    siteUrl="yoursite.dealcloud.com",
    clientId=12345,
    clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
 
# Read all data from an object
companies = dc.read_data("Company", output="pandas")
⚠️

The output parameter is required. Options: "pandas", "list", "polars", or "polars_lazy".

Output Formats

# Returns pandas.DataFrame
companies = dc.read_data("Company", output="pandas")
 
print(type(companies))  # <class 'pandas.core.frame.DataFrame'>
print(companies.head())
EntryIdCompanyNameIndustryRevenue
12345Acme CorpTechnology1000000
12346Beta IncFinance500000
12347Gamma LLCHealthcare750000

Selecting Fields

Read only specific fields to improve performance:

# Read only specified fields
companies = dc.read_data(
    "Company",
    output="pandas",
    fields=["CompanyName", "Industry", "Revenue"]
)
💡

Always specify fields when you don't need all columns. This reduces data transfer and improves performance.

Filtering with Queries

Apply server-side filters:

# Filter using query syntax
active = dc.read_data(
    "Company",
    output="pandas",
    query="{Status: {$eq: 'Active'}}"
)
 
# Multiple conditions
tech_companies = dc.read_data(
    "Company",
    output="pandas",
    query="{$and: [{Industry: 'Technology'}, {Revenue: {$gt: 1000000}}]}"
)

See Query Syntax for full query documentation.

Parameters

ParameterTypeRequiredDefaultDescription
object_idstr | intYes*-Object API name or ID
view_idstr | intYes*-View name or ID
outputstrYes-"pandas", "list", "polars", or "polars_lazy"
fieldsList[str]NoAllFields to return
querystrNoNoneFilter query
resolvestrNoNone"name" or "id" (legacy)
include_nullsboolNoFalseInclude null fields (ignored for views, always False)
reference_formatReferenceFormatNoFULLHow to format references
reference_cacheReferenceCacheNoNoneCache for reference lookups

*Either object_id OR view_id must be provided, not both.

⚠️

Views and include_nulls: When reading from views, the include_nulls parameter is automatically set to False, regardless of what you specify. This prevents the API from returning excessive columns (1000+ instead of expected 10-20). See Reading from Views for details.

Working with DataFrames

Filtering

companies = dc.read_data("Company", output="pandas")
 
# Filter after loading
active = companies[companies["Status"] == "Active"]
large = companies[companies["Revenue"] > 1000000]
tech = companies[companies["Industry"].str.contains("Tech", na=False)]

Sorting

# Sort by revenue descending
sorted_companies = companies.sort_values("Revenue", ascending=False)

Exporting

# Export to CSV
companies.to_csv("companies.csv", index=False)
 
# Export to Excel
companies.to_excel("companies.xlsx", index=False)
 
# Export to JSON
companies.to_json("companies.json", orient="records")

Transformations

# Rename columns
companies = companies.rename(columns={
    "CompanyName": "Name",
    "BusinessDescription": "Description"
})
 
# Add calculated column
companies["RevenueM"] = companies["Revenue"] / 1_000_000
 
# Drop columns
companies = companies.drop(columns=["InternalNotes"])

Working with Lists

companies = dc.read_data("Company", output="list")
 
# Iterate
for company in companies:
    print(f"{company['EntryId']}: {company['CompanyName']}")
 
# Filter
active = [c for c in companies if c.get("Status") == "Active"]
 
# Transform
names = [c["CompanyName"] for c in companies]
 
# Convert to DataFrame later if needed
import pandas as pd
df = pd.DataFrame(companies)

Pagination

The SDK handles pagination automatically:

# This reads ALL records, paginating under the hood
all_companies = dc.read_data("Company", output="pandas")
 
# Page size is configurable in DealCloudConfig
# Default: 1000 records per page

Monitoring Progress

# Use progress callback for large reads
def on_progress(current, total):
    print(f"Loaded {current}/{total} records")
 
companies = dc.read_data(
    "Company",
    output="pandas",
    progress_callback=on_progress
)

Example: Complete Read Workflow

from dealcloud_sdk import DealCloud, DealCloudConfig
 
config = DealCloudConfig(
    siteUrl="yoursite.dealcloud.com",
    clientId=12345,
    clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
 
# 1. Read active companies with specific fields
companies = dc.read_data(
    "Company",
    output="pandas",
    fields=["CompanyName", "Industry", "Revenue", "Status", "CreatedDate"],
    query="{Status: 'Active'}"
)
 
# 2. Transform data
companies["Revenue_M"] = companies["Revenue"] / 1_000_000
companies["CreatedDate"] = pd.to_datetime(companies["CreatedDate"])
companies = companies.sort_values("Revenue", ascending=False)
 
# 3. Export results
companies.head(100).to_excel("top_100_companies.xlsx", index=False)
 
print(f"Exported {len(companies)} companies")

Next Steps