Hi,
I need to call prodigy from python boiled down to something like this:
@prodigy.recipe("custom_recipe")
def choice():
return {
"view_id": "choice",
"dataset": "some_dataset",
"stream": some_stream(),
}
prodigy.serve("custom_recipe", **prodigy_config)
where prodigy_config
looks like this:
prodigy_config = {
"choice_style": "multiple",
"db": 'postgresql',
"db_settings": {
"postgresql": {
"host": "127.0.0.1",
"dbname": "xxx",
"user": "xxx",
"password": "xxx",
"port": 5432,
}
}
}
Running the recipe works, but it saves the examples into a isqlite db (✔ Saved 1 annotations to database SQLite
), and not into the postgres db as defined by the config dict.
On the contrary if I pass it a db object from your connect function, then it works:
from prodigy.components.db import connect
db = connect(db_id='postgresql', db_settings=prodigy_config["db_settings"]["postgresql"])
@prodigy.recipe("cats_recipe")
def choice():
return {
"view_id": "choice",
"dataset": "some_dataset",
"stream": some_stream(),
"db": db,
}
prodigy.serve("cats_recipe", **prodigy_config)
Running this it saves the example data and displays: ✔ Saved 1 annotations to database PostgreSQL
Do I do something wrong here? I obviously sticked to the doc https://prodi.gy/docs/api-database but couldn't find a mistake
Cheers,
Stefan