Skip to content

Instantly share code, notes, and snippets.

@ammarmallik
Last active July 18, 2018 21:39
Show Gist options
  • Save ammarmallik/01c26655330ae13c001daee06ed8b299 to your computer and use it in GitHub Desktop.
Save ammarmallik/01c26655330ae13c001daee06ed8b299 to your computer and use it in GitHub Desktop.
For Redshift connection
from sqlalchemy import create_engine, text
connection_string = "postgresql+psycopg2://%s:%s@%s:%s/%s" % ('admin','qh75dPL9GTCJ5ToEh79G','lifeprintstage.cbld5jqqok7d.us-east-1.redshift.amazonaws.com',str(5439),'lifeprintstage')
engine = create_engine(connection_string)
conn = engine.connect()
query = "SELECT * FROM `table`"
result = conn.execute(text(query))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment