Mercurial > kallithea
annotate rhodecode/model/meta.py @ 2445:9b623dcddb02 beta
Format datetime in notifications according to unified function
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 11 Jun 2012 23:23:32 +0200 |
parents | 6c86c987cf93 |
children | ffd45b185016 |
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 |
1669
f522f4d3bf93
moved caching query to libs
Marcin Kuzminski <marcin@python-works.com>
parents:
1388
diff
changeset
|
6 from rhodecode.lib 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( |
1800 | 18 query_cls=caching_query.query_callable(cache_manager), |
19 expire_on_commit=True, | |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
20 ) |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
21 ) |
0 | 22 |
23 # The declarative Base | |
1388
2029c17cc6c6
Added basic JsonSerialization into models.
Marcin Kuzminski <marcin@python-works.com>
parents:
1271
diff
changeset
|
24 Base = declarative_base() |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
25 |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
26 #to use cache use this in query |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
27 #.options(FromCache("sqlalchemy_cache_type", "cachekey")) |