Skip to content

Instantly share code, notes, and snippets.

@drbh
Created October 1, 2019 16:59
Show Gist options
  • Save drbh/8590098b15c5a826c29a978fc6f60b2d to your computer and use it in GitHub Desktop.
Save drbh/8590098b15c5a826c29a978fc6f60b2d to your computer and use it in GitHub Desktop.
A simple example of querying Postgres from Python assuming the DB is hosted on a AWS workspace and is password protected.
from sqlalchemy import create_engine
import pandas as pd
engine = create_engine(
'postgresql://postgres:YOURPASSWORDHERE@*.*.*.*.us-west-2.compute.amazonaws.com:5432/postgres')
frame = pd.read_sql('SELECT * FROM my_table LIMIT 10', engine)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment