edgedb-python icon indicating copy to clipboard operation
edgedb-python copied to clipboard

Schema management

Open agritheory opened this issue 5 years ago • 5 comments

For comment:

  • Add an .edsl reader interface (blocking/ not async)
  • Add validation for .edsl files (blocking/ not async)
  • Add a direct migrate or apply_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.

agritheory avatar Sep 14 '19 00:09 agritheory

One of EdgeDB's goals is live migrations (from roadmap page), so async interface for migrate could be useful in some cases?

Fogapod avatar Jul 31 '20 18:07 Fogapod

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

1st1 avatar Jul 31 '20 19:07 1st1

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.

Fogapod avatar Mar 07 '21 20:03 Fogapod

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.

elprans avatar Mar 08 '21 00:03 elprans

Circling back on this - we are discussing to add a Python entrypoint to run migrations without the CLI.

fantix avatar May 25 '23 15:05 fantix