annotate rhodecode/model/meta.py @ 1683:28eeddf81b25 beta

inline comments gui
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 14 Nov 2011 22:20:04 +0200
parents f522f4d3bf93
children cac5109ac3b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1 """SQLAlchemy Metadata and Session object"""
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
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
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
11
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
12 __all__ = ['Base', 'Session']
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
13 #
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
14 # SQLAlchemy session manager. Updated by model.init_model()
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
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
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
21
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
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"))