Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible relstorage incompatibility #31

Open
seatedscribe opened this issue Nov 20, 2021 · 4 comments
Open

Possible relstorage incompatibility #31

seatedscribe opened this issue Nov 20, 2021 · 4 comments

Comments

@seatedscribe
Copy link

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
Copy link
Author

seatedscribe commented Nov 21, 2021

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 ;)

@jimfulton
Copy link
Contributor

jimfulton commented Nov 21, 2021 via email

@seatedscribe
Copy link
Author

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! 😃

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

@jimfulton
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants