Skip to content

Instantly share code, notes, and snippets.

@shouhei
Created July 7, 2015 10:50
Show Gist options
  • Select an option

  • Save shouhei/d2b298f34030d7dac11f to your computer and use it in GitHub Desktop.

Select an option

Save shouhei/d2b298f34030d7dac11f to your computer and use it in GitHub Desktop.
既存のDBからテーブル情報を持ってくる奴
from sqlalchemy import *
db = create_engine('sqlite:///test.db')
metadata = MetaData(bind=db, reflect=True)
for tables in metadata.tables:
for row in tables.select().execute():
print(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment