EdgeDB: A New Beginning
edgedb.com
edgedb.com
This has been done before of course, but I'm not sure I've seen this combination of syntax on an RDB before. It's certainly easier to read and write that a bunch of outer joins.
What would be nice to know is whether this can work on top of an existing PG database, providing easier syntax.
While their last example makes _sense_:
open_prs := User.<assignee[IS PullRequest] {
title
} FILTER .status = 'Open'
I don't find it easy to read/understand. If the [bracketed expression] acts as a filter, why not: open_prs := User.<assignee[IS PullRequest AND
.status='open'].title
which preserves the nice dot-chaining for link traversal.That would require introspecting arbitrary relational schemas and trying to represent them as an object graph. I don't think something like this can be done automatically and reliably.
That said, we have a tentative plan to introduce support for external databases (through FDWs, so not necessarily Postgres). The mapping specification would have to be explicit though.
User.<assignee[IS PullRequest].assignees[IS User].name
The reason for the FILTER clause is that you may want to write something like: FILTER User.name = 'Alice' OR User.<assignee[IS PullRequest].status = 'Open'
which is impossible to express if we were to simply filter each node set in the path separately.Eg. if there is a m:n relationship do not make me enter some foreign key values into a join table but give me some nice autocomplete fields or checkboxes on either side of the relationships' types.
Or if there is some transitive relationship like "country -> city -> district -> office", give me some nice way to filter the list of offices by a given country oder district.
Auto generates this from the schema as web interface.
I already tried building this for SQL schemata but it seems like a schema definition as provided by EdgeDB seems predestined for this use case.
A schema like:
create table post (
id serial primary key,
author_id int non null references user(id),
headline text,
body text,
...
);
Can query relations like so: allPosts {
edges {
node {
headline
body
author: userByAuthorId {
name
}
}
}
}
[1] https://github.com/graphile/postgraphile/tree/postgraphile#a...Something like using JSONB datatype in a entity key value store table. Mapping materialized views using pgsql json functions. To flatten out the data into sql tables for normal consumption?
Got extensively tested with swagger v2(openapi)[1].
After the json-schema you write a quick swagger spec and modify a couple of mustache templates[3] to generate a crud interface for server and client. In your language of choice.
All with one magic yaml file; but file format agnostic as well;
Personally I struggle to read the json format.
[0]: https://github.com/json-editor/json-editor [1]: https://github.com/swagger-api/swagger-editor/tree/2.x [3]: https://github.com/swagger-api/swagger-codegen/
It has been argued -- for example by Neo4j, which is one of the leading graph databases -- that index-free adjacency is an essential feature for any real graph database, or as they put it, "Index-free adjacency is the key differentiatior of native graph processing." https://neo4j.com/blog/why-graph-databases-are-the-future/
By my reading, this system doesn't feature index-free adjacency as it uses relational tables as the substrate for edges. Thus EdgeDB won't be especially well suited type of graph traversals and queries that people actually select graph databases for. Which seems like a compelling reason not to identify it as a graph database.
I feel like they make a pretty good case as to why this isn't a graph database, though I wonder if you might expand on your reasoning?
I know most of these are heavy lifts, but any ideas around...
...materialized views?
...built-in versioning (Datomic-like)?
...story on how to play it nice with backend languages (One thing MongoDB imo did right)?
Yes, although not in the initial release. EdgeDB _does_ support regular views, which, like the queries, can define arbitrary data hierarchies which can be treated like real object types. This topic deserves a separate blog post.
> built-in versioning
Not planned as a native feature as of now, although that's something that can be implemented on top with the query rewrite system.
> story on how to play it nice with backend languages
Immediately, EdgeDB supports a RESTful protocol with JSON as the exchange format. We will be adding native protocol implementations for major languages as well.
The main differentiating point of EdgeDB is EdgeQL (and native GraphQL support).
License?
Given it's based off of postgres, whats the story look like for sharding/scaling?
They don't mention CAP, 2PC or anything like that, so obviously no sharding, no scaling, no consistency guarantees in a distributed environment.
As for scaling, citusdata clearly demonstrates that its possible to scale Postgres, so we are not particularly worried about this.
Sorry, I don't see this as true. Databases are no more "defining" of a tech stack than any other part, comms, security, ui, business logic, etc.
You only see it as "defining" if the database is your product. In most cases, the business logic is the defining part of the system, all parts of the tech stack should be replaceable.
Most applications need to store data, but most applications dont need to store data in a particular db.
I just saw lots of waffling.
abstract type Text:
link body -> str
type Post extending Text
type Comment extending Text
And then query Text instances like this: SELECT Text {
body,
title := 'Post' IF Text IS Post ELSE
'Comment' IF Text IS Comment ELSE
'unknown'
};So, basically PostgreSQL with a different query language. Can't figure out what problem this is trying to solve.