Run Ad-hoc Query
print_mail.reports.sample(ReportSampleParams**kwargs) -> ReportSample
POST/print-mail/v1/reports/samples
Run an ad-hoc SQL query against your data lake and get a sample of the results. This is useful for quickly testing queries without saving them as a report. The query execution time and result size are limited.
Run Ad-hoc Query
import os
from postgrid import PostGrid
client = PostGrid(
print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"), # This is the default and can be omitted
)
report_sample = client.print_mail.reports.sample(
sql_query="SELECT id FROM contacts LIMIT 5",
limit=5,
params=[],
)
print(report_sample.id){
"id": "sample_abc",
"report": "report_123",
"records": [
{
"id": "order_1"
},
{
"id": "order_2"
}
]
}Returns Examples
{
"id": "sample_abc",
"report": "report_123",
"records": [
{
"id": "order_1"
},
{
"id": "order_2"
}
]
}