How can we known a Type contains which Schema by pydgraph

To facilitate better answering of questions, if you have a question, please fill in the following info. Otherwise, please delete the template.

What I want to do

There is a Type that the Schema it contains will be changed at uncertain time, and although i can find it’s information in Ratel, i can’t search it in Ratel every time it changed. so i wanner use pydgraph query it whenever i want.

What I did

query Type at dgraph client.

Dgraph metadata

dgraph version

v20.11

I don’t quite understand the question. Did you mean the type definition changes?

not exactly. the situation is the Schema of Type is not fixed, so when i need to append Type's Schema, i need known what Schema it already has, then i can add new Schema to the Type.
or if there is some way to append Schema for Type directly that no need care about the old Schema.
:thinking:

You can run a schema {} query (docs) to programmatically get the schema for your type which you can then use to update your schema as needed.

The schema is declarative, so there’s no way to “append” updates to your schema. If you want to add or remove fields, apply the new schema as you want it to be. Dgraph figures out what to add or remove.

that’s worked, realy appreciate! :+1:

1 Like