Created
October 28, 2016 10:18
-
-
Save jimbaker/ffa82e8c8c20e2371979f15a4e4a9f28 to your computer and use it in GitHub Desktop.
Script to setup Python console interaction with Craton's Python object modeling, using python/ipython. $ ipython -i interact-craton-modeling.py <<optional db connection string>>
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 sys | |
from sqlalchemy import create_engine # change to oslo_db | |
from sqlalchemy.orm import sessionmaker | |
from craton.db.sqlalchemy import models | |
engine = create_engine(sys.argv[1] if len(sys.argv) > 1 else 'mysql+pymysql://craton:craton@localhost/craton', echo=True) | |
Session = sessionmaker(bind=engine) | |
session = Session() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment