I am getting this error when specifying my tables on Pony ORM.
File "business.py", line 79, in <module>
db.generate_mapping()
File "<string>", line 2, in generate_mapping
File "/home/ancinedev/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pony/utils/utils.py", line 58, in cut_traceback
return func(*args, **kwargs)
File "/home/ancinedev/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pony/orm/core.py", line 724, in generate_mapping
entity._link_reverse_attrs_()
File "/home/ancinedev/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pony/orm/core.py", line 3511, in _link_reverse_attrs_
throw(ERDiagramError, 'Inconsistent reverse attributes %s and %s' % (attr, attr2))
File "/home/ancinedev/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pony/utils/utils.py", line 96, in throw
raise exc
pony.orm.core.ERDiagramError: Inconsistent reverse attributes Pais.pessoas and Pessoa.identificador
My Pessoa table has an attribute called CD_PAIS and this attribute is a reference to Pais table, where it is set as a Primary Key.
class Pais(db.Entity):
_table_ = ['SAD', 'TA_PAIS']
codigo = PrimaryKey(int, column="CD_PAIS")
nome = Required(str, column="NM_PAIS")
pessoas = Set(lambda: Pessoa, reverse="identificador")
class Pessoa(db.Entity):
_table_ = ['SAD', 'TB_PESSOA']
identificador = PrimaryKey(int, column="ID_PESSOA")
nome = Required(str, column="NM_PESSOA")
tipo_pessoa = Required(str, column="IN_TIPO_PESSOA")
numero_registro = Optional(str, column="NR_REGISTRO")
pais = Required(Pais, reverse="codigo")
I tried many documentations and ways but was not success on that.
Thanks everyone for your time.