Any way to create types dynamically

Trying to create type and its fields dynamically according to data I will have any way?

Welcome Darshan.
Client libraries allow for dynamic alteration of schema. Check it out!

type  Account 
 { 
 Id:str
}

this is not working with pydgraph client it says
details = “line 1 column 5: Missing colon”

Here is an example on how to format the schema for types.
An example form test_type_system.py:

       schema = """
                    type Person {
                      name
                      age
                    }
                    name: string @index(term, exact) .
                    age: int .
                """

Here is the alter link for python clients.

Please review these links.

But the fields schema are already there why would I define them again with type?

Can’t I just add new type with existing fields and add it to existing schema

You don’t need to define fields/predicates again. You can just pass the type specification and it should work fine.

That’s what, I am facing issue of colon missing If i just pass with new type and attach existing fields which is there in schema

type  Account 
 { 
 Id
Name
Address
}

Just passing above type to client.alter() method should work fine, but it doesnt work

When you run alter with this Account schema, what errors do you find?

details = “line 1 column 5: Missing colon”

That is certainly strange. Can you please also share the python code associated? We can try and reproduce it.

This got resolved looks like there was an issue with newline missing for opening curly brace and before end curly brace. Now it worked thanks

But yes it should not say colon missing, instead it should say the schema format is incorrect or something which will help developer to identify the actual root cause and look for the solution