db icon indicating copy to clipboard operation
db copied to clipboard

Possible relstorage incompatibility

Open seatedscribe opened this issue 2 years ago • 4 comments

Hello. I am trying to get confident with newtdb and followed the "getting started" tutorial on the website I installed postgresql locally (on a raspberry) and pip installed newt.db inside a virtual environment (python 3.7.3)

This is what happened:

(venv) pi@raspberry:/tmp $ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import newt.db
>>> connection = newt.db.connection('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/xpend/venv/lib/python3.7/site-packages/newt/db/_db.py", line 153, in connection
    ZODB.connection(storage(dsn, **storage_options), **db_options)
  File "/opt/xpend/venv/lib/python3.7/site-packages/newt/db/_db.py", line 124, in storage
    return relstorage.storage.RelStorage(Adapter(dsn, options), options=options)
  File "/opt/xpend/venv/lib/python3.7/site-packages/newt/db/_adapter.py", line 13, in __init__
    driver = relstorage.adapters.postgresql.select_driver(self.options)
AttributeError: module 'relstorage.adapters.postgresql' has no attribute 'select_driver'

I modified line 13 of newt/db/_adapter.py to become driver = relstorage.adapters.postgresql.drivers.select_driver(self.options) but then another exception occurred:

>>> connection = newt.db.connection('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/xpend/venv/lib/python3.7/site-packages/newt/db/_db.py", line 153, in connection
    ZODB.connection(storage(dsn, **storage_options), **db_options)
  File "/opt/xpend/venv/lib/python3.7/site-packages/newt/db/_db.py", line 124, in storage
    return relstorage.storage.RelStorage(Adapter(dsn, options), options=options)
  File "/opt/xpend/venv/lib/python3.7/site-packages/newt/db/_adapter.py", line 13, in __init__
    driver = relstorage.adapters.postgresql.drivers.select_driver(self.options)
  File "/opt/xpend/venv/lib/python3.7/site-packages/relstorage/adapters/drivers.py", line 386, in <lambda>
    sys.modules[name])
  File "/opt/xpend/venv/lib/python3.7/site-packages/relstorage/adapters/drivers.py", line 50, in _select_driver_by_name
    driver_name = casefold(driver_name)
TypeError: descriptor 'casefold' requires a 'str' object but received a 'Options'
(venv) pi@raspberry:/tmp $ pip freeze
BTrees==4.9.2
cffi==1.15.0
newt.db==0.9.0
perfmetrics==3.2.0.post0
persistent==4.7.0
pkg-resources==0.0.0
psycopg2==2.9.2
pycparser==2.21
RelStorage==3.4.5
six==1.16.0
transaction==3.0.1
zc.lockfile==2.0
ZConfig==3.6.0
ZODB==5.6.0
zodbpickle==2.2.0
zope.dottedname==4.3
zope.interface==5.4.0

Should I downgrade some package? To which version?

Thanks in advance Enrico

seatedscribe avatar Nov 20 '21 11:11 seatedscribe

Hope someone could shed a light on this as I think this is exactly the right tool for a lot of solutions to problems out there... Anyway:

after a little searching, I found this same issue on the referenced mailing list: https://groups.google.com/g/newtdb/c/kxWreXzTGew

Please try installing RelStorage < 3. I'm afraid that RelStorage 3 involved large internal refactorings that were incompatible with netwdb.

This is not enough though, as an ImportError arises when doing import:

>>>import newt.db
ImportError: cannot import name '_cache_ring' from 'relstorage.cache' (/opt/xpend/venv/lib/python3.7/site-packages/relstorage/cache/__init__.py)

Hope someone could give here the "magic version numbers" for a working newtdb deploy ;)

seatedscribe avatar Nov 21 '21 16:11 seatedscribe

On Sun, Nov 21, 2021 at 9:29 AM Tarquin Winot @.***> wrote:

Hope someone could shed a light on this as I think this is exactly the right tool for a lot of solutions to problems out there...

I agree, but I'm not working on anything anymore that can benefit and can't spend time maintaining it.

Maybe someone else will step forward.

Jim

-- Jim Fulton http://jimfulton.info

jimfulton avatar Nov 21 '21 17:11 jimfulton

I agree, but I'm not working on anything anymore that can benefit and can't spend time maintaining it. Maybe someone else will step forward. Jim

This is perfectly understandable, time is precious! :smiley:

I also think it would be easier for someone to step forward if he could start studying the details and make experiments from a working codebase.

If you, or someone else, could spend a little time finding out the correct version of RelStorage (and/or other packages) for this project to stay alive, I would be immensely grateful.

Regards, Enrico

seatedscribe avatar Nov 24 '21 12:11 seatedscribe

OK, I beat my head on this a bit today. The following combination works (pasts tests and import doesn't error) for me:

  • Python 3.7
  • RelStorage 2.1.1 (and presumably any version 2)
  • ZODB 5.3.0

I'll make a 0.9.1 release soon that limits these versions.

jimfulton avatar Dec 05 '21 19:12 jimfulton