Conversation
|
Hello, @Glandos, and thank you for your interest in pgcopy. Unfortunately I don’t know anything about this data type and I haven’t much time these days for this project.
Can you elaborate? What would this look like? |
I tried something in If you think my implementation fit in your code, I can go further to add mentions in documentation, and try to see if I can make some tests. |
|
Ah, I see. It’s slightly awkward, but I suppose it’s a reasonable approach. I am curious what kind of use-case there is for this, if creating the tsvector in the first place is more easily done on the db. Wouldn’t it be more straightforward to copy strings into an intermediate table and then run |
This is the first and basic step.
A tsvector can be defined in Python with a list of tuple (lexeme, positions). positions is a list of position, either int or str (e.g. '1A').
Full example:
[ ('aà', ['1A', '3A']), ('b', ['2A']), ]A lot of things are missing right now:
For encoding, lexemes should be encoded using client connection, but the automatic encoder isn't made for that. Maybe client_encoding could be passed as optional kwargs to every formatter?
For the last point, it's good to remember that tsvector are sorted, and I've no intention of supporting the creation of such a thing (see to_tsvector) which is very complicated to replicate in Python.