Skip to content

Instantly share code, notes, and snippets.

@msure
Created June 22, 2015 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msure/ca961bf8357f6844b436 to your computer and use it in GitHub Desktop.
Save msure/ca961bf8357f6844b436 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
# what is the database equivalent of 'hello world' anyways?
test_query = """
SELECT COUNT(*)
FROM core.users a
WHERE a.date BETWEEN '2015-01-01' AND '2015-05-31'
GROUP BY 1
"""
red_engine = create_engine('redshift+psycopg2://username:password@your.redshift.host.123456abcdef.us-east-1.redshift.amazonaws.com:5439/database')
test = pd.read_sql_query(test_query,red_engine)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment