# Zero Lock-In & Data Export Strategy — SyntricDB

The single biggest hesitation senior engineers face when evaluating a new database engine is **Vendor Lock-in**—the fear that once data enters a specialized system, exporting it back to open tools will be painful or impossible.

At **SyntricDB**, we believe **making it easy to leave makes it easy to adopt**. Your data belongs entirely to you.

SyntricDB natively supports standard PostgreSQL and Redis wire protocols (`PGWire v3` on port 5432, `RESP2/RESP3` on port 6379), which means standard open-source tools (like `pg_dump`, `psql`, `redis-cli`, Python Pandas, and Apache Arrow) work seamlessly out of the box.

---

## 1. Exporting Relational & Vector Data to PostgreSQL (`pg_dump` & SQL)

Because SyntricDB speaks native PGWire, you can use official PostgreSQL tools to export schemas, relational data, and vector embeddings back into vanilla PostgreSQL with `pgvector` or standard SQL scripts.

### Method A: Standard `pg_dump` Compatibility
Run standard PostgreSQL `pg_dump` against SyntricDB port `5432`:

```bash
# Export full database schema and data as PostgreSQL-compatible SQL dump file
pg_dump -h localhost -p 5432 -U syntric -d production_db -F p -f syntricdb_export.sql

# Restore directly into standard PostgreSQL instance
psql -h postgres-prod.internal -p 5432 -U postgres -d target_db -f syntricdb_export.sql
```

### Method B: SQL `COPY TO` Direct Export
Issue standard SQL commands via `psql` or PGWire client to export tables directly to CSV or TSV files:

```sql
-- Export relational documents & vector text to CSV format
COPY (
    SELECT id, document_title, text_content, embedding::text 
    FROM knowledge_base
) TO '/tmp/knowledge_base_export.csv' WITH (FORMAT csv, HEADER true);
```

---

## 2. Exporting Vector Embeddings to JSON & Parquet

For AI applications requiring transfer of high-dimensional vector embeddings into analytical storage (DuckDB, Snowflake, AWS S3) or vector stores, SyntricDB provides built-in export utilities via `syntricdb-cli`:

### Export Vectors to Standard JSON Lines (`.jsonl`)
```bash
# Export vector collection to standard line-delimited JSON format
syntricdb-cli export \
  --endpoint="localhost:5432" \
  --collection="embeddings_collection" \
  --format="jsonl" \
  --output="embeddings_export.jsonl"
```

*Sample `.jsonl` output format*:
```json
{"id": "doc_1001", "metadata": {"category": "legal"}, "vector": [0.024, -0.412, 0.891, ..., 0.115]}
{"id": "doc_1002", "metadata": {"category": "finance"}, "vector": [-0.182, 0.301, 0.054, ..., -0.762]}
```

### Export to Apache Parquet (High-Performance Analytics)
```bash
# Export vectors and metadata directly to compressed Apache Parquet format
syntricdb-cli export \
  --endpoint="localhost:5432" \
  --table="customer_vectors" \
  --format="parquet" \
  --compression="snappy" \
  --output="s3://my-data-lake/exports/customer_vectors.parquet"
```

---

## 3. Exporting Key-Value Data to Redis RDB / JSON

Key-Value pairs, cache keys, and session stores managed via SyntricDB's RESP protocol (port `6379`) can be dumped directly using standard Redis commands or CLI helpers:

```bash
# Using redis-cli against SyntricDB port 6379 to inspect and dump key ranges
redis-cli -p 6379 --scan --pattern "user_session:*" | xargs -L 1 redis-cli -p 6379 DUMP

# SyntricDB CLI export of KV namespace to Redis RDB / JSON dump
syntricdb-cli kv export --port=6379 --format=json --output=kv_backup.json
```

---

## 4. Bi-Directional Migration Matrix

| Source / Target | Export Tool | Target Compatibility | Downtime Risk |
| :--- | :--- | :--- | :--- |
| **SyntricDB → PostgreSQL** | `pg_dump` / SQL `COPY` | 100% Vanilla Postgres (`pgvector`) | Zero (Read snapshot) |
| **SyntricDB → Redis** | `syntricdb-cli kv export` | Redis 6.x/7.x & Dragonfly | Zero (Non-blocking scan) |
| **SyntricDB → S3/Parquet** | `syntricdb-cli export --format=parquet` | DuckDB, Snowflake, BigQuery | Zero (Async stream) |
| **SyntricDB → JSON / CSV** | `COPY TO` / CLI | Any custom application script | Zero |

---

## 5. Our Guarantee to Engineers

1. **No Proprietary File Formats**: SyntricDB schemas rely on standard SQL types and IEEE 754 floating-point vector arrays.
2. **Open Wire Protocols**: No custom driver dependencies required. If you choose to migrate away, simply update your connection string back to PostgreSQL (`5432`) or Redis (`6379`).
3. **No Artificial Data Caps**: Export tools are 100% free and bundled into the open-source Apache 2.0 release.
