Mercurial > kallithea
annotate rhodecode/model/meta.py @ 1514:87ec80c280bb beta
fixed issues with python2.5
added compat module to rhodecode to have one point of fetching backward incompatible libs.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 07 Oct 2011 02:51:18 +0200 |
parents | 2029c17cc6c6 |
children | f522f4d3bf93 |
rev | line source |
---|---|
0 | 1 """SQLAlchemy Metadata and Session object""" |
2 from sqlalchemy.ext.declarative import declarative_base | |
1388
2029c17cc6c6
Added basic JsonSerialization into models.
Marcin Kuzminski <marcin@python-works.com>
parents:
1271
diff
changeset
|
3 from sqlalchemy.orm import scoped_session, sessionmaker |
1065
5d676b6ab71c
Moved BaseModel into base class for declarative base. Added some handy methods into
Marcin Kuzminski <marcin@python-works.com>
parents:
612
diff
changeset
|
4 from beaker import cache |
5d676b6ab71c
Moved BaseModel into base class for declarative base. Added some handy methods into
Marcin Kuzminski <marcin@python-works.com>
parents:
612
diff
changeset
|
5 |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
482
diff
changeset
|
6 from rhodecode.model import caching_query |
1065
5d676b6ab71c
Moved BaseModel into base class for declarative base. Added some handy methods into
Marcin Kuzminski <marcin@python-works.com>
parents:
612
diff
changeset
|
7 |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
8 |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
9 # Beaker CacheManager. A home base for cache configurations. |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
10 cache_manager = cache.CacheManager() |
0 | 11 |
12 __all__ = ['Base', 'Session'] | |
13 # | |
14 # SQLAlchemy session manager. Updated by model.init_model() | |
15 # | |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
16 Session = scoped_session( |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
17 sessionmaker( |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
18 query_cls=caching_query.query_callable(cache_manager) |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
19 ) |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
20 ) |
0 | 21 |
22 # The declarative Base | |
1388
2029c17cc6c6
Added basic JsonSerialization into models.
Marcin Kuzminski <marcin@python-works.com>
parents:
1271
diff
changeset
|
23 Base = declarative_base() |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
24 |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
25 #to use cache use this in query |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
26 #.options(FromCache("sqlalchemy_cache_type", "cachekey")) |