Skip to content

Instantly share code, notes, and snippets.

@mengu
Created June 26, 2010 12:52
Show Gist options
  • Save mengu/454031 to your computer and use it in GitHub Desktop.
Save mengu/454031 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
An example to show how to use turbogears sqlalchemy session and model
outside of turbogears.
"""
from fileupload.model import DBSession, metadata, init_model
from fileupload.model.userfile import UserFile
from sqlalchemy import create_engine, sql
engine = create_engine("sqlite:////home/mengu/projects/turbogears/fileupload/devdata.db")
init_model(engine)
result = DBSession.query(UserFile).all()
print result
@mengu
Copy link
Author

mengu commented Jun 26, 2010

that "sql" import is not needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment