-
Notifications
You must be signed in to change notification settings - Fork 11
DB‐Layer Sync Agenda
Please add new topics at the top of the document under Topic Pool
### Short Topic Title
- Duration:
- Responsible:
- Link:
- Decision:
Things to discuss when "Next Sync" does not have enough items.
OData queries may lead to queries like:
SELECT from Authors where exists books[genre.name = 'Thriller']
We generally reject path expressions within infix filter conditions…
In this POC the subquery for the exists books
is enriched
with the filter condition (genre.name = 'Thriller'
):
SELECT from Authors as Authors where exists (
SELECT 1 from Books as books where books.author_ID = Authors.ID AND genre.name = 'Thriller'
)
→ This query is then again transformed by cqn4sql
to get the proper joins in the sub-select
→ This approach is a quick-win to enable the queries which used to be working with cds7 (due to native hana assocs)
→ There is a better approach, which probably performs better. The initial query could be re-written to:
SELECT from Authors where exists books[exists genre[name = 'Thriller']]
This concept of pre-pending exists
predicates before path expressions and re-writing them into filter conditions could generally
be applied to path-expression in where
clauses, see the next section.
Given this query:
SELECT from Authors where books.title LIKE '%Potter%'`
will return the same Authors.ID
multiple times for each Harry Potter
book → We get the same ID 7 times…
It is safe to say that a path expression (especially following a to-many
association) implies an exists
semantic.
The above query is better expressed as
SELECT from Authors where exists books[title LIKE '%Potter%']
as this will match an author only once, even if this author has multiple books which would satisfy the condition.
So we could re-write the initial query and prepend the exists
predicate in front of the path expression and re-write the condition into
a filter for the assoc following the exists.
- It is not trivial to do so, what about
SELECT from Authors where toLower( books.title ) LIKE '%potter%'
- → the query could be re-written to
SELECT from Authors where exists books[ toLower(title) LIKE '%potter%' ]
is this worth the effort?
Ad-hoc services are depending upon undefined behaviors.
const db = await cds.deploy ('<filename>') .to ('sqlite::memory:')
{
"func": "count",
"as": "$count",
"args": [
{
"ref": [
"books" // assocs are not allowed as values for expressions
]
}
]
}
→ Maybe construct a subquery and count returned rows
- Have a look at https://github.com/cap-js/cds-dbs/pull/676.
hana-native types like hana.REAL, see internal issue also related https://github.com/cap-js/cds-dbs/issues/769
→ accepted, to be supported with enxt version
see internal issue + mail
→ seems like weird setup
https://github.com/cap-js/cds-dbs/pull/561
→ cdsnode bli created to implement a workaround
Enabling On-Premise Database Connections through the Cloud with New Proxy Configuration Feature in @cap-js/postgres
Federico has successfully developed a solution for connecting to an on-premise database through the cloud by using a socket as a proxy. This approach involves redirecting the database connection to the Cloud Connector via a destination service, thereby reaching the on-premise system without directly involving the Postgres connector. Federico suggests integrating the ability to specify a destination in the database configuration into the @cap-js/postgres package. This would allow the pg client to initiate a socket connection based on the destination, rather than the standard hostname and port configuration.
- Duration: 15 min
- Responsible: POs
- Link: https://github.com/cap-js/cds-dbs/issues/523#issuecomment-2045517520
- Decision: see https://github.com/cap-js/cds-dbs/issues/523#issuecomment-2056931479
see test 'PUT delete deep composition must not affect other same level composition in response' in runtime: cds/tests/_runtime/odata/__tests__/integration/complexAssociationsAndCompositions.test.js
→ A huge CQN is produced which leds to a hung up SQL Service, probably due to cqn4sql
not terminating.
- Duration: 15 min
- Responsible: Lars / Patrice
- Link: https://github.com/cap-js/cds-dbs/pull/576
- Decision: This must be handled already by
deep-queries.js
, we should not construct a query like this. However, we could use recursive queries for models like this to push down the handling of the nested data to the database. This will require some more effort.
https://github.com/cap-js/cds-dbs/pull/252
- Duration: 10 min
- Responsible: Johannes
- Decision: Now that we have
@cap-js/hana
, we could make use of this feature → DO IT
- Duration: 10 min
- Responsible: Johannes
- Decision: We will add a quoted mode.
await cds.delete({ ref: [E.name], as: 'a' }).where(`value1 < 10`)
.where({ 'not exists': cds.read(E, ['1']).alias('b').where('b.value1 = a.value1 AND b.value2 >= 10')})
- Duration: 10 min
- Responsible: Johannes
- Link: snow ticket
- Decision: Children should be deleted; Johannes will build a test for this. Was this supported before?? → https://github.com/cap-js/cds-dbs/pull/571 → according to issue creator, it worked before.
At the moment, this is done by the protocol adapter. However, that should be solved by the database. Can compiler generate a default value?
- Duration: 10 min
- Responsible: All
- Link: https://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#_Toc38457755
- Decision:
- Ask Ralph how this is represented in ODATA → Johannes
-
default
values for arrayed type → spec meeting → Patrice
- Duration:
- Responsible:
- Link:
- Decision:
use compilers keywords via cds (cds needs to export postgres
and hana
keywords like it does for sqlite
)
- Duration: 10 min
- Responsible: Patrice
- Link: https://github.com/cap-js/cds-dbs/pull/526 && https://github.com/cap-js/cds-dbs/pull/525
- Decision:
- Duration: 30 min
- Responsible: Bob & Patrice
- Link: https://github.com/cap-js/cds-dbs/pull/488
- Decision:
- Compiler removes beta and allows views with params
- document limitations in runtimes (Write operations, Deep operations...) → Johannes
- sync with java RT: what do they support? → also sync on documentation → Patrice
- alternative for
sqlite
? → Bob - → We could use session variables for each view and use them whereever the parameters are followed
- Duration: 5 min
- Responsible: all
- Link: https://github.com/cap-js/cds-dbs/issues/411
- Decision: → Not so bad, old DB behaves alike. We create children without parents in the worst case.
- Duration: 10 min
- Responsible: Patrice / Lars
- Link: https://github.com/cap-js/cds-dbs/pull/524
- Decision: we need to do it that way. Those queries are e.g. used in sflights analytical list page.
- Duration: 10 min
- Responsible: Bob & Patrice & Daniel
- Link: https://github.tools.sap/cap/cds/pull/3971/files#diff-db08970c1dd2813413de0f2569564d2358c6df1eb227813652bce2cb09dc1b8a
- Decision: Close PR, we do not set the
target
to the first arg of the join args, but use a generic cds.entity as prototype → Johannes
How to handle postgres issues
- Duration: 5 min
- Responsible: all
- Decision:
- We can't help everyone in every scenario, it is okay if issues stay open for a while.
- during reCAP we can suggest a technical committee, including externals especially for PG. → Meet regularly and sync on community, features, issues, … → Patrice
- Duration: 5 min
- Responsible: all
- Decision: Mail to Sebastian → we want a 40 minute timeslot for promoting the new dbs → Patrice
- Duration: 5 min
- Responsible: all
- Link: https://github.com/cap-js/cds-dbs/issues/423#issuecomment-1914588468
- Decision:
- Find better default max pool size for postgres and align with other dbs
- Update troubleshooting docs re pool timeout error messages, Steffen / Sebastian
- Duration: 5 min
- Responsible: Johannes
- Link: https://github.com/cap-js/cds-dbs/pull/490
- Decision: Do it → https://github.com/cap-js/cds-dbs/pull/495