Child table referencing a mother table
That works perfectly in the end. My mistake was elsewhere.

Have a nice day!
Hi!

I can't figure out how to get a table referencing itself. My goal is to get a child table referencing a mother table with same types.

This code seems to be not working:

DeferredMyTable = DeferredRelation()

class MyTable(BaseModel):
    name = TextField()
    image = TextField()
    root_my_table_id = ForeignKeyField(MyTable, null=True)

    class Meta:
        db_table = 'MyTable'

DeferredMyTable.set_model(MyTable)

Am I wrong when I design my table like that or is it an issue?

Regards,

Gaël