1.0 Alpha 7
This changelog summarizes new features and breaking changes in EdgeDB 1.0 alpha 7 “Lalande”.
EdgeQL
-
Add support for per-database configuration by adding a new
current database
configuration scope (#1867).This allows to make changes that are more broad that
session
scope and less broad thatsystem
:Copyconfigure current database set query_work_mem := '4MB';
-
Add support for altering
enums
in order to add new labels (#1956).Copydb> ...
create scalar type Color extending enum<Red, Green, Blue>;
OK: CREATE
Copydb> ...
alter scalar type Color extending enum<Red, Green, Blue, Magic>;
OK: ALTER
-
Update
std::decimal
andstd::bigint
criteria to be sensitive to the presence of.
so that123.0e100n
is a decimal, but123e100n
is a bigint (#1804). -
Functions can now return a set of tuples (#2010).
Copydb> ... ... ... ... ... ...
create function enumerate_letters(word: str) -> set of tuple<int64, str> using ( enumerate( array_unpack( str_split(word, ''))) );
OK: CREATE
Copydb>
select enumerate_letters('hello');
{(0, 'h'), (1, 'e'), (2, 'l'), (3, 'l'), (4, 'o')}
-
Functions can no longer share a shortname with types in order to avoid name resolution issues (#1465).
-
Forbid taking implicit cross products with volatile operations to avoid unintuitive behavior (#1784).
Copydb>
select ({1, 2}, random());
error: can not take cross product of volatile operation ┌─ query:1:17 │ 1 │ select ({1, 2}, random()); │ ^^^^^^^^^ error
Copydb>
for x in {1, 2} union (x, random());
{(1, 0.25724045818607166), (2, 0.7268530965023459)}
-
Forbid scalar types from having more than one concrete base (#1790).
-
Forbid partial path expressions in
limit
/offset
clauses (#1919). -
Forbid changing cardinality via inheritance (#1772).
-
Remove legacy unused
.>
token (#1648). -
Fix cardinality inference on operators (#2001).
Migrations
We’ve made a lot of progress in implementing features of the RFC 1000 migrations, although this is still a feature under development. Some of the works can be broadly categorized as overall improvement of the proposed migration DDL and the granularity of the control the user has over these proposed changes. More specifically we’ve made a lot of improvements in migrations that alter or remove things from the schema.
Here’s an example of creating a schema with a type that has a property with a default value:
db> ... ... ... ... ... ... ... ...
start migration to {
module default {
type Foo {
property val -> str {
default := 'n/a'
}
}
}
};
We use describe current migration as json
to see what EdgeDB is proposing. The JSON format makes it
easier to potentially integrate this with other tools. For this
example it’s worth turning on json
output mode for edgedb REPL:
db>
\set output-mode json
db[tx]>
describe current migration as json;
[ { "complete": false, "confirmed": [], "parent": "m16wif5skjyqd6dbp5uwa67qrgw422qcwa3vctx77z7r34yx5mbigq", "proposed": { "confidence": 1.0, "operation_id": "CREATE TYPE default::Foo", "prompt": "did you create object type 'default::Foo'?", "statements": [{"text": "CREATE TYPE default::Foo {\n CREATE OPTIONAL SINGLE PROPERTY val -> std::str {\n SET default := 'n/a';\n };\n};"}] } } ]
Since proposed statements look OK, we can go ahead and just apply the whole migration.
db[tx]>
populate migration;
OK: POPULATE MIGRATION
db[tx]>
commit migration;
OK: COMMIT MIGRATION
Now, let’s remove that default
, after all the property is optional.
db> ... ... ... ... ... ...
start migration to {
module default {
type Foo {
property val -> str;
}
}
};
db[tx]>
describe current migration as json;
[ { "complete": false, "confirmed": [], "parent": "initial", "proposed": { "confidence": 0.9956623333333332, "operation_id": "ALTER TYPE default::Foo", "prompt": "did you alter object type 'default::Foo'?", "statements": [{"text": "ALTER TYPE default::Foo {\n ALTER PROPERTY val {\n DROP default;\n };\n};"}] } } ]
The proposed statements will drop default
for our property, so all
seems to be in order and we can apply this migration, too, using
populate migration
and commit migration
.
We’re currently working on a CLI tool for managing migrations more
gracefully and without the need for the user to rely on these
low-level commands (like``start migration`` or describe current
migration as json
). The migration tool is going to use these
commands behind the scenes, though.
We’ve also made improvements to the following migration features:
-
Better overall dependency tracking to make sure that migration to the new state can be resolved and produces valid command sequence.
-
Type, index and alias renaming while keeping track of affected expressions to make sure they don’t become invalid (#1841)
-
Function renaming (#1971)
-
Moving a type between modules (#1890).
-
Changing base types and changing where constraints are defined (#1996).
Command-Line Tools
-
Default user and default database are now simply
edgedb
and no longer named after the system user. -
Add
--connect-timeout
to control how long to wait for EdgeDB response (#191). -
Add
--dsn
as a connection option (#176). -
Add
migration-log
command to view applied migrations (#200). -
Non-interactive error messages are prefixed by
edgedb error: ...
, to quickly spot which tool has errored in scripts. -
Improve accuracy of syntax error reporting in REPL (#1959).
-
REPL now supports full range of datetime values (#192).
-
\lt
in REPL doesn’t show implicit internal types (unions and intersections) (#169). -
Remove
\set introspect-types
in REPL and show typenames by default.
Server Command-Line
-
Make
edgedb server install
friendlier on linuxes without systemd allowing foreground run (#171). -
When installing server
DEBIAN_FRONTEND
is nownoninteractive
by default and is overridable (#188). -
Add
edgedb server logs
(#172). -
Add
edgedb server info
command. -
Deprecate
--default-database
and--default-database-user
(#1879).
Bindings
We now have an improved spec for client API (RFC 1004). Rolling out the support for the full spec will be done in the next release, but some implementation work has already started.
-
Move request methods into Executor interface (#76) as part of the RFC 1004 changes.
-
Update the edgedb-python driver to 0.12.0.