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
AttributeError: Collection has no attribute '_Collection__database'. To access the fs._Collection__database collection, use database['fs._Collection__database'].
#367
Server fails to start after pymongo 4.9.0 release
It looks like pymongo 4.9.0 was released a few days ago. We don't depend on it directly, but flask-pymongo imports it. Unfortunately some things have changed with GridFS that break with this version. We see this show up in the unit tests also due to incompatibility with the current version of mongomock, but the first breakage you see is when trying to start the server:
File "/srv/testflinger/testflinger.py", line 22, in <module>
app = create_flask_app()
File "/srv/testflinger/src/application.py", line 58, in create_flask_app
setup_mongodb(tf_app)
File "/srv/testflinger/src/database.py", line 73, in setup_mongodb
create_indexes()
File "/srv/testflinger/src/database.py", line 90, in create_indexes
mongo.db.fs.chunks.create_index(
File "/usr/local/lib/python3.10/dist-packages/flask_pymongo/wrappers.py", line 85, in __getattr__
attr = super(Collection, self).__getattr__(name)
File "/usr/local/lib/python3.10/dist-packages/pymongo/synchronous/collection.py", line 282, in __getattr__
return self.__getitem__(name)
File "/usr/local/lib/python3.10/dist-packages/flask_pymongo/wrappers.py", line 94, in __getitem__
db = self._Collection__database
File "/usr/local/lib/python3.10/dist-packages/flask_pymongo/wrappers.py", line 85, in __getattr__
attr = super(Collection, self).__getattr__(name)
File "/usr/local/lib/python3.10/dist-packages/pymongo/synchronous/collection.py", line 278, in __getattr__
raise AttributeError(
AttributeError: Collection has no attribute '_Collection__database'. To access the fs._Collection__database collection, use database['fs._Collection__database'].
[2024-09-18 23:15:29 +0000] [7] [INFO] Worker exiting (pid:
I've looked into this a bit, and it seems to be due to a change made to add Beta support for async in pymongo. I've not yet worked out if this is something that needs updates in flask-pymongo and mongomock or something that's just broken for now in pymongo, but until we sort it out, we should not allow it to update to the latest pymongo that includes this change.
Server fails to start after pymongo 4.9.0 release
It looks like pymongo 4.9.0 was released a few days ago. We don't depend on it directly, but flask-pymongo imports it. Unfortunately some things have changed with GridFS that break with this version. We see this show up in the unit tests also due to incompatibility with the current version of mongomock, but the first breakage you see is when trying to start the server:
I've looked into this a bit, and it seems to be due to a change made to add Beta support for async in pymongo. I've not yet worked out if this is something that needs updates in flask-pymongo and mongomock or something that's just broken for now in pymongo, but until we sort it out, we should not allow it to update to the latest pymongo that includes this change.
I've proposed #366 as a workaround for now
The text was updated successfully, but these errors were encountered: