From 07fef6e77aa87f8e192c900818bad639aeb3bac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Thu, 29 Jan 2026 10:10:54 +0100 Subject: [PATCH 1/2] Update CQL to SQL translation details in documentation Clarified CQL behavior regarding != operator and its translation in SQL databases. Updated note on database-specific behavior for portable functions. --- guides/databases/cql-to-sql.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guides/databases/cql-to-sql.md b/guides/databases/cql-to-sql.md index 51810f94c..ee41d29ce 100644 --- a/guides/databases/cql-to-sql.md +++ b/guides/databases/cql-to-sql.md @@ -49,7 +49,7 @@ SELECT from Books where genre.name != 'Science Fiction'; The result set includes all books where genre is not 'Science Fiction', including the ones with an unspecified genre. In contrast, using SQL's `<>` operator, the ones with unspecified genre would be excluded. -The CQL behavior is consistent with common programming languages like JavaScript and Java, as well as with OData semantics. It is implemented in database by, the translation of `!=` to `IS NOT` in SQLite, or to `IS DISTINCT FROM` in standard SQL, and to an equivalent polyfill in SAP HANA. +The CQL behavior is consistent with common programming languages like JavaScript and Java, and with OData semantics. The runtime implements this by translating `!=` to `IS DISTINCT FROM` in standard SQL databases (PostgreSQL, H2), and to equivalent polyfills using `CASE` expressions in SAP HANA and SQLite. > [!tip] Prefer == and != > Prefer using `==` and `!=` in the very most cases to avoid unexpected `null` results. Only use `=` and `<>` if you _really_ want SQL's three-valued logic behavior. @@ -83,6 +83,9 @@ This operator is translated to the best-possible equivalent in the target databa Following are portable functions guaranteed by CAP. These can safely be used in CDS view definitions as well as in runtime queries expressed in CQL, and are translated to the best-possible database-specific native SQL equivalents. +> [!note] Database-Specific Behavior +> While CAP aims for consistent behavior, some functions may exhibit subtle differences across databases due to underlying SQL dialect variations. Test critical functionality on your target database. + String functions: - `concat(x,y,...)` From a664d7aa8df5965624e12e4b621e7f2a7cfa42d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Thu, 29 Jan 2026 15:44:43 +0100 Subject: [PATCH 2/2] Document data loading order and bulk loading tips Added section on data loading order and handling large datasets. --- guides/databases/initial-data.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/guides/databases/initial-data.md b/guides/databases/initial-data.md index e3ec3ee78..3449346f2 100644 --- a/guides/databases/initial-data.md +++ b/guides/databases/initial-data.md @@ -81,7 +81,21 @@ Common rules apply to text content in `.csv` files, like: | Numeric content should be treated as texts | -> enclose in double quotes | | Boolean values should be treated as text | -> enclose in double quotes | +## Data Loading Order +CAP loads CSV files in **alphabetical order by filename**. When tables have foreign key relationships, ensure parent tables load before child tables to avoid constraint violations. + +**Example:** +``` +db/data/ +├── sap.capire.bookshop-Authors.csv # Loads first (parent) +└── sap.capire.bookshop-Books.csv # Loads second (references Authors) +``` + +The filename prefix ensures correct order: `Authors` loads before `Books` alphabetically. If you encounter foreign key violations, verify your file naming follows dependency order. + +> [!tip] Large Datasets +> For datasets with thousands of rows, consider using database-specific bulk loading tools instead of CSV files. The CSV mechanism loads all data in a single transaction, which can cause memory issues and long startup times. ## Initial vs Test Data