Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError in PGSync: Incorrect List Indexing During Primary Key Update #571

Open
sagkhr23 opened this issue Aug 21, 2024 · 0 comments
Open

Comments

@sagkhr23
Copy link

PGSync Version:
3.2.0
PostgreSQL Version:
15.4
Elasticsearch/OpenSearch Version:
8.6.1
Redis Version:
7.0.0
Python Version:
3.9

Problem Description:
When changing the primary key for a document, a code block executes the following line:

python
doc["_routing"] = old_values[self.routing]

Here, old_values is a list, and self.routing is a string. If self.routing is not convertible to an integer, it raises a TypeError.

Error Message:
ERROR:pgsync.search_client: Exception list indices must be integers or slices, not str
Traceback (most recent call last):
File "/code/pgsync/search_client.py", line 141, in bulk
self._bulk(
File "/code/pgsync/search_client.py", line 210, in _bulk
for _ in self.parallel_bulk(
File "/usr/local/lib/python3.9/site-packages/elasticsearch/helpers/actions.py", line 472, in parallel_bulk
for result in pool.imap(
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 144, in _helper_reraises_exception
raise ex
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 388, in _guarded_task_generation
for i, x in enumerate(iterable):
File "/usr/local/lib/python3.9/site-packages/elasticsearch/helpers/actions.py", line 155, in _chunk_actions
for action, data in actions:
File "/code/pgsync/sync.py", line 977, in _payloads
filters = self._update_op(
File "/code/pgsync/sync.py", line 745, in _update_op
doc["_routing"] = old_values[self.routing]
TypeError: list indices must be integers or slices, not str

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant