zodb / relstorage

A backend for ZODB that stores pickles in a relational database.
Other
54 stars 46 forks source link

TypeError: Unable to bind to <newt.db._adapter.Mover object at 0x7ff70405dc40>; no dialect found #400

Closed Theelx closed 4 years ago

Theelx commented 4 years ago

So, I've been using newt.db to work with zodb and relstorage's postgresql stuff, and I can't get it to work, I keep getting the error in the title. I had to modify newt's code locally to make it somewhat compatible with relstorage 3.1.0, as it was only working with 2.1.0-2.1.1, so I fixed the problem it was having. However, now this popped up, and it seems to be a problem with RelStorage. There don't seem to be any results on google for what a postgresql dialect is, let alone something being unable to bind. The modified code for newt that I used is forked and listed in my repositories (https://github.com/Theelgirl/db), but it's only compatible with psycopg2 as the driver, so I haven't submitted a PR to the official newt github because people need the option to use multiple drivers, and this issue prevents it from being useful.

What I know:

System/Package Info:

Traceback:

  File "newt_testing.py", line 183, in connect
    db = newt.DB("host=localhost user=postgres password=[REDACTED]")
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/newt/db/_db.py", line 140, in DB
    return NewtDB(ZODB.DB(storage(dsn, **storage_options), **db_options))
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/ZODB/DB.py", line 470, in __init__
    conn.get(z64)
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/ZODB/Connection.py", line 247, in get
    p, _ = self._storage.load(oid)
  File "src/perfmetrics/metric.py", line 66, in perfmetrics._metric._AbstractMetricImpl.__call__
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/storage/load.py", line 110, in load
    state, tid_int = self.__load_using_method(load_cursor, self.cache.load, oid_int)
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/storage/load.py", line 85, in __load_using_method
    return meth(load_cursor, argument)
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/cache/storage_cache.py", line 425, in load
    return self.adapter.mover.load_current(cursor, oid_int)
  File "src/perfmetrics/metric.py", line 66, in perfmetrics._metric._AbstractMetricImpl.__call__
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/adapters/mover.py", line 78, in load_current
    stmt = self._load_current_query
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/adapters/sql/query.py", line 115, in __get__
    result = self.bind(inst).compiled()
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/adapters/sql/dialect.py", line 490, in bind
    dialect = self._find_dialect(context)
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/relstorage/adapters/sql/dialect.py", line 485, in _find_dialect
    raise TypeError("Unable to bind to %s; no dialect found" % (context,))
TypeError: Unable to bind to <newt.db._adapter.Mover object at 0x7f8fac09dc40>; no dialect found

The simplest function I could reproduce this with (newt.db is my fork of newt that should work with Relstorage 3.1.0 instead of 2.1.0):

import newt.db as newt

def connect():
    db = newt.DB("host=localhost user=postgres password=[REDACTED])

if __name__ == '__main__':
    connect()

Edit: PostGreSQL 10 and more under "What I Know"

jamadden commented 4 years ago

Thanks for the report. Newtdb is not a project supported by this repository. From what I understand, it’s not even supported by newtdb’s original author (it turned out to be far too slow at write time). I can’t help you other than to say use only and exactly the versions that newtdb was designed with.

Theelx commented 4 years ago

Just found the answer, leaving it here in case anyone else comes across this: For the driver, I was using the psycopg2 driver instead of the AbstractPostGreSQLDriver. A few other monkey patches and it worked. Also, thanks for the response jamadden, sorry I didn't close this earlier.

jimfulton commented 4 years ago

Hi Jason,

FTR, I'm not working on newtdb anymore because I'm not able to use it in my work anymore. Sadly, the same is true of ZODB. whimper.

I don't recall getting write performance complaints. Newtdb has 2 modes for updating the redundant JSON data, synchronous and asynchronous. I would expect the synchronous generation of the JSON data to cause slower writes than Relstorage. I'd expect the asynchronous mode to be just as fast (assuming a suitable process configuration).