I noticed that there s no table in
# spicedb
y
I noticed that there's no table in [database]spicedb [schema]public, while there ought to be tables like those listed in this picture. My question is how can I create them without prompt
spicedb migrate xxx
as if I used in my dev env, since it's a brand new spicedb instance with no schema and relationships in it. it doesn't need migrate anything. Besides, I only have spicedb executable in docker container, which just panic and exited immediately as it, so I can't prompt this migrate cmd.

https://cdn.discordapp.com/attachments/844600078948630559/1145626923897200720/image.png

v
It does not work that way.
spicedb migrate
always needs to be run, it's what creates the database schema. The fact you haven't done any
WriteSchema
calls does not matter here - the database tables need to be there or else SpiceDB won't come up healthy. SpiceDB does not create tables based on your API calls, it just writes to it. The database schema is always the same and independent of the SpiceDB schema written. Here is a working example of a docker compose with SpiceDB and Postgres that runs `spicedb migrate`: https://github.com/authzed/examples/blob/main/datastores/postgres.yml
y
I see, in this example you use migrate service to make sure postgres have those required tables pre-created by calling
spicedb migrate
. And in this case this command doesn't migrate but only initiate database. what should I do if I wanna use this
spicedb migrate
command to migrate data from an already-existed spicedb instance to a new datastore? Can I migrate relationships and schema from memdb or other datastore to a new one?
v
There may be some misunderstanding around
spicedb migrate
. It's a command that's in place to create all database tables, and if there is ever a change to the that database schema, it handles it to. For example, when
Caveats
feature was introduced, you'd typically see a
introduce_caveats
database migration for all datastores that creates the corresponding table. It's not for migrating from one SpiceDB instance to another. What you are describing is conceptually different from database migration (term that usually refers to schema migration / data migration, which are DDL / DML statements applied to your database). If you want to move your data from one SpiceDB instance to another, there is a new experimental API you can use for this called
BulkExport
and `BulkImport`: https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.ExperimentalService.BulkExportRelationships https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.ExperimentalService.BulkImportRelationships
y
does python lib 'authzed' contains these two gRPC API?
v
It should, and if it does not, it's an oversight
y
I see, they're contained in authzed of latest version 0.13.0
3 Views