Pony ORMで自分のテーブルを指定するときにこのエラーが発生します。pony.orm.core.ERDiagramError:不一致の逆属性
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
マイペソアテーブルはCD_PAISという属性を持っており、この属性は、それが主キーとして設定されているパイステーブルへの参照です。
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")
私は多くの文書と方法を試しましたが、それは成功しませんでした。
お時間をありがとうございます。