Skip to content

Instantly share code, notes, and snippets.

@rupesh2017
Created August 3, 2018 14:14
Show Gist options
  • Save rupesh2017/9699de402586ad092669ef638fb9dc30 to your computer and use it in GitHub Desktop.
Save rupesh2017/9699de402586ad092669ef638fb9dc30 to your computer and use it in GitHub Desktop.
to view database
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
engine = create_engine(os.getenv("DATABASE_URL"))
db = scoped_session(sessionmaker(bind=engine))
def main():
flights = db.execute("SELECT userid FROM A").fetchall()
for flight in flights:
print(f"{flight.userid}")
#print(flight)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment