You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a postgres DB with the following tables and foreign key relationship...
CREATETABLEbar
(
id integerNOT NULL,
value text,
CONSTRAINT"PK_bar"PRIMARY KEY (id)
);
CREATETABLEfoo
(
id integerNOT NULL,
bar integer,
CONSTRAINT"PK_foo"PRIMARY KEY (id),
CONSTRAINT"FK_foo_bar"FOREIGN KEY (bar)
REFERENCES bar (id) MATCH SIMPLE
ONUPDATE NO ACTION ON DELETE NO ACTION
);
...I get the following error when running sandmanctl:
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\sandmanctl.exe\__main__.py", line 9, in <module>
File "C:\Python27\lib\site-packages\click\core.py", line 664, in __call__
return self.main(*args, **kwargs)
File "C:\Python27\lib\site-packages\click\core.py", line 644, in main
rv = self.invoke(ctx)
File "C:\Python27\lib\site-packages\click\core.py", line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python27\lib\site-packages\click\core.py", line 464, in invoke
return callback(*args, **kwargs)
File "C:\Python27\lib\site-packages\sandman\sandmanctl.py", line 43, in run
activate(name='sandmanctl')
File "C:\Python27\lib\site-packages\sandman\model\utils.py", line 188, in activate
register_classes_for_admin(db.session, show_pks, name)
File "C:\Python27\lib\site-packages\sandman\model\utils.py", line 160, in register_classes_for_admin
admin_view.add_view(admin_view_class(cls, db_session))
File "C:\Python27\lib\site-packages\flask_admin\contrib\sqla\view.py", line 289, in __init__
menu_icon_value=menu_icon_value)
File "C:\Python27\lib\site-packages\flask_admin\model\base.py", line 584, in __init__
self._refresh_cache()
File "C:\Python27\lib\site-packages\flask_admin\model\base.py", line 653, in _refresh_cache
self._list_columns = self.get_list_columns()
File "C:\Python27\lib\site-packages\flask_admin\model\base.py", line 729, in get_list_columns
columns = self.scaffold_list_columns()
File "C:\Python27\lib\site-packages\flask_admin\contrib\sqla\view.py", line 384, in scaffold_list_columns
for p in self._get_model_iterator():
File "C:\Python27\lib\site-packages\flask_admin\contrib\sqla\view.py", line 311, in _get_model_iterator
return model._sa_class_manager.mapper.iterate_properties
File "C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py", line 1803, in iterate_properties
configure_mappers()
File "C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py", line 2589, in configure_mappers
mapper._post_configure_properties()
File "C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py", line 1694, in _post_configure_properties
prop.init()
File "C:\Python27\lib\site-packages\sqlalchemy\orm\interfaces.py", line 144, in init
self.do_init()
File "C:\Python27\lib\site-packages\sqlalchemy\orm\relationships.py", line 1549, in do_init
self._process_dependent_arguments()
File "C:\Python27\lib\site-packages\sqlalchemy\orm\relationships.py", line 1573, in _process_dependent_arguments
setattr(self, attr, attr_value())
File "C:\Python27\lib\site-packages\sqlalchemy\ext\declarative\clsregistry.py", line 271, in __call__
x = eval(self.arg, globals(), self._dict)
File "<string>", line 1, in <module>
File "C:\Python27\lib\site-packages\sqlalchemy\ext\declarative\clsregistry.py", line 216, in __getattr__
" directly to a Column)." % key)
sqlalchemy.exc.InvalidRequestError: Property 'bar' is not an instance of ColumnProperty (i.e. does not correspond directly to a Column).
The appears to be because of the foreign key between foo.bar and bar.id: the error happens whenever the foreign key column and parent table have the same name.
The text was updated successfully, but these errors were encountered:
When using a postgres DB with the following tables and foreign key relationship...
...I get the following error when running
sandmanctl
:The appears to be because of the foreign key between foo.bar and bar.id: the error happens whenever the foreign key column and parent table have the same name.
The text was updated successfully, but these errors were encountered: