question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create SQL Alchemy connection string using Okta IdP

See original GitHub issue

Driver version

redshift_connector 2.0.889

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.31651

Client Operating System

mac OS Monterery

Python version

3.9.7

Problem description

import redshift_connector

# An Okta auth page will pop up when initiating this connector
conn = redshift_connector.connect(
    host='<cluster_identifier>.ap-southeast-2.redshift.amazonaws.com',
    port=5439,
    region='ap-southeast-2',
    database='<db_name>',
    credentials_provider='BrowserSamlCredentialsProvider',
    login_url='<saml_url>',
    cluster_identifier='<cluster_identifer',
    preferred_role='arn:aws:iam::<iam-id>:role/<role-name>',
    user='',        # left empty string
    password='',    # left empty string
    iam=True,
    ssl=True
 )

cursor: redshift_connector.Cursor = conn.cursor()

Currently, I can connect to Redshift using the above credentials but when trying to utilise the SQL Alchemy connection string - it causes an identification error (using sqlalchemy-redshift). Is there a way to generate an appropriate URL for sqlalchemy to parse for IdP authentication?

I’ve noticed that Redshift was recently updated to work with sqlalchemy-redshift but have had no luck generating an appropriate URL login.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Brooke-whitecommented, Dec 16, 2021

yay! I’m happy to hear this, @nam-tonthat-afterpay. Best wishes on your project 😃

1reaction
namtonthatcommented, Dec 16, 2021

Hi @Brooke-white, did a fresh install this morning and tried. Looks like everything is working perfectly. Closing the thread. The debug logging helped me iron out any issues. Thank you again for your help and patience on this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to connect using SQLAlchemy with Okta IdP?
Hi @idoki​ I would add this to the git repository as an open issue. However, I have seen others use snowsql to make...
Read more >
Support Identity Provider (IdP) Authentication #115 - GitHub
My organization doesn't allow user passwords on snowflake accounts. The snowsql external browser authentication works fine but in the above ...
Read more >
How to connect python to Snowflake using SSO (sqlalchemy)?
I am trying to redesign the connection string but can't seem to get it right. This was my initial connection string before SSO:...
Read more >
How To Connect To A Snowflake Database With Python
However, “for convenience, you can use the snowflake. sqlalchemy. URL method to construct the connection string and connect to the database”:
Read more >
Use the Amazon Redshift SQLAlchemy dialect to interact with ...
In this step, we show you how to connect to your Amazon Redshift cluster using two different methods: Okta SSO federation, and direct...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found