@animb1996/cds-data-drift
Compares the CSV files under a CAP project's db/data with the rows in the database bound as its db service, and reports where the two have diverged without writing to either.
Initial data in a CAP project is CSV under db/data, and after a few deployments nothing says whether the deployed database still matches those files. npx cds-data-drift reads both sides and prints the records that differ under five conditions: a key only in the CSV, a key only in the database, a key in both whose compared fields differ, a comparison key that occurs more than once, and validation errors such as an unknown entity or column. It installs as a dev dependency and is configured through a cds.dataDrift block in package.json — which folders to read, which entities to skip, which keys to compare on — and runs against whatever the project has bound, from the local database to an SAP HANA CloudSAP HANA CloudThe managed database under most of this: CAP's default target, the store Datasphere and Analytics Cloud sit on, and a service with plans and components.sap official, btp HDI container reached through cds bind. It stops at reporting: it issues SELECT queries only and never updates the database or rewrites a CSV, so what it finds is reconciled by hand.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1@abasu1996maintainer
What it declares
Every artifact
- Type
- CLI
- Origin
- Independently maintained
- Runtime
- Node.js
As a CLI
- Declared for
- >=9 <10
- Distributed through
- does not say
Connections
Getting realistic data into a service for development and demos
Download
Install
npm install --save-dev @animb1996/cds-data-drift{
"cds": {
"dataDrift": {
"folders": ["db/data"],
"dbService": "db",
"ignoreManagedColumns": true,
"emptyStringEqualsNull": true,
"excludeEntities": [
"flowmate.db.ProcessRequests",
"flowmate.db.ProcessTasks"
],
"entities": {
"flowmate.db.ProcessSubTypes": {
"keys": ["code"]
},
"flowmate.ca.db.WorkflowStepConfigs": {
"keys": ["requestType_code", "requestVariant_code", "stepNo"],
"ignoreColumns": ["ID"]
}
}
}
}
}npx cds-data-drift
npx cds-data-drift --entity flowmate.db.ProcessSubTypes
npx cds-data-drift --format json --out data-drift.json- CDS keys are used automatically when an entity does not have an explicit key configuration.
- Managed fields `createdAt`, `createdBy`, `modifiedAt`, and `modifiedBy` are ignored.
- Empty CSV values and database `null` are considered equal.
- At most 100,000 records are read per entity by default.
- Exit code 1 means drift or a validation mismatch was detected; `--warn-only` keeps it at 0.
Copied from @animb1996/cds-data-drift — npm registry record, README, read . Not run by the atlas.
History
v0.1.0
Others providing
Compare all 5 on the Seed data page →- cap-js-mockdatacap-js-mockdataA cds add command that generates CSV seed files into db/data from @Mockdata annotations on your entities, filling each column with values from the Faker module the annotation names.independent, capCSV seed data generated from @Mockdata annotations with Faker
- @sap/cds-common-content@sap/cds-common-contentISO-standard content for CAP's common definitions — countries, languages, currencies and timezones — so a project does not seed those tables itself.sap official, capISO content for CAP's countries, languages, currencies and timezones
- @sap/cds@sap/cdsThe CAP Node.js runtime, which compiles the CDS model, serves the services declared in it, answers generic requests before any handler runs, and loads every cds-plugin.sap official, capCAP Node.js runtime
- cap-mock-generatorcap-mock-generatorParses the .cds schema and fills db/data with relationally consistent CSV — through an LLM layer where one is configured, or a local engine where none is.independent, capFills db/data with relationally consistent CSV from a .cds schema
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
Flavors
“The current release targets SAP CAP 9 (`@sap/cds >=9 <10`) and supports Node.js 20 or newer.” — @animb1996/cds-data-drift — npm registry record, README
History in the atlas
- First seen.
For your agent
- Ref
artifact:animb1996-cds-data-drift- JSON
- /artifacts/animb1996-cds-data-drift.json
- MCP
- Connecting an agent