issue setting up a psql backend

Hello! I’m finally getting up and running with prodigy, but have run into an issue at the tail end of the installation procedure. Instead of the default “sqlite” database, I prefer to use “postgresql”, so I created a db and added this information to my global prodigy.json configuration like so:

    "db": "postgresql",
    "db_settings": {
        "postgresql": {
            "host": "localhost",
            "database": "prodigy",
            "port": 5432,
            "username": "burtondewilde"
        },
    },

When continuing on to “first steps” in the docs, I run into an issue:

(prodigy) ~$ prodigy dataset test_dataset "A dataset for testing" --author burton
Traceback (most recent call last):
  File "/Users/burtondewilde/.pyenv/versions/3.6.0/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/burtondewilde/.pyenv/versions/3.6.0/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Users/burtondewilde/.pyenv/versions/3.6.0/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/burtondewilde/.pyenv/versions/prodigy/lib/python3.6/site-packages/prodigy/__init__.py", line 4, in <module>
    from . import recipes, about  # noqa
  File "/Users/burtondewilde/.pyenv/versions/prodigy/lib/python3.6/site-packages/prodigy/recipes/__init__.py", line 4, in <module>
    from . import ner, textcat, compare, terms, generic # noqa
  File "/Users/burtondewilde/.pyenv/versions/prodigy/lib/python3.6/site-packages/prodigy/recipes/ner.py", line 33, in <module>
    DB = connect()
  File "cython_src/prodigy/components/db.pyx", line 25, in prodigy.components.db.connect
  File "cython_src/prodigy/components/db.pyx", line 83, in prodigy.components.db.Database.__init__
  File "cython_src/prodigy/components/db.pyx", line 66, in prodigy.components.db.connect_postgresql
TypeError: __init__() got multiple values for argument 'database'

I’m guessing that it doesn’t want me to specify my own database name? In that case, what does it expect the database name to be? I would check in the code, but I’m embarrassed to admit that I don’t know how to inspect much of it because it’s in the form of .so files.

Sorry for the noob question, and thanks in advance for your help.

Thanks for the report – just had a look and it seems like Prodigy is currently expecting a name as the database name, which is passed in as the dbname or database parameter. If none is found, it defaults to prodigy. So simply removing that line from your config should do as a quick workaround for now.

Just fixed this and the update will be included in the next release. Prodigy will now check for a name, dbname or database setting and use that instead.

Speaking of PostgreSQL: There seem to be another issue with the ORM at the moment that causes requests to fail, as PostgreSQL complains if a relation already exists – unlike SQLite (see my comment over here for more details). This will also be fixed asap!

Brilliant, thanks for the fix and fix-to-come! I’ll use SQLite for now so I can get on with annotating, but will keep an eye out for the next release and switch to my preferred backend.

1 Like

Fixed and will be included in the next release – see this comment for details! :tada:

1 Like