The article mentions a "SQL-to-SQL" compiler -- how exactly does this work?
Are you intercepting plain SQL queries over the wire, analyzing them, and then rewriting them into the form of queries that EdgeDB internally generates?
Any chance you'd be able to link the relevant parts of the code?
I had a look through the "/pg" directory but there was a lot there and it wasn't immediately clear which parts did what
1. SQL parser: https://github.com/edgedb/edgedb/tree/master/edb/pgsql/parse... 2. SQL transpiler: https://github.com/edgedb/edgedb/tree/master/edb/pgsql/parse... 3. Wire protocol handler: https://github.com/edgedb/edgedb/blob/master/edb/server/prot...
From what I'm seeing, the upgrade path is essentially dump and restore. This was the case for moving from EdgeDB v1 to v2 as well. Since EdgeDB is a fast moving target this creates a lot of friction for older databases to upgrade.
Is there plans for replication support or a more robust upgrade path?
Couldn't find anything on the website but assumed it would be underpinning e.g. the Python lib.
- Can EdgeDB solve the problems like `soft-delete`? Prisma can't do this good, there are third-party packages, but I don't trust these packages because authors often drop support.
- How about hooks, for example, I want to trigger scripts after/before a record is added to the table.
Yes, with access policy rules. E.g
global hide_deleted: bool;
type SoftDeletable {
deleted: bool;
access policy hide_deleted
allow all
when (global hide_deleted)
using (not .deleted);
}
The above will effectively "hide" objects with `.deleted` set to `true` from all queries when the `hide_deleted` global is set to true.> How about hooks, for example, I want to trigger scripts after/before a record is added to the table.
EdgeDB supports triggers: https://www.edgedb.com/docs/changelog/3_x#triggers. Future versions will add support for causing effects outside of the database, e.g. call a WebHook or some such.