# Mount / attach (import-on-attach)

The kernel **natively mounts only testdb.bin** (+ `testdb.idx` / `testdb.recno` / `testdb.meta.json` / `pgw-pk`). Ports **1583 / 2143**.

`veloce mount` (alias `veloce attach`) **imports** popular files into testdb. That is not a native mmap of SQLite, CSV, Btrieve `.DAT`, a Postgres data directory, Redis RDB/AOF, SQL Server, or Oracle. `nativeBinary=false`. analog ≠ native.

pgwire **15432** is a limited Postgres *wire* sidecar on testdb, not a PG datadir mount. T-SQL / Postgres Cloud / Redis Cloud are not drop-in targets.

ISAM teaching desk on the website: `/tools/isam-index`.

## CLI

```text
veloce help
veloce mount customers.csv --dir ./data --table CUSTOMERS
veloce attach events.jsonl --dir ./data --table EVENTS
veloce mount items.sqlite --dir ./data --table ITEMS
veloce mount file:///path/to/notes.tsv --dir ./data
veloce mount s3://bucket/customers.csv --dir ./data
veloce mounts --dir ./data
```

Reply line:

```text
OK format=csv dest=CUSTOMERS rows=3 native=false store=testdb imported 3 csv row(s) into testdb …
```

`--dry-run` sniffs and counts without writing. `--host 127.0.0.1 --sql-port 2143` sends `INSERT TESTDB` to a running listener instead of opening the data directory.

On the workgroup port: `SHOW MOUNT` / `SHOW ATTACH` prints the attach catalog JSON (`testdb.attach.json`). It does not claim foreign files as native.

## What you can attach

| Arrives | What happens | nativeBinary |
| --- | --- | --- |
| testdb.bin | Native kernel store | true (the store) |
| CSV / TSV | Import rows as `attach.TABLE.key` JSON | false |
| JSONL objects | First-class attach (same keys) | false |
| testdb.jsonl WAL | Engine already stream-imports on open; `veloce mount` also attaches | false |
| SQLite / GPKG | Table walker import into testdb | false |
| Btrieve/ISAM `.DAT` / VELODAT1 | Sniff + analog import. Not mmap. Not engine 3 | false |
| dBase DBF | Import-on-attach | false |
| Postgres **text** dump | Import/migrate path only | false |
| `s3://` `r2://` `gs://` `azure://` `file://` | Fetch object, then the same import | false |

## Cloud URIs

No secrets in the repo. Live fetch uses env creds / IAM-style keys.

| Scheme | Test double | Live env |
| --- | --- | --- |
| `file://` or a path | local file | local file |
| `s3://bucket/key` (S3-compatible / R2 via `AWS_ENDPOINT_URL`) | `VELOCE_S3_LOCAL_ROOT` maps to `{root}/{bucket}/{key}` | `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` (+ `AWS_REGION`) |
| `gs://bucket/key` | `VELOCE_GCS_LOCAL_ROOT` | `GOOGLE_ACCESS_TOKEN` |
| `azure://account/container/blob` | `VELOCE_AZURE_LOCAL_ROOT` | `AZURE_STORAGE_ACCOUNT` + `AZURE_STORAGE_KEY` or SAS |

`VELOCE_CLOUD_LOCAL_ROOT` is a shared fallback for those doubles.

After attach, `veloce backup` snapshots testdb.bin (not a PG dump). See `BACKUP.md` and training `08-backup.md`.

## Refuse (not native mounts)

- Postgres data directory (`PG_VERSION`) and `pg_dump -Fc` (`PGDMP`)
- Parquet (leftover this cut)
- Redis RDB/AOF, SQL Server BAK/MDF, Oracle dump, DuckDB, SQLCipher

## Leftover

Parquet leftover EXTERNAL. Live S3/GCS/Azure without credentials leftover EXTERNAL. Native mmap of foreign files leftover EXTERNAL. AWS SDK / `@google-cloud/storage` / `@azure/storage-blob` leftover EXTERNAL (this cut signs REST with Node `crypto`, no vendor SDK). Host kernel mmap recut leftover EXTERNAL.
