7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
|
12 """ |
|
13 |
|
14 PyAMS SQLAlchemy integration |
|
15 ============================ |
|
16 |
|
17 *pyams_alchemy* package is a small package which can be used to make SQLAlchemy integration more simple. |
|
18 |
|
19 The main goal of *pyams_alchemy* package is to define the :class:`pyams_alchemy.engine.AlchemyEngineUtility` class: |
|
20 this class can be stored persistently into PyAMS local site manager (see :ref:`site`) to store settings of an |
|
21 SQLAlchemy engine; on user request, the :func:`pyams_alchemy.engine.get_user_session` function can be used to get |
|
22 access to a new SQLAlchemy engine session matching these settings which will to be bound to current Pyramid's |
|
23 transaction. |
|
24 |
|
25 |
|
26 Dynamic schema names |
|
27 ++++++++++++++++++++ |
|
28 |
|
29 Some times you may have to be able to setup, for a given table, a schema name which is not static but can be dynamic |
|
30 through a configuration option. |
|
31 |
|
32 This can be done easily with the help of the :class:`pyams_alchemy.mixin.DynamicSchemaMixin` which you can inherit from |
|
33 in any SQLAlchemy table subclass. |
|
34 |
|
35 When this is done, the schema name can be defined into Pyramid's configuration file into a setting which is called |
|
36 *pyams_alchemy:{module_name}.{class_name}.schema*; for example like in |
|
37 *pyams_alchemy:pyams_content.package.TableName.schema*. If not specified, the table's schema name can be defined in a |
|
38 classic *__schema__* table's attribute. |
|
39 |
|
40 """ |
12 |
41 |
13 __docformat__ = 'restructuredtext' |
42 __docformat__ = 'restructuredtext' |
14 |
43 |
15 |
44 |
16 from pyramid.i18n import TranslationStringFactory |
45 from pyramid.i18n import TranslationStringFactory |