Last active
          June 28, 2017 22:20 
        
      - 
      
 - 
        
Save DustinAlandzes/f7461d4b779db8a7ef85c8cee72a2ea1 to your computer and use it in GitHub Desktop.  
  
    
      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
    
  
  
    
  | 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) | 
  
    
      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
    
  
  
    
  | 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