Lurker News

Comments (323) 88 threads

Earlier comments
nikhilsimha4 replies#
Won't the functional variant read better than the SQL dialect

  movie_reviews
   .filter(_.actor.name.lowercase() == "Zendaya")
   .groupBy(_.title, _.credit_order, avg(_.ratings))
   .sortBy(_.credit_order)
   .take(5)

vs.

  select
    Movie {
      title,
      rating := math::mean(.ratings.score)
      actors: {
        name
      } order by @credits_order
        limit 5,
    }
  filter
    "Zendaya" in .actors.name
RedCrowbar#
It's a matter of taste. We decided to do a "looks like SQL + GraphQL" style because that's what most people are familiar when they think about a query language.

That said, the functional variant is a likely way to represent EdgeQL in programming languages.

1st1#
Keep in mind that EdgeQL is a query language that can be used from any programming language (either over the official libraries, or over HTTP). Functional JS-inspired dialects aren't appealing to everybody.
udfalkso#
I like the flow of yours, but it doesn't capture the GraphQL piece. Where do you specify the nested limit and desired fields for the inner "actors"?
cakoose#
Your query returns 5 rows total. The EdgeDB query returns all movies that Zendaya is in [1] and, along with each movie, the first 5 credited actors.

Also, it looks like your version also does implicit joins (like EdgeDB), but I'm not sure how they would work in that style.
[1] Or maybe only movies where Zendaya is in the first 5 credited actors; I'm not sure.

iddan2 replies#
This is so exciting. We can definitely do better than SQL in 2022 and EdgeDB is a step in the right direction. Been using Prisma[0] in production in the past year and a half (which takes the same approach as EdgeDB but currently works for TypeScript and Golang) and I'm so happy. [0]: https://www.prisma.io/
adevx#
Prisma + Typescript is such a productivity boon, auto completing all query options and database fields. And the results fully typed.
colinmcd#
Prisma did a lot of things right, and we have a ton of respect for the team over there! At the end of the day, building a good, idiomatic API for doing CRUD operations is a hard problem. But building an entirely new query language that fundamentally solves some underlying design flaws and usability issues with SQL is a whole other level of hard.

With EdgeQL, we conclusively solved a lot of these fundamental issues. Now, we're able to use EdgeQL as the foundation of our query builders, which is a huge advantage. We built the first version of the TypeScript QB in ~4 months) and it immediately leapfrogs all the major ORMs in power & expressiveness. But that's only possible because the hard work of designing EdgeQL was already done.
We'll be working on communicating how our query builder works and how it compares to ORMs in some of upcoming posts, stay tuned.

j-pb1 reply#
Hey Yury, Cool stuff!

How do you folks solve the large amount of joins that are the result of graph queries? Any worst-case-optimal multi-way-join secret sauce :D?
Also, with DBs like Datomic competing in the same area, do you have an immutability/versioning story?

1st11 reply#
Thanks! The secret sauce is to pack nested shape queries into array_agg-ed SQL subquery. So we never select unnecessarily wide rows.
kall2 replies#
Sounds like this is not dissimilar from the GraphQL-to-SQL compiler in Hasura, which also brings out surprising performance for wildly nested frontend queries.

Continue this thread — 2 replies

boxed1 reply#
Is there an eta or public wip of a python query builder?
1st1#
Our topmost priority now is launching a hosted version of the product, all hands on deck. Having a proper (and potentially fully type-safe) query builder for Python is literally the next to-do.
Dnguyen2 replies#
How do we migrate from existing Postgres database to EdgeDB? Can traditional app still access all the relational as before and new app access via EdgeDB? We're making use of existing environment and extending it with our own frontend. I would like to understand how I can mix legacy and new code.
1st1#
We plan to introduce a tool for assisting migration from SQL databases, but at this very moment, the only way to migrate an existing app is to re-create your DB schema in EdgeDB and then write a script to import the data. EdgeDB right now is definitely more geared towards starting new projects with it.
infogulch#
Maybe if you move all data to be managed by EdgeDB, then create a separate "legacy" schema that just contains views & triggers that forwards queries and mutations to the EdgeDB database.
mritchie7121 reply#
Do you support columnar storage? i.e. to make analytics queries fast.
1st1#
Not yet, but theoretically we might support something like Timescale in the future.
hyuuu1 reply#
do you have plans to integrate with prisma? it's almost a DIRECT translation of how the query is expressed in Prisma compared to edgedb. Googling quickly, it seems there is a ticket already. I wonder if this could be a low hanging fruit and a great growth channel since prisma is very popular.

https://github.com/prisma/prisma/issues/10210

1st1#
Not really, there's no point in using prisma with EdgeDB as our own query builder is more idiomatic for our product, faster, and we gape more capable.

See also this reply by Colin: https://news.ycombinator.com/item?id=30293544

torartc1 reply#
Any plans to have a gui?
1st1#
Yes, it's in the works!
torartc2 replies#
Dumb question, how do you exit the shell? I feel like I've scoured the docs and can't find it.
colinmcd#

  \q or \quit
If you get stuck, run \help for a list of commands.
msully43212 replies#
What colin said, or (in every terminal emulator I've used), ctrl-d to send end of file, which will close it.
sizediterable#
Congrats Sully and thanks for your work on mypy!
torartc1 reply#
That's interesting, I've always though ctrl-c would close things. I tried so many things like "quit" "exit" ctrl-c "help"

Continue this thread — 1 reply

nextaccountic1 reply#
I have a few questions I can't find after skimming the documentation..

Can someone use Postgres extensions with EdgeDB, like TimescaleDB, PostGIS, Zombodb and Postgres_fdw?
How are sum types (called enums in Rust) modelled in EdgeDB? (like Rust's Result). Do I need to define it with inheritance, where each variant inherits from it? What about adding specific syntax for sum types?
edit: also, I see there's a WIP custom #[derive] for Rust in https://github.com/edgedb/edgedb-rust - can it store Rust types on EdgeDB? Something like http://diesel.rs/ or even https://lib.rs/crates/turbosql

1st1#
Regarding extensions: we plan to wrap the most popular ones like PostGIS to give them idiomatic EdgeQL flavor. We need to do a bit of work to make that the right way.

Sum types can be modeled with inheritance. You can create an abstract base type and use that as target for the links. You can then derive types from it and write polymorphic EdgeQL queries to select/match data.
Rust client is still work on progress, not really open to tinkering unless you want to experiment.

ranguna1 reply#
I looked through the documentation and all I could find was how to spin this up locally. How do I run this on the cloud?

Do you offer fully managed service to host this or do I need to spin up some compute instances of my own ?

the-alchemist1 reply#
What advantages/disadvantages does EdgeDB have over Dgraph.io?

Continue this thread — 1 reply

solarmist1 reply#
Hell yeah. This is what I've wanted ever since I first learned about Apple's CoreData.

This seems great. I have a highly interrelated data model (think parsed natural language text with annotations), and writing SQL to keep all of that data aligned and synced is a pain with an ORM.
Am I right in imagining this works similarly to how Apple's CoreData does? It lets you build objects linked to each other but handles all of the joining and syncing of the data for you to keep the object model in mind.
In the same vein will you be creating a Swift client?

1st12 replies#
I'm not too familiar with the CoreData API, but from a quick googling it seems like this is some sort of an ORM on top of SQLite.

We position EdgeDB as a database server, not a library, partly because you can interact with it from different programming languages. But we design our client library with focus on API composability, check out our edgedb-js library for example: https://www.edgedb.com/docs/clients/01_js/index
As for the Swift, it would be great to have it one day. I have a counter question: how many of you use Swift to write server-side logic?

solarmist2 replies#
Right, but conceptually the way you interact with it is the same. I'm not trying to belittle what you've done. I'm in fact very excited about it.

And EdgeDB is very needed because it's just an Apple library currently.
Conceptually, my impression is that EdgeDb is relational tables (highly-typed) queried, combined, and modeled as nodes in a graph/tree. Is that conceptually correct?
I don't, but I would like to if I could deploy Swift code to Azure. I love Swift as a language.

danappelxx1 reply#
Swift has a family of Docker containers and an (admittedly modest) ecosystem of backend frameworks. You can definitely run it on Azure :)

Continue this thread — 1 reply

colinmcd2 replies#
That's correct! Though that's true for most ORMs as well, and we try not to get lumped into the ORM bucket...too much bad blood.

I've dabbled with CoreData myself and it's a phenomenal API. Apple comes up with a lot of great stuff. In fact, given how much server-side Swift there is these days, we'll have to look into building a Swift client library at some point.

Continue this thread — 2 replies

sixdimensional#
Why position it as a database server if you could position it as something else, like an interface server? Just curious.

Load more comments