The models Module

rhodecode.model.__init__

The application’s model objects

created_on:

Nov 25, 2010

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

example:
from paste.deploy import appconfig
from pylons import config
from sqlalchemy import engine_from_config
from rhodecode.config.environment import load_environment

conf = appconfig('config:development.ini', relative_to = './../../')
load_environment(conf.global_conf, conf.local_conf)

engine = engine_from_config(config, 'sqlalchemy.')
init_model(engine)
# RUN YOUR CODE HERE
class rhodecode.model.BaseModel(sa=None)[source]

Base Model for all RhodeCode models, it adds sql alchemy session into instance of model

Parameters:sa – If passed it reuses this session instead of creating a new one
get_all()[source]

Returns all instances of what is defined in cls class variable

rhodecode.model.init_model(engine)[source]

Initializes db session, bind the engine with the metadata, Call this before using any of the tables or classes in the model, preferably once in application start

Parameters:engine – engine to bind to

Support RhodeCode development.

Flattr this

Table Of Contents

Previous topic

API

This Page