Skip to content

Possible relstorage incompatibility #31

Open
@seatedscribe

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions