src/source/pyams_alchemy/pyams_alchemy.rst
branchdoc-dc
changeset 44 915602c1fb3a
parent 38 ea89b10031eb
child 51 5ebe61e3a965
equal deleted inserted replaced
43:04653ad24e74 44:915602c1fb3a
     1 .. _pyams_alchemy:
     1 .. _pyams_alchemy:
     2 
     2 
     3 PyAMS SQLAlchemy integration
     3 pyams_alchemy package
     4 ============================
     4 =====================
     5 
       
     6 *pyams_alchemy* package is a small package which can be used to make SQLAlchemy integration more simple.
       
     7 
       
     8 The main goal of *pyams_alchemy* package is to define the :class:`pyams_alchemy.engine.AlchemyEngineUtility` class:
       
     9 this class can be stored persistently into PyAMS local site manager (see :ref:`site`) to store settings of an
       
    10 SQLAlchemy engine; on user request, the :func:`pyams_alchemy.engine.get_user_session` function can be used to get
       
    11 access to a new SQLAlchemy engine session matching these settings which will to be bound to current Pyramid's
       
    12 transaction.
       
    13 
       
    14 
       
    15 Dynamic schema names
       
    16 ++++++++++++++++++++
       
    17 
       
    18 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
       
    19 through a configuration option.
       
    20 
       
    21 This can be done easily with the help of the :class:`pyams_alchemy.mixin.DynamicSchemaMixin` which you can inherit from
       
    22 in any SQLAlchemy table subclass.
       
    23 
       
    24 When this is done, the schema name can be defined into Pyramid's configuration file into a setting which is called
       
    25 *pyams_alchemy:{module_name}.{class_name}.schema*; for example like in
       
    26 *pyams_alchemy:pyams_content.package.TableName.schema*. If not specified, the table's schema name can be defined in a
       
    27 classic *__schema__* table's attribute.
       
    28 
       
    29 
       
    30 
       
    31 Module contents
       
    32 +++++++++++++++
       
    33 
     5 
    34 .. automodule:: pyams_alchemy
     6 .. automodule:: pyams_alchemy
    35     :members:
     7     :members:
    36     :undoc-members:
     8     :undoc-members:
    37     :show-inheritance:
     9     :show-inheritance:
    38 
       
    39 
    10 
    40 Submodules
    11 Submodules
    41 ++++++++++
    12 ++++++++++
    42 
    13 
    43 pyams\_alchemy\.engine module
    14 pyams\_alchemy\.engine module
    85 +++++++++++
    56 +++++++++++
    86 
    57 
    87 .. toctree::
    58 .. toctree::
    88 
    59 
    89     pyams_alchemy.interfaces
    60     pyams_alchemy.interfaces
    90     pyams_alchemy.tests
       
    91     pyams_alchemy.zmi
    61     pyams_alchemy.zmi
       
    62