Skip to main content
KiwiFS can import rows from relational and document databases, converting each record into a markdown page with structured frontmatter.

PostgreSQL

kiwifs import --from postgres \
  --dsn "postgres://user:pass@localhost:5432/mydb" \
  --table users \
  --prefix people/ \
  --root ./knowledge

Options

FlagDescription
--dsnPostgreSQL connection string (required)
--tableTable name
--queryCustom SQL query (overrides --table)
--columnsComma-separated fields to include
--prefixPath prefix in KiwiFS (default: table name)
--limitMax rows to import
--dry-runPreview without writing
kiwifs import --from postgres \
  --dsn "postgres://user:pass@localhost/mydb" \
  --query "SELECT id, name, email FROM users WHERE active = true" \
  --prefix active-users/

MySQL

kiwifs import --from mysql \
  --dsn "user:pass@tcp(localhost:3306)/mydb" \
  --table articles \
  --prefix articles/
Same flags as PostgreSQL. The DSN format follows Go’s mysql driver convention.

SQLite

kiwifs import --from sqlite \
  --db ./data.db \
  --table entries \
  --prefix entries/
FlagDescription
--dbPath to SQLite database file (required)
--tableTable name
--queryCustom SQL query (overrides --table)

MongoDB

kiwifs import --from mongodb \
  --uri "mongodb://localhost:27017" \
  --database myapp \
  --collection articles \
  --prefix articles/
FlagDescription
--uriMongoDB connection URI (required)
--databaseDatabase name (required)
--collectionCollection name (required)

Firestore

kiwifs import --from firestore \
  --project my-gcp-project \
  --collection users \
  --prefix users/
FlagDescription
--projectGCP project ID (required)
--collectionFirestore collection name (required)
Firestore requires Google Cloud credentials. Set GOOGLE_APPLICATION_CREDENTIALS or run within a GCP environment.

DynamoDB

kiwifs import --from dynamodb \
  --table my-table \
  --region us-east-1 \
  --prefix dynamo/
FlagDescription
--tableDynamoDB table name (required)
--regionAWS region (required)
--prefixPath prefix in KiwiFS
--limitMax items to import
Uses your default AWS credentials (~/.aws/credentials, AWS_PROFILE, or IAM role).

Redis

kiwifs import --from redis \
  --addr "localhost:6379" \
  --pattern "article:*" \
  --prefix redis/
FlagDescription
--addrRedis address (default: localhost:6379)
--passwordRedis password
--redis-dbRedis database number (default: 0)
--patternKey glob pattern to import (default: *)
--prefixPath prefix in KiwiFS
Each matching key becomes a markdown page. Hash keys become frontmatter fields; string values become the page body.

Elasticsearch

kiwifs import --from elasticsearch \
  --url "http://localhost:9200" \
  --table my-index \
  --prefix search/
FlagDescription
--urlElasticsearch URL (required)
--tableIndex name (required)
--queryElasticsearch query JSON (optional, defaults to match-all)
--prefixPath prefix in KiwiFS
--limitMax documents to import

MCP usage

All database imports are also available via the kiwi_import MCP tool:
{
  "tool": "kiwi_import",
  "arguments": {
    "from": "postgres",
    "dsn": "postgres://user:pass@localhost/mydb",
    "table": "users",
    "prefix": "people/",
    "dry_run": true
  }
}
Use dry_run: true to preview what would be imported before writing any files.

Output format

Each imported record becomes a markdown file:
---
_imported_at: "2026-04-25T18:46:15Z"
_source: users
_source_id: pg:users:42
name: Jane Doe
email: jane@example.com
role: admin
---

# Jane Doe

> Auto-imported from users (row pg:users:42)
Re-importing the same data is idempotent — KiwiFS compares _source_id and field values, skipping unchanged records.
Last modified on May 31, 2026