Created
October 26, 2011 06:39
-
-
Save jacobh/1315626 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
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import * | |
base= declarative_base() | |
class Item_information(base): | |
__tablename__= 'cpanel_item_information' | |
id= Column(Integer, primary_key= True) | |
name= Column(String(255)) | |
description= Column(Text) | |
slug= Column(String(255)) | |
weight= Column(Integer) | |
cost= Column(Integer) | |
category= Column(String(255)) | |
model= Column(String(255)) | |
class Item(base): | |
__tablename__= 'rp_items' | |
steamid= Column(Text, primary_key= True, autoincrement= False) | |
item_id= Column(Text, primary_key= True, autoincrement= False) | |
item_quantity= Column(Text) |
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
from sqlalchemy import * | |
from sqlalchemy.orm import sessionmaker | |
import db | |
def Start_session(): | |
engine = create_engine(db_url) | |
Session = sessionmaker(bind=engine) | |
return Session() | |
session = Start_session() | |
info= aliased(db.Item_information) | |
items= session.query(db.Item).join(info, db.Item.item_id==info.slug).all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment