# Querying your data

Choose a query engine that can read your destination. For a bucket, it needs to read gzip NDJSON files. For Iceberg or DuckLake, connect it to the table’s catalog. For Amazon S3, S3-compatible and Google Cloud Storage bucket destinations, you can also run SQL in the Send2Bucket dashboard.

## What you are querying

| Destination | You get | Read it with |
|---|---|---|
| [Amazon S3](../destinations/aws-s3.md), [Google Cloud Storage](../destinations/gcs.md), [S3-compatible](../destinations/s3-compatible.md) | gzip NDJSON objects under `<prefix>/s2b/stream=…/date=…/hour=…/` | Any engine that reads JSON files from object storage |
| [Apache Iceberg](../destinations/iceberg-rest.md), [Amazon S3 Tables](../destinations/s3-tables.md), [Supabase Analytics Buckets](../destinations/supabase-analytics.md) | An Iceberg table | Any Iceberg client pointed at the same catalog |
| [DuckLake](../destinations/ducklake.md) | A DuckLake table | DuckDB, or Postgres through pg_duckdb |

Every record carries the same envelope ([Delivery format](../delivery-format.md)):

- **Objects** have one envelope per line, with top-level `signal`, `received_at`, `resource`, `scope` and `data` fields. `stream`, `date` and `hour` come from the path.
- **Tables** have `signal_type`, `delivery_batch_id`, `ingested_at` and `payload`, where `payload` is the envelope as JSON text. A JSON event's fields are at `$.data.<field>`.

## Engines

| Engine | Bucket objects | Iceberg | DuckLake | Page |
|---|---|---|---|---|
| DuckDB | Reads in place | Reads in place | Reads in place | [DuckDB](./duckdb.md) |
| Trino, Starburst | External table | Iceberg connector | No | [Trino](./trino.md) |
| BigQuery | External table | BigLake Iceberg table | No | [BigQuery](./bigquery.md) |
| PostgreSQL | Load into `jsonb`, or Supabase Wrappers | Load, or Supabase Wrappers | Load | [PostgreSQL](./postgres.md) |
| MySQL | Load into `JSON` | Load | Load | [MySQL](./mysql.md) |
| ClickHouse | Reads in place, or loads into MergeTree | DataLakeCatalog or `icebergS3` | No | [ClickHouse](./clickhouse.md) |
| Amazon Athena | External table with partition projection | Glue or S3 Tables catalog | No | [Amazon Athena](./athena.md) |
| Amazon Redshift | Spectrum external table, or `COPY` into `SUPER` | S3 Tables through Glue | No | [Amazon Redshift](./redshift.md) |
| Apache Spark | Reads in place (JSON reader) | Iceberg REST catalog | No | [Apache Spark](./spark.md) |
| Databricks | `read_files`, or Auto Loader into Delta | No generic REST catalog | No | [Databricks](./databricks.md) |
| StarRocks | `FILES()` over lines with `parse_json`, or a Pipe into a native table | External Iceberg catalog | No | [StarRocks](./starrocks.md) |
| Dremio | S3 source, folder promoted as JSON | Iceberg REST source (Enterprise) | No | [Dremio](./dremio.md) |
| Snowflake | External table, or Snowpipe or `COPY` into `VARIANT` | Catalog integration (REST, S3 Tables) | No | [Snowflake](./snowflake.md) |
| Microsoft Fabric | OneLake shortcut, Spark load into Delta | Iceberg shortcut, with limits | No | [Microsoft Fabric](./fabric.md) |
| Python (Polars, PyIceberg, duckdb) | Reads in place | Reads in place | Reads in place | [Python](./python.md) |
| R (duckdb, arrow) | Reads in place | Reads in place | Reads in place | [R](./r.md) |

"Reads in place" means the engine queries your bucket or catalog directly and always sees the latest deliveries. "Load" means you copy delivered data into the database on a schedule. Each object and each table commit has its own `delivery_batch_id`, so a load job can skip the ones it already copied.

## The example questions

The examples use four queries:

1. How many records of each signal arrived?
2. Which JSON events are most frequent, and how much revenue did `order.paid` events carry?
3. How many log records did each service send, by severity?
4. Which spans were slowest?

The examples use a stream that receives product events such as:

```json
{"event":"order.paid","user_id":"usr_0012","plan":"pro","order_id":"ord_20931","cents":4900,"currency":"usd","items":[{"sku":"sku_1","qty":2}]}
```

and OpenTelemetry logs, traces and metrics from a service named `checkout`. Swap the field names for your own.

## Working with OpenTelemetry records

OTLP records use the [OTLP JSON mapping](https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding):

- Attributes are a list of `{"key": …, "value": {"stringValue": …}}` objects, not a map. To read `service.name`, search `resource.attributes` for the matching key. Each engine page shows how.
- 64-bit integers, such as `startTimeUnixNano`, are strings. Cast them to a 64-bit or wider integer before doing arithmetic.
- A metric's `data` holds one of `gauge`, `sum`, `histogram`, `exponentialHistogram` or `summary`, each with a `dataPoints` list.

## Tips

- Filter on `date` (objects) or `ingested_at` (tables) first. Engines skip whole partitions or files for those filters.
- Read only `stream=*` folders under `<prefix>/s2b/`. Destination checks write small test objects to `<prefix>/s2b/_verify/`, which are not records.
- A record is in your bucket or table about a minute after it was accepted. See [Delivery semantics](../delivery-semantics.md) for when duplicates can happen and how to drop them.

## BI tools and notebooks

To explore data in a [BI tool](../integrations/bi/index.md), [notebook](../integrations/notebooks/index.md) or [SQL client](../integrations/sql-clients/index.md), connect it to one of the engines above. See [Integrations](../integrations/index.md).
