edgedb-python
edgedb-python copied to clipboard
Schema management
For comment:
- Add an .edsl reader interface (blocking/ not async)
- Add validation for .edsl files (blocking/ not async)
- Add a direct
migrate
orapply_schema
interface (blocking/ not async) - Add a direct
export
interface, (also blocking) perhaps something like:
from pathlib import Path from typing import Union export(db: str, path: Path, tables: Union[set, list, tuple]) # what other options?
My expectation is that these are not likely to and should not be run in an async context, but maybe I'm just not aware of the use case. I would be happy to work on this piece of the project.
One of EdgeDB's goals is live migrations (from roadmap page), so async interface for migrate
could be useful in some cases?
Maybe. We are working on getting https://github.com/edgedb/rfcs/blob/master/text/1000-migrations.rst implemented as soon as possible. Migrations can be quite complicated so they necessitate an interactive process. So far we don't have a good idea how to expose that process as a high-level Pythonic API. We'll see if that's possible once the RFC is implemented and we get some experience with using it.
cc @elprans
Any updates on this one? Looks like there is a working CLI migration functionality now.
edgedb migrate
is not interactive and can probably be easily implemented here. Or no? Does the CLI do any work other than shipping ~~.esdl~~ .edgeql files to database in correct order?
I deploy my app using docker and it'd be nice to not depend on large edgedb-cli binary just for migrations.
On the edgedb migrate
path the CLI isn't doing anything special other than sending the content of *.edgeql
files from dbschema/migrations
(which is where edgedb create-migration
puts them). The only complication is determining which migrations have been applied already by querying schema::Migration
and parsing the migration ids from the files.
it'd be nice to not depend on large edgedb-cli binary just for migrations.
Most of the binary weight is debug symbols, which we ship while the thing is still in beta for better crash dumps when things go south. A stripped release edgedb-cli
binary is currently around 10MB.
Circling back on this - we are discussing to add a Python entrypoint to run migrations without the CLI.