## 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. ### Parameters - `sql_query: str` The SQL query to execute for the sample. - `limit: Optional[int]` Maximum number of rows to return in the sample. - `params: Optional[SequenceNotStr[str]]` Optional parameters to bind to the SQL query (e.g., for placeholders like ? or $1). ### Returns - `class ReportSample: …` Represents the result of a report sample query. - `id: str` Unique identifier for the sample query result. - `records: List[Dict[str, object]]` The actual data records returned by the sample query. - `report: Optional[str]` The ID of the report this sample was generated from, or null for ad-hoc samples. ### Example ```python 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) ``` #### Response ```json { "id": "sample_abc", "report": "report_123", "records": [ { "id": "order_1" }, { "id": "order_2" } ] } ```