# Send results to BigQuery

```python
from datetime import datetime, timedelta
from google.cloud import bigquery
from layerlens import Stratix

client = Stratix()
bq = bigquery.Client()

since = datetime.utcnow() - timedelta(hours=24)

# Page evaluations and emit one BigQuery row per result
page = 1
rows = []
while True:
 response = client.evaluations.get_many(page=page, page_size=100, sort_by="submitted_at", order="desc")
 evaluations = [e for e in response.evaluations if e.submitted_at >= since]
 if not evaluations:
 break
 for evaluation in evaluations:
 results = client.results.get_all(evaluation=evaluation)
 for r in results:
 rows.append({
 "evaluation_id": evaluation.id,
 "model_id": evaluation.model_id,
 "benchmark_id": evaluation.benchmark_id,
 "prompt": r.prompt,
 "result": r.result,
 "truth": r.truth,
 "score": r.score,
 "subset": r.subset,
 })
 if page >= response.pagination.total_pages:
 break
 page += 1

if rows:
 errors = bq.insert_rows_json("project.dataset.eval_rows", rows)
 if errors:
 print(f"BigQuery insert errors: {errors}")
```

## See also

* [SDK reference: results](https://github.com/LayerLens/gitbook-full/blob/main/13-reference/sdk-python/results.md)
* [SDK reference: evaluations](https://github.com/LayerLens/gitbook-full/blob/main/13-reference/sdk-python/evaluations.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.layerlens.ai/10.-integrate-connect-your-stack/integration-bigquery-export.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
