Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Last active June 28, 2017 22:20
Show Gist options
  • Save DustinAlandzes/f7461d4b779db8a7ef85c8cee72a2ea1 to your computer and use it in GitHub Desktop.
Save DustinAlandzes/f7461d4b779db8a7ef85c8cee72a2ea1 to your computer and use it in GitHub Desktop.
postgres_db = {'drivername': 'postgres',
'username': 'postgres',
'password': 'postgres',
'host': '192.168.99.100',
'port': 5432}
db_uri = URL(**postgres_db)
engine = create_engine(db_uri)
import sqlalchemy as sa
engine = sa.create_engine('postgresql://username:password@url:5439/database')
connection = engine.connect()
result = connection.execute("select * from table")
for row in result:
print(row)
connection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment