LDAP Sync "oncall-user-sync" AttributeError: 'Engine' object has no attribute 'execute'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Description
With a freshly built docker container (built 2023-03-27) when trying to run on-call-user-sync to sync LDAP users the following error is encountered
AttributeError: 'Engine' object has no attribute 'execute'
Full error:
# env/bin/oncall-user-sync /home/oncall/config/config.yaml
2023-03-27 21:55:18,341 INFO oncall.metrics Loaded metrics handler dummy
2023-03-27 21:55:18,341 INFO oncall.metrics Loaded metrics handler dummy
2023-03-27 21:55:18,342 INFO root Starting user sync loop at 1679954118.3424478
2023-03-27 21:55:18,342 INFO root Starting user sync loop at 1679954118.3424478
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
File "/home/oncall/env/lib/python3.8/site-packages/oncall/user_sync/ldap_sync.py", line 446, in main
sync(config, engine)
File "/home/oncall/env/lib/python3.8/site-packages/oncall/user_sync/ldap_sync.py", line 299, in sync
for row in engine.execute(users_query):
AttributeError: 'Engine' object has no attribute 'execute'
2023-03-27T21:55:18Z <Greenlet at 0x7f40f8e47360: main({'server': {'host': 'localhost', 'port': 8080}, 'd)> failed with AttributeError
From research it turns out that this is due to a breaking change in SQLAlchemy v2.
I have managed to resolve this by pinning SQLAlchemy to less than 2.0.0 in setup.py
sqlalchemy<2.0.0
Thought it was worth brining to your attention so you can pin it in the repo, or updating the sync script to work with the newer version of SQLAlchemy
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with setup.py and src/oncall/user_sync/ldap_sync.py, following the reported engine.execute call in the LDAP sync path. Confirm the supported SQLAlchemy version or compatibility approach, then verify that on-call-user-sync completes without the reported AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlalchemy
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100