[GH-ISSUE #175] Error creating backref #69

Open
opened 2026-02-26 01:33:02 +03:00 by kerem · 1 comment
Owner

Originally created by @joshiparth1000 on GitHub (Sep 7, 2020).
Original GitHub issue: https://github.com/jeffknupp/sandman2/issues/175

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:axway123@172.17.0.1/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

Originally created by @joshiparth1000 on GitHub (Sep 7, 2020). Original GitHub issue: https://github.com/jeffknupp/sandman2/issues/175 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 <module> 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 "<string>", 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:axway123@172.17.0.1/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
Author
Owner

@mperreir commented on GitHub (Mar 26, 2021):

Looks like a Duplicate of #71

<!-- gh-comment-id:808424184 --> @mperreir commented on GitHub (Mar 26, 2021): Looks like a Duplicate of #71
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/sandman2-jeffknupp#69
No description provided.