> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Avro

> Read Avro object container files and publish an Avro dataset.

How-to guide

The Avro connector reads and writes Avro object container files. It supports append and whole-dataset overwrite. The schema is stored in each file.

## Before you start

Prepare access using [Read and write files](https://docs.e6data.com/transformation/connectors/files.md). Use an existing `.avro` file with `order_id BIGINT` and `amount DOUBLE`, or create a small dataset with the client write example first.

Use rows `(1, 12.5)` and `(2, 7.5)` for the expected results below. This guide concerns Avro files. A Kafka message containing Avro bytes is a separate input.

## Read data

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE OR REPLACE TEMP VIEW avro_orders
USING avro
OPTIONS (
  path '<input-avro-file-or-folder>',
  pathGlobFilter '*.avro'
);

SELECT order_id, amount FROM avro_orders ORDER BY order_id;
```

The reader uses the schema embedded in the file. Expect two rows and a total amount of `20.0` for the sample data.

## Write data

Use the shared guide's `spark` connection. The output path must be a private directory covered by a writable mount.

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
output_path = "<mounted-avro-output-directory>"
orders = spark.createDataFrame(
    [(1, 12.5), (2, 7.5)], "order_id BIGINT, amount DOUBLE"
)

orders.write.format("avro").mode("overwrite").save(output_path)

written = spark.read.format("avro").load(output_path)
written.orderBy("order_id").show()
assert written.count() == 2
```

Use `mode("append")` to add rows. SQL also supports an Avro directory export:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
INSERT OVERWRITE DIRECTORY '<mounted-avro-output-directory>'
STORED AS AVRO
SELECT order_id, amount FROM avro_orders;
```

Choose the client or SQL export for the destination, then read it again to check the published data.

## Options

| Setting | Behavior |
| - | - |
| File selection | Use shared `path`, `pathGlobFilter`, and `recursiveFileLookup` read options. |
| Schema | Read from Avro file metadata. |
| Write mode | `append` or whole-dataset `overwrite`. |
| Format options | No custom Avro reader or writer options are exposed. |

See [shared read options](https://docs.e6data.com/transformation/connectors/files.md#read-options-shared-by-file-formats) for storage settings. Do not pass `avroSchema`, schema-registry settings, `header`, `inferSchema`, or a generic `compression` option to this file connector.

## Data types and limits

Avro records map to columns through the file's schema. Supported logical and nested types depend on the format reader and writer. Use a small read and write check for the actual schema before moving a larger dataset.

Each file is one read unit. The writer buffers batches within its configured memory budget. Keep selected files compatible and size the worker for the data it handles.

The file sink does not support row updates, deletes, merges, or schema-evolution options.

## Related guides

* [Read and write files](https://docs.e6data.com/transformation/connectors/files.md)
* [Kafka record input](https://docs.e6data.com/transformation/connectors/kafka.md)
* [Connector support matrix](https://docs.e6data.com/transformation/connectors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.