src/source/pyams_alchemy.rst
changeset 46 5fe8d5ffccde
parent 28 a7332a53e6dc
parent 45 918d3c9b53ee
child 47 5ca671ff6836
child 53 05a4f2c07b84
equal deleted inserted replaced
28:a7332a53e6dc 46:5fe8d5ffccde
     1 .. _pyams_alchemy:
       
     2 
       
     3 PyAMS SQLAlchemy integration
       
     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 
       
    34 .. automodule:: pyams_alchemy
       
    35     :members:
       
    36     :undoc-members:
       
    37     :show-inheritance:
       
    38 
       
    39 
       
    40 Submodules
       
    41 ++++++++++
       
    42 
       
    43 pyams\_alchemy\.engine module
       
    44 -----------------------------
       
    45 
       
    46 .. automodule:: pyams_alchemy.engine
       
    47     :members:
       
    48     :undoc-members:
       
    49     :show-inheritance:
       
    50 
       
    51 pyams\_alchemy\.loader module
       
    52 -----------------------------
       
    53 
       
    54 .. automodule:: pyams_alchemy.loader
       
    55     :members:
       
    56     :undoc-members:
       
    57     :show-inheritance:
       
    58 
       
    59 pyams\_alchemy\.metaconfigure module
       
    60 ------------------------------------
       
    61 
       
    62 .. automodule:: pyams_alchemy.metaconfigure
       
    63     :members:
       
    64     :undoc-members:
       
    65     :show-inheritance:
       
    66 
       
    67 pyams\_alchemy\.metadirectives module
       
    68 -------------------------------------
       
    69 
       
    70 .. automodule:: pyams_alchemy.metadirectives
       
    71     :members:
       
    72     :undoc-members:
       
    73     :show-inheritance:
       
    74 
       
    75 pyams\_alchemy\.mixin module
       
    76 ----------------------------
       
    77 
       
    78 .. automodule:: pyams_alchemy.mixin
       
    79     :members:
       
    80     :undoc-members:
       
    81     :show-inheritance:
       
    82 
       
    83 
       
    84 Subpackages
       
    85 +++++++++++
       
    86 
       
    87 .. toctree::
       
    88 
       
    89     pyams_alchemy.interfaces
       
    90     pyams_alchemy.tests
       
    91     pyams_alchemy.zmi