Use SQLite as the development database with cds deploy, CSV seed files, and understand dev/prod parity gaps.
cds.requires.db for SQLite profilescds deploy --to sqlite to create a .db fileSQLite lets every developer run a fully-functional CAP app locally with zero infrastructure. Understanding its limits prepares you to avoid bugs that only appear on HANA in production.
CAP uses an in-memory SQLite database by default (no configuration needed):
// .cdsrc.json — explicit but matches the default
{
"requires": {
"db": {
"[development]": { "kind": "sqlite", "credentials": { "database": ":memory:" } },
"[production]": { "kind": "hana" }
}
}
}
cds watch auto-deploys schema to in-memory SQLite on startup.
{
"requires": {
"db": {
"[development]": {
"kind": "sqlite",
"credentials": { "database": "dev.db" }
}
}
}
}
# Deploy schema to the file
cds deploy --to sqlite
# With specific target
cds deploy --to sqlite:dev.db
Now your data persists across cds watch restarts — useful for demo scenarios.
Place CSV files in db/data/ or srv/data/ (legacy) matching entity names:
db/
├── schema.cds
└── data/
├── my.bookshop-Books.csv ← namespace-EntityName.csv
├── my.bookshop-Authors.csv
└── my.bookshop-Orders.csv
# db/data/my.bookshop-Books.csv
ID,title,author_ID,price,stock
b1,Hands-On CAP,a1,49.99,100
b2,CDS Cookbook,a2,34.99,50
CAP auto-imports CSV on cds deploy. Existing rows are replaced on re-deploy.
cds deploy vs cds watch| Command | What it does |
|---|---|
cds watch |
In-memory SQLite, drops/recreates schema on file change |
cds deploy --to sqlite |
Writes schema + CSV to file; CAP uses the file on next start |
cds deploy --to hana |
Deploys to HDI container in BTP |
| Feature | SQLite | HANA Cloud |
|---|---|---|
| Referential integrity | Not enforced | Enforced |
LargeBinary |
Stored as blob | BlobDisk |
| Temporal queries | Supported | Supported |
| Full-text search | Not supported | Supported |
| Row-level security | Not supported | Structured Privileges |
Hierarchies ($apply=traverse) |
Not supported | Supported |
| Stored procedures | Not available | Available |
| Case sensitivity in strings | Case-insensitive LIKE | Case-sensitive by default |
Always test HANA-specific features in a DEV HANA Cloud instance before production.
{
"requires": {
"db": {
"[development]": { "kind": "sqlite", "credentials": { "database": ":memory:" } },
"[test]": { "kind": "sqlite", "credentials": { "database": "test.db" } },
"[staging]": { "kind": "hana" },
"[production]": { "kind": "hana" }
}
}
}
# Run with a specific profile
CDS_ENV=staging cds watch
NODE_ENV=test cds watch
# Interactive CDS REPL connected to SQLite
cds repl
> const db = await cds.connect.to('db')
> await db.run(SELECT.from('Books'))
> await db.run(INSERT.into('Books').entries({ ID: cds.utils.uuid(), title: 'Test', price: 9.99 }))
dev.dbcds deploy --to sqlite and verify data with sqlite3 dev.db .tablescontains() full-text) and observe it fails on SQLitedb/data/ named namespace-EntityName.csv auto-seed on deploy"database": "dev.db" persists across restartsCDS_ENV=<profile> switches between SQLite dev and HANA staging