billdestein commented on issue #32315:
URL: https://github.com/apache/superset/issues/32315#issuecomment-2671090272

   Thank you for your suggestion, Hainenber.  That fixed my issue.  My final 
code looks like this:
   
       def create_redshift_database_connection(self):
           credentials = self.payload['credentials']
           account_id = credentials['accountId']
           aws_access_key_id = credentials['accessKeyId']
           aws_secret_access_key = credentials['secretAccessKey']
           port = self.payload['port']
           work_group = 'product'
   
           headers = {
               'Accept': 'application/json',
               'Cookie': 'none',
               'Content-Type': 'application/json',
               'X-CSRFToken': 'none'
           }
   
           extra = {
               "engine_params": {
                   "connect_args": {
                           "iam": True,
                           "is_serverless": True,
                           "serverless_acct_id": account_id,
                           "serverless_work_group": work_group,
                           "database": "dev"
                   }
               }
           }
   
           data = {
               "sqlalchemy_uri": 
f'redshift+redshift_connector://{aws_access_key_id}:{aws_secret_access_key}@{work_group}.{account_id}.us-west-2.redshift-serverless.amazonaws.com:5439/dev',
               "database_name":"Amazon Redshift",
               "extra": json.dumps(extra),
               "masked_encrypted_extra":""
           }
   
           url = f'http://127.0.0.1:{port}/api/v1/database/'
   
           requests.post(url, json = data, headers = headers)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to