0

When trying to connect to a postgres table with a tsvector column, I get the following error message:

KeyError                                  Traceback (most recent call last)
File ~/anaconda3/envs/ec_extract/lib/python3.9/site-packages/multipledispatch/dispatcher.py:269, in Dispatcher.__call__(self, *args, **kwargs)
    268 try:
--> 269     func = self._cache[types]
    270 except KeyError:

KeyError: (<class 'sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2'>, <class 'sqlalchemy.dialects.postgresql.base.TSVECTOR'>)

During handling of the above exception, another exception occurred:

NotImplementedError                       Traceback (most recent call last)
*** 
----> 29 main_table = con.table(table_name)[columns['column_list']]

File ~/anaconda3/envs/ec_extract/lib/python3.9/site-packages/ibis/backends/base/sql/alchemy/__init__.py:438, in BaseAlchemyBackend.table(self, name, database, schema)
    428     return self.database(database=database).table(
    429         name=name,
    430         database=database,
    431         schema=schema,
    432     )
    433 sqla_table = self._get_sqla_table(
    434     name,
...
    275             (self.name, str_signature(types)))
    276     self._cache[types] = func
    277 try:

NotImplementedError: Could not find signature for dtype: <PGDialect_psycopg2, TSVECTOR>

I can connect to other tables and it works as expected.

I'm running ibis version 3.2.0 and sqlalchemy version 1.4.44.

I've tried to go through the source code to understand why it doesn't work, but I can't figure anything out.

According to the sqlalchemy docs tsvectors should have been supported since version 0.9.0

Thanks!

1 Answers1

1

I've opened an issue to add tsvector to our table dtype parsing here: https://github.com/ibis-project/ibis/issues/5402

Ibis has its own type system and there's currently (as of 4.1.0) no support for tsvector dtypes. We should at least let you connect to the table -- tsvector-specific operations may take more time to implement.

Gil Forsyth
  • 398
  • 1
  • 7
  • As of Ibis 5.x, we parse `tsvector` types, although there is no explicit `tsvector` functionality available, but at least you can load the table. – Gil Forsyth Mar 23 '23 at 16:37