> ## 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.

# Read and write files

> Prepare file access, connect a client, and verify a published file dataset.

How-to guide

Use a file connector to read existing files or publish a dataset in CSV, TSV, JSON, Parquet, Avro, or Arrow IPC format. Choose the format guide for a complete read and write example.

## Before you start

Prepare an input file or folder, a private output folder, and storage access for the driver and workers. Use a separate output folder for each format. An output path names a dataset directory, even if its name ends with a file extension.

The engine can read files through a configured storage mount or its runtime storage resolver. Runtime reads need a supported location, a valid identity, and access to the data. Writes require an explicit mount that covers the destination. A read that succeeds through runtime credentials does not by itself make that path a writable mount.

Use [File sources](https://docs.e6data.com/transformation/reference/configuration/file-sources.md) to define mounts. Local paths must be visible at the same location on the driver and workers. Remote workers need shared storage or an object store.

| Storage | Access guide |
| - | - |
| Local files | [File-source configuration](https://docs.e6data.com/transformation/reference/configuration/file-sources.md) |
| Amazon S3 | [Instance role](https://docs.e6data.com/transformation/recipes/files/ec2-instance-role.md), [task role](https://docs.e6data.com/transformation/recipes/files/ecs-task-role.md), or [saved profile](https://docs.e6data.com/transformation/recipes/files/aws-profile.md) |
| S3-compatible storage | [MinIO](https://docs.e6data.com/transformation/recipes/files/minio-parquet.md) |
| Google Cloud Storage or Azure Blob Storage | [Cloud identities and credentials](https://docs.e6data.com/transformation/learn/credentials.md) |

Read access needs permission to list a folder and read its objects. Write access also needs the permissions required to publish dataset files and metadata. Use an identity with access to the private example destination.

## Read in SQL

Create a local temporary view in Workbench. Keep its queries in the same session. Replace the path with a file or folder visible to the engine.

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

SELECT * FROM input_orders LIMIT 10;
```

For CSV and TSV, set `header 'true'` when the first record contains column names. Use an explicit schema when column types must stay fixed. See [CSV](https://docs.e6data.com/transformation/connectors/files/csv.md) and [TSV](https://docs.e6data.com/transformation/connectors/files/tsv.md).

File-source views are local temporary views. Persistent and global temporary views are not supported for this form. `IF NOT EXISTS` is also not supported.

## Connect a Python client

Use a PySpark client version supported by your deployment. Install its Spark Connect dependencies. Obtain the engine's Spark Connect endpoint, including any required client authentication settings.

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from pyspark.sql import SparkSession

spark = (
    SparkSession.builder
    .remote("sc://<engine-host>:<spark-connect-port>")
    .getOrCreate()
)
```

This is the Spark Connect listener, not the browser HTTP address. An existing engine notebook already supplies `spark`. See [Notebook connection settings](https://docs.e6data.com/transformation/reference/configuration/notebooks.md).

Each format guide uses this connection for its client examples. Paths refer to engine storage. A path on the client's laptop is not uploaded by calling `load` or `save`.

## Read options shared by file formats

| Option | Default | Use |
| - | - | - |
| `path` | Required for a SQL file view | A file or folder location. The client also accepts it through `load(path)`. |
| `pathGlobFilter` | Unset | Match file names, such as `*.parquet`. |
| `recursiveFileLookup` | `false` | Include files in nested folders. |
| `credential_reference` | Unset | Use a saved storage credential where the runtime resolver supports it. |
| `region` | Identity or storage defaults | Select the object-store region where needed. |
| `endpoint` | Provider default | Use an alternate object-store endpoint. |
| `allow_http` | `false` | Allow an explicitly configured HTTP endpoint. |
| `account` | Storage defaults | Set the Azure storage account where needed. |
| `token_scope` | Storage defaults | Select the Azure token scope where needed. |

These are read options. A file writer uses the configured destination mount. It does not accept these connection or file-selection options in its writer options.

Folder selection is bounded by [file-source limits](https://docs.e6data.com/transformation/reference/configuration/file-source-limits.md). Use one compatible schema across the selected files. File-name filtering does not create a partitioned-table schema.

## Write and verify a dataset

The client supports `mode("append")` and `mode("overwrite")`. Append adds rows. Whole-dataset overwrite replaces the active rows. Neither mode performs an update or merge of individual records.

Use the same format and compatible schema for later appends. CSV and TSV also need compatible parsing options. The first write can establish a new file dataset inside a mounted destination. This differs from Delta writes, which require an existing table.

After a write returns successfully, read the destination through the engine. Check row counts, column types, and known values. For the sample rows used in these guides, expect two rows and an amount total of `20.0`.

Writes publish part files through the engine's commit path. Readers use the published dataset state. Old or uncommitted files can remain in storage, so a directory listing is not a list of active rows. Repeating a completed append adds the rows again. Use overwrite for the repeatable examples below.

SQL directory exports support `STORED AS PARQUET`, `AVRO`, and `JSONFILE`. Use the client writer for CSV, TSV, or Arrow IPC exports. Direct file writes do not support partitioning, bucketing, clustering, sort layout, or schema-evolution options.

## Choose a format

| Guide | Main choice |
| - | - |
| [CSV](https://docs.e6data.com/transformation/connectors/files/csv.md) | Comma-separated text with header and schema controls. |
| [TSV](https://docs.e6data.com/transformation/connectors/files/tsv.md) | Tab-separated text with the same parsing controls as CSV. |
| [JSON](https://docs.e6data.com/transformation/connectors/files/json.md) | JSON objects, with one object per line by default. |
| [Parquet](https://docs.e6data.com/transformation/connectors/files/parquet.md) | Columnar files with an embedded schema. |
| [Avro](https://docs.e6data.com/transformation/connectors/files/avro.md) | Avro object container files with an embedded schema. |
| [Arrow IPC](https://docs.e6data.com/transformation/connectors/files/arrow-ipc.md) | Arrow IPC files with an embedded schema and footer. |

## Cleanup

Drop example temporary views when finished. This does not delete input or output files. Remove only the private output folders you created, using your storage tools after the examples finish. Keep shared mounts and credentials in place.


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