Datashare writes are not authorized by producer or associated by consumer
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu với truy vấn tái hiện và các điểm vào đã được truy vết trong redshift_connector/cursor.py và core.py, đặc biệt là Connection.execute và handle_messages. So sánh đường dẫn thực thi của connector với hành vi được báo cáo của psql và psycopg; được xem là hoàn tất khi một SELECT trên Datashare thành công mà không gặp lỗi ủy quyền ghi và hành vi này được bao phủ bởi một regression test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Driver version
2.1.1
Redshift version
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.79372
Client Operating System
Ubuntu 24.04 LTS
Python version
3.8
Table schema
tpcds100
Problem description
I am not able to successfully query a Datashare (this Datashare, to be precise) using the package. Although the error message implies that I am attempting to execute a write operation, I've attempted to only execute a simple SELECT query.
I can also confirm that querying this Datashare via the psql client works without a problem.
-
Expected behaviour:
Queries against Datashares should be executed successfullly. -
Actual behaviour:
Queries against Datashares fail with the above error. -
Error message/stack trace:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/anaconda3/envs/mindsdb_handlers/lib/python3.8/site-packages/redshift_connector/core.py:1821, in Connection.execute(self, cursor, operation, vals)
1820 try:
-> 1821 ps = cache["ps"][key]
1822 _logger.debug("Using cached prepared statement")
KeyError: ('SELECT * FROM store_sales s LIMIT 10;', ())
During handling of the above exception, another exception occurred:
ProgrammingError Traceback (most recent call last)
Cell In[58], line 3
1 cursor: redshift_connector.Cursor = connection.cursor()
----> 3 cursor.execute(query)
4 result: tuple = cursor.fetchall()
File ~/anaconda3/envs/mindsdb_handlers/lib/python3.8/site-packages/redshift_connector/cursor.py:248, in Cursor.execute(self, operation, args, stream, merge_socket_read)
246 except:
247 pass
--> 248 raise e
249 return self
File ~/anaconda3/envs/mindsdb_handlers/lib/python3.8/site-packages/redshift_connector/cursor.py:241, in Cursor.execute(self, operation, args, stream, merge_socket_read)
239 self._c.execute(self, "begin transaction", None)
240 self._c.merge_socket_read = merge_socket_read
--> 241 self._c.execute(self, operation, args)
242 except Exception as e:
243 try:
File ~/anaconda3/envs/mindsdb_handlers/lib/python3.8/site-packages/redshift_connector/core.py:1902, in Connection.execute(self, cursor, operation, vals)
1899 else:
1900 raise e
-> 1902 self.handle_messages(cursor)
1904 # We've got row_desc that allows us to identify what we're
1905 # going to get back from this statement.
1906 output_fc = tuple(self.redshift_types[f["type_oid"]][0] for f in ps["row_desc"])
File ~/anaconda3/envs/mindsdb_handlers/lib/python3.8/site-packages/redshift_connector/core.py:2194, in Connection.handle_messages(self, cursor)
2191 self.message_types[code](self._read(data_len - 4), cursor)
2193 if self.error is not None:
-> 2194 raise self.error
ProgrammingError: {'S': 'ERROR', 'C': 'XX000', 'M': 'Datashare writes are not authorized by producer or associated by consumer.', 'D': '\n -----------------------------------------------\n error: Datashare writes are not authorized by producer or associated by consumer.\n code: 35002\n context: \n query: -1[child_sequence:1]\n location: redcat_rpc_client.cpp:2112\n process: padbmaster [pid=1073979618]\n -----------------------------------------------\n', 'F': '/home/ec2-user/padb/src/sys/xen_execute.cpp', 'L': '13364', 'R': 'pg_throw'}
- Any other details that can be helpful:
Like I've mentioned above, it seems that querying the Datashare via other means such as thepsqlclient works well, but I have also noticed that querying it with the Python driver for PostgreSQL (pyscopg) does not work either. Given below is the code that I tried to execute:
import os
import psycopg
os.environ["PGCLIENTENCODING"] = "utf-8"
connection = psycopg.connect(
...
)
with connection.cursor() as cur:
cur.execute("SELECT * FROM store s LIMIT 10;")
result = cur.fetchall()
And this is the error that is raised:
---------------------------------------------------------------------------
InternalError_ Traceback (most recent call last)
Cell In[55], line 2
1 with connection.cursor() as cur:
----> 2 cur.execute(query)
3 result = cur.fetchall()
File ~/anaconda3/envs/mindsdb_handlers/lib/python3.8/site-packages/psycopg/cursor.py:737, in Cursor.execute(self, query, params, prepare, binary)
733 self._conn.wait(
734 self._execute_gen(query, params, prepare=prepare, binary=binary)
735 )
736 except e._NO_TRACEBACK as ex:
--> 737 raise ex.with_traceback(None)
738 return self
InternalError_: Datashare writes are not authorized by producer or associated by consumer.
DETAIL:
-----------------------------------------------
error: Datashare writes are not authorized by producer or associated by consumer.
code: 35002
context:
query: -1[child_sequence:1]
location: redcat_rpc_client.cpp:2112
process: padbmaster [pid=1073996227]
-----------------------------------------------
Python Driver trace logs
I believe I have provided the necessary logs above?
Reproduction code
import redshift_connector
connection = redshift_connector.connect(
...
)
cursor = connection.cursor()
cursor.execute("SELECT * FROM store s LIMIT 10;")
result: tuple = cursor.fetchall()
- Ngôn ngữ chính
- Python
- Star
- 220
- Fork
- 86
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/amazon-redshift-python-driver
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
aws/amazon-redshift-python-driver#268 · 2 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
aws/amazon-redshift-python-driver#265 · 1 bình luận · 4 reaction ·
-
VARBYTE is decoded into utf-8 Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Tất cả issue của aws/amazon-redshift-python-driver
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ClickHouse/clickhouse-connect#1057 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
open-telemetry/sig-end-user#406 ·
-
bug ci good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100