Replies: 6 comments 1 reply
-
Regardless of implicit defaults, we need to have a way to enable users to connect to a non-default database on a given instance. For this purpose, the slash syntax is another variant of a structured string that would have to be understood by the user, escaped by the user, parsed on our side. I prefer the clarity of a DSN. As for implicit defaults, I think with cloud panels, Studio, and the CLI, a user who doesn't know about database names will learn about them from the tools. As you said, those tools expose the name already. I like the current approach of connecting with the default database implicitly. I don't have a horse in the race for the best name for the default database, "db" is short and cute, I like it. |
Beta Was this translation helpful? Give feedback.
-
Full DSN is very verbose. If the only thing you want is to connect to a different DB in an instance we currently want the user to do this:
And then there are other downsides to having a default DB. Take a look for @elprans' proposal at #1683. He proposes there to have an object to store all instance config in, let's call it
The beauty of this approach is that you can configure an But what if you want to configure a custom non-default DB? You'd need to:
and then
So IMO, DB name must be a part of instance config. And if it has to be and we can either specify an instance by name or by creating a config object, I propose the instance name to include DB name too.
I'd like to hear more substantive motivation for having a default DB than simple "like" or "dislike". I for one see no benefit of having a default DB; even MongoDB educates its users about different DBs and requires a DB name when you connect to it. But I've listed quite a number of reasons why instance names should include a DB name and if we make them to do that there's little motivation to have a default one. |
Beta Was this translation helpful? Give feedback.
-
Well, just few months ago we though that users will not use multiple databases too much. This is even more true if we say that each project will have it's own instance (because each project should manage their own current version and upgrade independently). I'm not strongly opposed to required database name, but I'm opposed to |
Beta Was this translation helpful? Give feedback.
-
Also does it mean that calling repl is now as easy as |
Beta Was this translation helpful? Give feedback.
-
I thought more along the lines of
That's still true. But I'm not sure how not having a default DB breaks any of that. Literally all DBs require it to be specified explicitly at the connection time.
I'm thinking about this slightly differently: it's always a DSN. Just when you need to specify host/port/etc you start with |
Beta Was this translation helpful? Give feedback.
-
connect('instance', database='other_db') I wouldn't even mind: connect(server='instance', database='other_db') However this looks clear to me, too: connect('instance/dbname')
|
Beta Was this translation helpful? Give feedback.
-
With the new connect API a user can connect to EdgeDB just by specifying an instance name. The database name isn't required and is set by default. I think that's a bad idea that only complicates things unnecessarily:
Therefore, I propose to always require the DB name to be specified with the following API:
connect()
methods will continue to support DSN strings, where a DB name comes after the first/
, as inedgedb://edgedb@localhost/DBNAME
connect()
methods can also accept an instance name which would come with an explicit DB name, as in:INSTANCE/DBNAME
.And I also propose to change the default DB name to a simple "db".
Beta Was this translation helpful? Give feedback.
All reactions