Created
October 1, 2019 16:59
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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