sandman2 icon indicating copy to clipboard operation
sandman2 copied to clipboard

Error creating backref

Open joshiparth1000 opened this issue 3 years ago • 1 comments

I am trying to use this with Apache Guacamole mysql database. I am getting the below error when running sandman2ctl

Traceback (most recent call last): File "/usr/local/bin/sandman2ctl", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/site-packages/sandman2/main.py", line 51, in main app = get_app(args.URI, read_only=args.read_only, schema=args.schema) File "/usr/local/lib/python3.8/site-packages/sandman2/app.py", line 60, in get_app _reflect_all(exclude_tables, admin, read_only, schema=schema) File "/usr/local/lib/python3.8/site-packages/sandman2/app.py", line 139, in _reflect_all register_model(cls, admin) File "/usr/local/lib/python3.8/site-packages/sandman2/app.py", line 156, in register_model cols = list(cls().table.primary_key.columns) File "", line 2, in init File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/instrumentation.py", line 373, in _new_state_if_none state = self._state_constructor(instance, self) File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 855, in get obj.dict[self.name] = result = self.fget(obj) File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/instrumentation.py", line 199, in state_constructor self.dispatch.first_init(self, self.class) File "/usr/local/lib/python3.8/site-packages/sqlalchemy/event/attr.py", line 297, in call fn(*args, **kw) File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/mapper.py", line 3341, in _event_on_first_init configure_mappers() File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/mapper.py", line 3229, in configure_mappers mapper._post_configure_properties() File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/mapper.py", line 1947, in _post_configure_properties prop.init() File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/interfaces.py", line 196, in init self.do_init() File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/relationships.py", line 1864, in do_init self._generate_backref() File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/relationships.py", line 2069, in _generate_backref raise sa_exc.ArgumentError( sqlalchemy.exc.ArgumentError: Error creating backref 'guacamole_user_group_collection' on relationship 'guacamole_user_group.guacamole_entity_collection': property of that name exists on mapper 'mapped class guacamole_entity->guacamole_entity'

The dockerfile I use to containerize the app is this: FROM python:3-alpine

RUN pip install sandman2 mysql-connector-python

CMD ["sandman2ctl", "mysql+mysqlconnector://guacamole:[email protected]/guacamole"]

EXPOSE 5000

The db schema for reference can be generated with the below command: docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgres > initdb.sql

joshiparth1000 avatar Sep 07 '20 23:09 joshiparth1000

Looks like a Duplicate of #71

mperreir avatar Mar 26 '21 18:03 mperreir