|
1 | | ---- |
2 | | -uacp: Linked from https://help.sap.com/products/BTP/65de2977205c403bbc107264b8eccf4b/e4a7559baf9f4e4394302442745edcd9.html |
3 | | ---- |
4 | | - |
5 | 1 |
|
6 | 2 | # CAP-level Database Integration |
7 | 3 |
|
8 | | -CAP application developers [focus on their domain](../../get-started/features#focus-on-domain), while CAP takes care of all aspects of database integration. This includes translating CDS models to native persistence models, schema evolution, deployment, as well as runtime querying – all of that in a database-agnostic way. [SQLite](./sqlite) <sup>1</sup> in-memory databases are automatically used in [inner-loop development](../../get-started/features#fast-inner-loops), while in production, [SAP HANA](./hana) <sup>2</sup> is used by default. |
| 4 | +CAP application developers [focus on their domain](../../get-started/features#focus-on-domain), while CAP takes care of all aspects of database integration. This includes translating CDS models to native persistence models, schema evolution, deployment, as well as runtime querying – all of that in a database-agnostic way. [SQLite](./sqlite) <sup>1</sup> in-memory databases are automatically used in inner-loop development, while in production, [SAP HANA](./hana) <sup>2</sup> is used by default. |
9 | 5 | {.abstract} |
10 | 6 |
|
11 | | -> _<sup>1</sup> or [H2](./h2) in case of Java_.\ |
| 7 | +> _<sup>1</sup> or [H2](./h2) in case of CAP Java-based projects_.\ |
12 | 8 | > _<sup>2</sup> or [PostgreSQL](./postgres) in edge cases_. |
13 | 9 |
|
14 | 10 |
|
15 | | -### Served Out of the Box |
16 | | - |
17 | | -When you launch a CAP server, for example with `cds watch`, an in-memory database service is automatically boostrapped, as indicated by such log output: |
| 11 | +### Best Practices, Served Out of the Box |
18 | 12 |
|
19 | | -```log |
20 | | -[cds] - connect to db > sqlite { url: ':memory:' } |
21 | | - > init from bookshop/db/data/sap.capire.bookshop-Authors.csv |
22 | | - > init from bookshop/db/data/sap.capire.bookshop-Books.csv |
23 | | - > init from bookshop/db/data/sap.capire.bookshop-Books.texts.csv |
24 | | - > init from bookshop/db/data/sap.capire.bookshop-Genres.csv |
25 | | -/> successfully deployed to in-memory database. |
26 | | -``` |
| 13 | +> [!tip] Served Out of the Box |
| 14 | +> The CAP framework handles all compilation to DDL automatically, for example when you run `cds watch` or `cds deploy`. You typically don't need to worry about the details unless you want to inspect or customize the generated DDL statements. The guides in this section explain how things work under the hood. If you are on a fast track, you can safely skip them to great extent. |
27 | 15 |
|
28 | | -The illustration below shows what happens behind the scenes: |
| 16 | +The illustration below shows what happens automatically under the hood: |
29 | 17 |
|
30 | | -- CDS models are compiled to native DDL |
| 18 | +- CDS models are compiled to database-native SQL/DDL |
31 | 19 | - which get deployed to the configured database, and |
32 | | -- initial data from CSV files is loaded into the database tables. |
| 20 | +- initial data from CSV files is loaded into the database tables |
| 21 | +- CQL queries from CAP services are served automatically. |
33 | 22 |
|
34 | 23 |  |
35 | 24 |
|
36 | | -> [!tip] Everything Served Out of the Box |
37 | | -> The CAP framework handles all compilation to DDL automatically, for example when you run `cds watch` or `cds deploy`. You typically don't need to worry about the details unless you want to inspect or customize the generated DDL statements. The guides in this section explain how things work under the hood. If you are on a fast track, you can safely skip them to great extent. |
| 25 | +> [!tip] Following the Calesi Pattern |
| 26 | +> The implementations of the CAP database layers follow the design principles of CAP-level Service Integration: |
| 27 | +> - Database Services are CAP services themselves, which... |
| 28 | +> - allows applications to extend them using standard CAP APIs |
| 29 | +> - provide database-agnostic interfaces to applications |
| 30 | +> - provide mocks for local development out of the box |
| 31 | +
|
| 32 | +> [!tip] Promoting Fast Inner-Loop Development |
| 33 | +> Through the ability to easily swap production-grade databases like SAP HANA with SQLite or H2 in-memory databases during development, without any changes to CDS models nor implementations, we greatly promote inner-loop development with fast turnaround cycles, as well as speeding up test pipelines and minimize TCD. |
38 | 34 |
|
39 | 35 |
|
40 | 36 | ### Database-independent Guides |
41 | 37 |
|
42 | 38 | The following guides explain the details of CAP-level database integration, which are mostly database-agnostic, and apply to all supported databases: |
43 | 39 |
|
44 | 40 | [CDL Compiled to DDL](cdl-to-ddl.md) |
45 | | -: How CDS models in CDL format are compiled to native DDL statements for different databases. |
| 41 | +: How database-agnostic CDS models in CDL format are compiled to native DDL statements for different databases. |
46 | 42 |
|
47 | 43 | [CQL Compiled to SQL](cql-to-sql.md) |
48 | | -: How CDS queries in CQL format are compiled to native SQL statements for different databases. |
| 44 | +: How database-agnostic CDS queries in CQL format are compiled to native SQL statements for different databases. |
49 | 45 |
|
50 | 46 | [Adding Initial Data](initial-data.md) |
51 | | -: How to add initial data to the database using CSV files. |
| 47 | +: How to provide initial data and test data using CSV files, which are loaded into the database automatically. |
52 | 48 |
|
53 | 49 | [Schema Evolution](schema-evolution.md) |
54 | | -: How to manage schema changes and evolution in the database. |
| 50 | +: How to manage schema changes with appropriate schema evolution strategies for development and production. |
55 | 51 |
|
56 | 52 | [Performance Guide](performance.md) |
57 | | -: How to optimize database performance and tuning. |
| 53 | +: Pointing out performance considerations, and common pitfalls. |
58 | 54 |
|
59 | 55 |
|
60 | 56 | ### Database-specific Guides |
|
0 commit comments