Seed data

Getting realistic data into a service so it can be developed and demonstrated — initial data, per-tenant content, and believable volumes for testing.

Overview

SAP SHIPSby design
Node.js →

@sap/cds Loads CSV files at deploy time as initial and sample data.

Not covered: It stops at shape, not volume. cds add data fills the right columns with placeholder values; it does not make a name look like a name or an IBAN like an IBAN, and it has no notion of per-tenant fixtures.

Built into @sap/cds
SourceProviding initial datachecked
THE COMMUNITY ADDS

Community generators fill db/data with believable values: cap-js-mockdata from @Mockdata annotations with Faker, and cap-mock-generator from the .cds schema, with relationally consistent rows. @sap/cds-common-content is SAP's ISO content for the common countries, currencies, languages and timezones, and @animb1996/cds-data-drift reports where the CSV files and the deployed rows have diverged.

Artifacts5

5 of 5 artifacts
ArtifactSignals
CLI tools1
@animb1996/cds-data-driftCompares a CAP project's CSV data with its database rows
Signals
none
Generators2
cap-js-mockdataCSV seed data generated from @Mockdata annotations with Faker
Signals
Quiet+1
cap-mock-generatorFills db/data with relationally consistent CSV from a .cds schema
Signals
none
Packages2
@sap/cdsCAP Node.js runtime
Signals
none
@sap/cds-common-contentISO content for CAP's countries, languages, currencies and timezones
Signals
none

Content6

Group by
Piece, what it offers
Avoiding Data Loss When Loading Initial Data with CSV Files in CAP
SAP Community, MioYasutake, BlogThe reasoningRunnable code
Handling CSV Data Deployment in CAP HDI Without Data Loss
SAP Community, Sekar_Somasundaram, BlogThe reasoningA recipeRunnable code
Avoid design time CAP server restarts when maintaining local data files
SAP Community, DJ Adams, BlogThe reasoningRunnable code
Core changed
Show 3 more
ISO content for common CAP types
SAP Community, DJ Adams, BlogThe reasoningRunnable code
Core changed
Add useful Extensions to Dev spaces in SAP Business Application Studio
SAP Community, showkath_naseem, BlogThe reasoning
CAP: Consume External Service - Part 1
SAP Community, Jhodel Cailan, part 1 of 3, Blog

Details

What changed — and what it makes stale1
@sap/cds-dk 7.9.1, CAP

cds add data arrived, generating seed files with a record count per entity and a CSV or JSON target. Before it, the core loaded CSV but did not produce any. The 7.9 line reached npm on 2024-05-02.

Makes stale:

Any guidance that you must hand-write or third-party-generate CSV to get seed data at all. That was true before mid-2024 and is not now — the open question is realism, not volume.

Sourcecds CLI — cds add datachecked
Coverage
statecore and community, CAP
assessed
relationshipnarrow by design
also inABAP, UI5
SourceProviding initial datachecked Sourcecds CLI — cds add datachecked
For your agent