<s> from quick_orm . core import Database <EOL> from sqlalchemy import Column , String , Text <EOL> __metaclass__ = Database . DefaultMeta <EOL> class User : <EOL> name = Column ( String ( <NUM_LIT:30> ) ) <EOL> @ Database . many_to_one ( User , ref_name = '<STR_LIT>' , backref_name = '<STR_LIT>' ) <EOL> @ Database . many_to_one ( User , ref_name = '<STR_LIT>' , backref_name = '<STR_LIT>' ) <EOL> class Article : <EOL> title = Column ( String ( <NUM_LIT> ) ) <EOL> content = Column ( Text ) <EOL> Database . register ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> db = Database ( '<STR_LIT>' ) <EOL> db . create_tables ( ) <EOL> author = User ( name = '<STR_LIT>' ) <EOL> editor = User ( name = '<STR_LIT>' ) <EOL> article = Article ( author = author , editor = editor , title = '<STR_LIT>' , <EOL> content = '<STR_LIT>' ) <EOL> db . session . add_then_commit ( article ) <EOL> article = db . session . query ( Article ) . get ( <NUM_LIT:1> ) <EOL> print '<STR_LIT>' , article . title <EOL> print '<STR_LIT>' , article . author . name <EOL> print '<STR_LIT>' , article . editor . name </s>
