aws / aws/amazon-redshift-python-driver
IAMR not supported
- 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
Mô tả
I can't connect to an IAMR redshift user with this lib
```sql
CREATE USER "IAMR:test_to_delete_redshift_ci" PASSWORD DISABLE;
```
but It work when I manually use boto3+psycopg2
```python
import os
import boto3
import psycopg2
import redshift_connector
os.environ["AWS_PROFILE"] = "redshift_test_role_2"
def with_lib():
conn = redshift_connector.connect(
iam=True,
cluster_identifier="YYYYYY",
database="AAAAA",
db_user="test_to_delete_redshift_ci",
password="",
region="eu-west-1",
)
cursor = conn.cursor()
cursor.execute("SELECT 10,20")
print(cursor.fetchall())
def manually():
RS_PORT = 5439
DATABASE = 'AAAAAA'
CLUSTER_ID = 'YYYYYYY'
RS_HOST = 'XXXXXXXXXXX'
client = boto3.client('redshift')
cluster_creds = client.get_cluster_credentials_with_iam(ClusterIdentifier=CLUSTER_ID)
print(cluster_creds)
conn = psycopg2.connect(
host=RS_HOST,
port=RS_PORT,
user=cluster_creds['DbUser'],
password=cluster_creds['DbPassword'],
database=DATABASE
)
cur = conn.cursor()
cur.execute("SELECT 10,20")
print(cur.fetchall())
if __name__ == '__main__':
with_lib()
manually()
```
with_lib fail with
```log
redshift_connector.error.ProgrammingError: {'S': 'FATAL', 'C': '42704', 'M': 'user "IAM:test_to_delete_redshift_ci" does not exist', 'F': '/opt/brazil-pkg-cache/packages/RedshiftPADB/RedshiftPADB-1.0.7910.0/AL2_x86_64/generic-flavor/src/src/pg/src/backend/utils/init/miscinit.c', 'L': '976', 'R': 'InitializeSessionUserId'}
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách chạy with_lib() và manually() từ ví dụ trong issue, rồi so sánh hành vi của người dùng và kết nối được tạo. Truy vết điểm vào xác thực IAM của connector, sau đó xác minh rằng người dùng IAMR kết nối thành công và SELECT 10,20 trả về các hàng mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, python
- Lĩnh vực
- authentication, databases
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100