|
1 |
|
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
4 |
|
5 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
6 <head> |
|
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
8 <title>PyAMS SQLAlchemy integration — PyAMS User Guide 0.1.0 documentation</title> |
|
9 <link rel="stylesheet" href="_static/pyramid.css" type="text/css" /> |
|
10 <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> |
|
11 <script type="text/javascript"> |
|
12 var DOCUMENTATION_OPTIONS = { |
|
13 URL_ROOT: './', |
|
14 VERSION: '0.1.0', |
|
15 COLLAPSE_INDEX: false, |
|
16 FILE_SUFFIX: '.html', |
|
17 HAS_SOURCE: true, |
|
18 SOURCELINK_SUFFIX: '.txt' |
|
19 }; |
|
20 </script> |
|
21 <script type="text/javascript" src="_static/jquery.js"></script> |
|
22 <script type="text/javascript" src="_static/underscore.js"></script> |
|
23 <script type="text/javascript" src="_static/doctools.js"></script> |
|
24 <link rel="index" title="Index" href="genindex.html" /> |
|
25 <link rel="search" title="Search" href="search.html" /> |
|
26 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&subset=latin" type="text/css" media="screen" charset="utf-8" /> |
|
27 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&subset=latin" type="text/css" media="screen" charset="utf-8" /> |
|
28 <!--[if lte IE 6]> |
|
29 <link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" /> |
|
30 <![endif]--> |
|
31 |
|
32 </head> |
|
33 <body> |
|
34 |
|
35 <div class="related" role="navigation" aria-label="related navigation"> |
|
36 <h3>Navigation</h3> |
|
37 <ul> |
|
38 <li class="right" style="margin-right: 10px"> |
|
39 <a href="genindex.html" title="General Index" |
|
40 accesskey="I">index</a></li> |
|
41 <li class="right" > |
|
42 <a href="py-modindex.html" title="Python Module Index" |
|
43 >modules</a> |</li> |
|
44 <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> »</li> |
|
45 </ul> |
|
46 </div> |
|
47 |
|
48 <div class="document"> |
|
49 <div class="documentwrapper"> |
|
50 <div class="bodywrapper"> |
|
51 <div class="body" role="main"> |
|
52 |
|
53 <div class="section" id="pyams-sqlalchemy-integration"> |
|
54 <span id="pyams-alchemy"></span><h1>PyAMS SQLAlchemy integration<a class="headerlink" href="#pyams-sqlalchemy-integration" title="Permalink to this headline">¶</a></h1> |
|
55 <p><em>pyams_alchemy</em> package is a small package which can be used to make SQLAlchemy integration more simple.</p> |
|
56 <p>The main goal of <em>pyams_alchemy</em> package is to define the <a class="reference internal" href="#pyams_alchemy.engine.AlchemyEngineUtility" title="pyams_alchemy.engine.AlchemyEngineUtility"><code class="xref py py-class docutils literal"><span class="pre">pyams_alchemy.engine.AlchemyEngineUtility</span></code></a> class: |
|
57 this class can be stored persistently into PyAMS local site manager (see <a class="reference internal" href="site.html#site"><span class="std std-ref">PyAMS site management</span></a>) to store settings of an |
|
58 SQLAlchemy engine; on user request, the <a class="reference internal" href="#pyams_alchemy.engine.get_user_session" title="pyams_alchemy.engine.get_user_session"><code class="xref py py-func docutils literal"><span class="pre">pyams_alchemy.engine.get_user_session()</span></code></a> function can be used to get |
|
59 access to a new SQLAlchemy engine session matching these settings which will to be bound to current Pyramid’s |
|
60 transaction.</p> |
|
61 <div class="section" id="dynamic-schema-names"> |
|
62 <h2>Dynamic schema names<a class="headerlink" href="#dynamic-schema-names" title="Permalink to this headline">¶</a></h2> |
|
63 <p>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 |
|
64 through a configuration option.</p> |
|
65 <p>This can be done easily with the help of the <a class="reference internal" href="#pyams_alchemy.mixin.DynamicSchemaMixin" title="pyams_alchemy.mixin.DynamicSchemaMixin"><code class="xref py py-class docutils literal"><span class="pre">pyams_alchemy.mixin.DynamicSchemaMixin</span></code></a> which you can inherit from |
|
66 in any SQLAlchemy table subclass.</p> |
|
67 <p>When this is done, the schema name can be defined into Pyramid’s configuration file into a setting which is called |
|
68 <em>pyams_alchemy:{module_name}.{class_name}.schema</em>; for example like in |
|
69 <em>pyams_alchemy:pyams_content.package.TableName.schema</em>. If not specified, the table’s schema name can be defined in a |
|
70 classic <em>__schema__</em> table’s attribute.</p> |
|
71 </div> |
|
72 <div class="section" id="module-pyams_alchemy"> |
|
73 <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyams_alchemy" title="Permalink to this headline">¶</a></h2> |
|
74 <dl class="function"> |
|
75 <dt id="pyams_alchemy.includeme"> |
|
76 <code class="descclassname">pyams_alchemy.</code><code class="descname">includeme</code><span class="sig-paren">(</span><em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.includeme" title="Permalink to this definition">¶</a></dt> |
|
77 <dd><p>Pyramid include</p> |
|
78 </dd></dl> |
|
79 |
|
80 </div> |
|
81 <div class="section" id="submodules"> |
|
82 <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2> |
|
83 <div class="section" id="module-pyams_alchemy.engine"> |
|
84 <span id="pyams-alchemy-engine-module"></span><h3>pyams_alchemy.engine module<a class="headerlink" href="#module-pyams_alchemy.engine" title="Permalink to this headline">¶</a></h3> |
|
85 <dl class="class"> |
|
86 <dt id="pyams_alchemy.engine.AlchemyEngineUtility"> |
|
87 <em class="property">class </em><code class="descclassname">pyams_alchemy.engine.</code><code class="descname">AlchemyEngineUtility</code><span class="sig-paren">(</span><em>name=''</em>, <em>dsn=''</em>, <em>echo=False</em>, <em>use_pool=True</em>, <em>pool_size=25</em>, <em>pool_recycle=-1</em>, <em>echo_pool=False</em>, <em>encoding='utf-8'</em>, <em>convert_unicode=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility" title="Permalink to this definition">¶</a></dt> |
|
88 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p> |
|
89 <p>SQLAlchemy engine utility</p> |
|
90 <dl class="method"> |
|
91 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.clear_engine"> |
|
92 <code class="descname">clear_engine</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.clear_engine" title="Permalink to this definition">¶</a></dt> |
|
93 <dd></dd></dl> |
|
94 |
|
95 <dl class="attribute"> |
|
96 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.convert_unicode"> |
|
97 <code class="descname">convert_unicode</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.convert_unicode" title="Permalink to this definition">¶</a></dt> |
|
98 <dd><p>Convert Unicode</p> |
|
99 </dd></dl> |
|
100 |
|
101 <dl class="attribute"> |
|
102 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.dsn"> |
|
103 <code class="descname">dsn</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.dsn" title="Permalink to this definition">¶</a></dt> |
|
104 <dd><p>DSN: RFC-1738 compliant URL for the database connection</p> |
|
105 </dd></dl> |
|
106 |
|
107 <dl class="attribute"> |
|
108 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.echo"> |
|
109 <code class="descname">echo</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.echo" title="Permalink to this definition">¶</a></dt> |
|
110 <dd><p>Echo SQL?: Log all SQL statements to system logger</p> |
|
111 </dd></dl> |
|
112 |
|
113 <dl class="attribute"> |
|
114 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.echo_pool"> |
|
115 <code class="descname">echo_pool</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.echo_pool" title="Permalink to this definition">¶</a></dt> |
|
116 <dd><p>Echo pool?: Log all pool checkouts/checkins to system logger?</p> |
|
117 </dd></dl> |
|
118 |
|
119 <dl class="attribute"> |
|
120 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.encoding"> |
|
121 <code class="descname">encoding</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.encoding" title="Permalink to this definition">¶</a></dt> |
|
122 <dd><p>Encoding</p> |
|
123 </dd></dl> |
|
124 |
|
125 <dl class="method"> |
|
126 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.get_engine"> |
|
127 <code class="descname">get_engine</code><span class="sig-paren">(</span><em>use_pool=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.get_engine" title="Permalink to this definition">¶</a></dt> |
|
128 <dd></dd></dl> |
|
129 |
|
130 <dl class="attribute"> |
|
131 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.name"> |
|
132 <code class="descname">name</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.name" title="Permalink to this definition">¶</a></dt> |
|
133 <dd><p>Engine name: Keep empty if this engine is the default engine…</p> |
|
134 </dd></dl> |
|
135 |
|
136 <dl class="attribute"> |
|
137 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.pool_recycle"> |
|
138 <code class="descname">pool_recycle</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.pool_recycle" title="Permalink to this definition">¶</a></dt> |
|
139 <dd><p>Pool recycle time: SQLAlchemy connection recycle time (-1 for none)</p> |
|
140 </dd></dl> |
|
141 |
|
142 <dl class="attribute"> |
|
143 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.pool_size"> |
|
144 <code class="descname">pool_size</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.pool_size" title="Permalink to this definition">¶</a></dt> |
|
145 <dd><p>Pool size: SQLAlchemy connections pool size</p> |
|
146 </dd></dl> |
|
147 |
|
148 <dl class="attribute"> |
|
149 <dt id="pyams_alchemy.engine.AlchemyEngineUtility.use_pool"> |
|
150 <code class="descname">use_pool</code><a class="headerlink" href="#pyams_alchemy.engine.AlchemyEngineUtility.use_pool" title="Permalink to this definition">¶</a></dt> |
|
151 <dd><p>Use connections pool?: If ‘no’, collections pooling will be disabled</p> |
|
152 </dd></dl> |
|
153 |
|
154 </dd></dl> |
|
155 |
|
156 <dl class="class"> |
|
157 <dt id="pyams_alchemy.engine.ConnectionCleanerThread"> |
|
158 <em class="property">class </em><code class="descclassname">pyams_alchemy.engine.</code><code class="descname">ConnectionCleanerThread</code><span class="sig-paren">(</span><em>group=None</em>, <em>target=None</em>, <em>name=None</em>, <em>args=()</em>, <em>kwargs=None</em>, <em>*</em>, <em>daemon=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.ConnectionCleanerThread" title="Permalink to this definition">¶</a></dt> |
|
159 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">threading.Thread</span></code></p> |
|
160 <p>Background thread used to clean unused database connections</p> |
|
161 <p>Each connection is referenced in CONNECTION_TIMESTAMPS mapping on checkin and is invalidated |
|
162 if not being used after 5 minutes</p> |
|
163 <dl class="method"> |
|
164 <dt id="pyams_alchemy.engine.ConnectionCleanerThread.run"> |
|
165 <code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.ConnectionCleanerThread.run" title="Permalink to this definition">¶</a></dt> |
|
166 <dd></dd></dl> |
|
167 |
|
168 <dl class="attribute"> |
|
169 <dt id="pyams_alchemy.engine.ConnectionCleanerThread.timeout"> |
|
170 <code class="descname">timeout</code><em class="property"> = 300</em><a class="headerlink" href="#pyams_alchemy.engine.ConnectionCleanerThread.timeout" title="Permalink to this definition">¶</a></dt> |
|
171 <dd></dd></dl> |
|
172 |
|
173 </dd></dl> |
|
174 |
|
175 <dl class="class"> |
|
176 <dt id="pyams_alchemy.engine.EnginesVocabulary"> |
|
177 <em class="property">class </em><code class="descclassname">pyams_alchemy.engine.</code><code class="descname">EnginesVocabulary</code><span class="sig-paren">(</span><em>context</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.EnginesVocabulary" title="Permalink to this definition">¶</a></dt> |
|
178 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.componentvocabulary.vocabulary.UtilityVocabulary</span></code></p> |
|
179 <p>SQLAlchemy engines vocabulary</p> |
|
180 <dl class="attribute"> |
|
181 <dt id="pyams_alchemy.engine.EnginesVocabulary.interface"> |
|
182 <code class="descname">interface</code><em class="property"> = <InterfaceClass pyams_alchemy.interfaces.IAlchemyEngineUtility></em><a class="headerlink" href="#pyams_alchemy.engine.EnginesVocabulary.interface" title="Permalink to this definition">¶</a></dt> |
|
183 <dd></dd></dl> |
|
184 |
|
185 <dl class="attribute"> |
|
186 <dt id="pyams_alchemy.engine.EnginesVocabulary.nameOnly"> |
|
187 <code class="descname">nameOnly</code><em class="property"> = True</em><a class="headerlink" href="#pyams_alchemy.engine.EnginesVocabulary.nameOnly" title="Permalink to this definition">¶</a></dt> |
|
188 <dd></dd></dl> |
|
189 |
|
190 </dd></dl> |
|
191 |
|
192 <dl class="class"> |
|
193 <dt id="pyams_alchemy.engine.PersistentAlchemyEngineUtility"> |
|
194 <em class="property">class </em><code class="descclassname">pyams_alchemy.engine.</code><code class="descname">PersistentAlchemyEngineUtility</code><span class="sig-paren">(</span><em>name=''</em>, <em>dsn=''</em>, <em>echo=False</em>, <em>use_pool=True</em>, <em>pool_size=25</em>, <em>pool_recycle=-1</em>, <em>echo_pool=False</em>, <em>encoding='utf-8'</em>, <em>convert_unicode=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.PersistentAlchemyEngineUtility" title="Permalink to this definition">¶</a></dt> |
|
195 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">persistent.Persistent</span></code>, <a class="reference internal" href="#pyams_alchemy.engine.AlchemyEngineUtility" title="pyams_alchemy.engine.AlchemyEngineUtility"><code class="xref py py-class docutils literal"><span class="pre">pyams_alchemy.engine.AlchemyEngineUtility</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">zope.container.contained.Contained</span></code></p> |
|
196 <p>Persistent implementation of SQLAlchemy engine utility</p> |
|
197 </dd></dl> |
|
198 |
|
199 <dl class="function"> |
|
200 <dt id="pyams_alchemy.engine.get_engine"> |
|
201 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">get_engine</code><span class="sig-paren">(</span><em>engine</em>, <em>use_pool=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.get_engine" title="Permalink to this definition">¶</a></dt> |
|
202 <dd><p>Get engine matching given utility name</p> |
|
203 </dd></dl> |
|
204 |
|
205 <dl class="function"> |
|
206 <dt id="pyams_alchemy.engine.get_session"> |
|
207 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">get_session</code><span class="sig-paren">(</span><em>engine</em>, <em>join=True</em>, <em>status='active'</em>, <em>request=None</em>, <em>alias=None</em>, <em>twophase=True</em>, <em>use_zope_extension=True</em>, <em>use_pool=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.get_session" title="Permalink to this definition">¶</a></dt> |
|
208 <dd><p>Get a new SQLALchemy session</p> |
|
209 <p>Session is stored in request and in session storage. |
|
210 See <a class="reference internal" href="#pyams_alchemy.engine.get_user_session" title="pyams_alchemy.engine.get_user_session"><code class="xref py py-func docutils literal"><span class="pre">get_user_session()</span></code></a> function to get arguments documentation.</p> |
|
211 </dd></dl> |
|
212 |
|
213 <dl class="function"> |
|
214 <dt id="pyams_alchemy.engine.get_user_session"> |
|
215 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">get_user_session</code><span class="sig-paren">(</span><em>engine</em>, <em>join=True</em>, <em>status='active'</em>, <em>request=None</em>, <em>alias=None</em>, <em>twophase=True</em>, <em>use_zope_extension=True</em>, <em>use_pool=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.get_user_session" title="Permalink to this definition">¶</a></dt> |
|
216 <dd><p>Get a new SQLAlchemy session</p> |
|
217 <table class="docutils field-list" frame="void" rules="none"> |
|
218 <col class="field-name" /> |
|
219 <col class="field-body" /> |
|
220 <tbody valign="top"> |
|
221 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
|
222 <li><strong>engine</strong> (<em>str</em>) – name of an SQLAlchemy engine session utility; if <em>engine</em> is not given as a string, it is |
|
223 returned as-is.</li> |
|
224 <li><strong>join</strong> (<em>bool</em>) – if <em>True</em>, session is joined to the current Pyramid transaction</li> |
|
225 <li><strong>status</strong> (<em>str</em>) – status of the new session; can be STATUS_ACTIVE or STATUS_READONLY</li> |
|
226 <li><strong>request</strong> – currently running request</li> |
|
227 <li><strong>alias</strong> (<em>str</em>) – alias to use in connections mapping for this session</li> |
|
228 <li><strong>twophase</strong> (<em>bool</em>) – if <em>False</em>, session will be isolated and not included into two-phase transactions mechanism</li> |
|
229 <li><strong>use_zope_extension</strong> (<em>bool</em>) – if <em>True</em>, use ZopeTransactionExtension scoped session</li> |
|
230 <li><strong>use_pool</strong> (<em>bool</em>) – if <em>True</em>, this session will use a pool</li> |
|
231 </ul> |
|
232 </td> |
|
233 </tr> |
|
234 </tbody> |
|
235 </table> |
|
236 </dd></dl> |
|
237 |
|
238 <dl class="function"> |
|
239 <dt id="pyams_alchemy.engine.handle_added_engine"> |
|
240 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">handle_added_engine</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.handle_added_engine" title="Permalink to this definition">¶</a></dt> |
|
241 <dd><p>Register new SQLAlchemy engine when added</p> |
|
242 </dd></dl> |
|
243 |
|
244 <dl class="function"> |
|
245 <dt id="pyams_alchemy.engine.handle_modified_engine"> |
|
246 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">handle_modified_engine</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.handle_modified_engine" title="Permalink to this definition">¶</a></dt> |
|
247 <dd><p>Clear SQLAlchemy engine volatile attributes when modified</p> |
|
248 </dd></dl> |
|
249 |
|
250 <dl class="function"> |
|
251 <dt id="pyams_alchemy.engine.handle_pool_checkin"> |
|
252 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">handle_pool_checkin</code><span class="sig-paren">(</span><em>connection</em>, <em>record</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.handle_pool_checkin" title="Permalink to this definition">¶</a></dt> |
|
253 <dd><p>Pool connection checkin</p> |
|
254 <p>Called when a connection returns to the pool. |
|
255 We apply a timestamp on the connection record to be able to close it automatically |
|
256 after 5 minutes without being used.</p> |
|
257 </dd></dl> |
|
258 |
|
259 <dl class="function"> |
|
260 <dt id="pyams_alchemy.engine.handle_pool_checkout"> |
|
261 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">handle_pool_checkout</code><span class="sig-paren">(</span><em>connection</em>, <em>record</em>, <em>proxy</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.handle_pool_checkout" title="Permalink to this definition">¶</a></dt> |
|
262 <dd><p>Pool connection checkout</p> |
|
263 <p>Called when a connection is retrieved from the pool. |
|
264 If the connection record is already marked, we remove it from the mapping.</p> |
|
265 </dd></dl> |
|
266 |
|
267 <dl class="function"> |
|
268 <dt id="pyams_alchemy.engine.handle_removed_engine"> |
|
269 <code class="descclassname">pyams_alchemy.engine.</code><code class="descname">handle_removed_engine</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.engine.handle_removed_engine" title="Permalink to this definition">¶</a></dt> |
|
270 <dd><p>Un-register an SQLAlchemy engine when deleted</p> |
|
271 </dd></dl> |
|
272 |
|
273 </div> |
|
274 <div class="section" id="module-pyams_alchemy.loader"> |
|
275 <span id="pyams-alchemy-loader-module"></span><h3>pyams_alchemy.loader module<a class="headerlink" href="#module-pyams_alchemy.loader" title="Permalink to this headline">¶</a></h3> |
|
276 <dl class="class"> |
|
277 <dt id="pyams_alchemy.loader.DataLoader"> |
|
278 <em class="property">class </em><code class="descclassname">pyams_alchemy.loader.</code><code class="descname">DataLoader</code><span class="sig-paren">(</span><em>source</em>, <em>target</em>, <em>entities</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.loader.DataLoader" title="Permalink to this definition">¶</a></dt> |
|
279 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p> |
|
280 <p>SQLAlchemy data loader</p> |
|
281 <p>This utility class is used to migrate entities from a given connection |
|
282 to another one. |
|
283 WARNING: actually, given entities must share the same schema name!!!</p> |
|
284 <dl class="method"> |
|
285 <dt id="pyams_alchemy.loader.DataLoader.run"> |
|
286 <code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.loader.DataLoader.run" title="Permalink to this definition">¶</a></dt> |
|
287 <dd></dd></dl> |
|
288 |
|
289 </dd></dl> |
|
290 |
|
291 </div> |
|
292 <div class="section" id="module-pyams_alchemy.metaconfigure"> |
|
293 <span id="pyams-alchemy-metaconfigure-module"></span><h3>pyams_alchemy.metaconfigure module<a class="headerlink" href="#module-pyams_alchemy.metaconfigure" title="Permalink to this headline">¶</a></h3> |
|
294 <dl class="function"> |
|
295 <dt id="pyams_alchemy.metaconfigure.engine_directive"> |
|
296 <code class="descclassname">pyams_alchemy.metaconfigure.</code><code class="descname">engine_directive</code><span class="sig-paren">(</span><em>context</em>, <em>name=''</em>, <em>dsn=''</em>, <em>echo=False</em>, <em>use_pool=True</em>, <em>pool_size=25</em>, <em>pool_recycle=-2</em>, <em>echo_pool=False</em>, <em>encoding='utf-8'</em>, <em>convert_unicode=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.metaconfigure.engine_directive" title="Permalink to this definition">¶</a></dt> |
|
297 <dd></dd></dl> |
|
298 |
|
299 </div> |
|
300 <div class="section" id="module-pyams_alchemy.metadirectives"> |
|
301 <span id="pyams-alchemy-metadirectives-module"></span><h3>pyams_alchemy.metadirectives module<a class="headerlink" href="#module-pyams_alchemy.metadirectives" title="Permalink to this headline">¶</a></h3> |
|
302 </div> |
|
303 <div class="section" id="module-pyams_alchemy.mixin"> |
|
304 <span id="pyams-alchemy-mixin-module"></span><h3>pyams_alchemy.mixin module<a class="headerlink" href="#module-pyams_alchemy.mixin" title="Permalink to this headline">¶</a></h3> |
|
305 <dl class="class"> |
|
306 <dt id="pyams_alchemy.mixin.DynamicSchemaMixin"> |
|
307 <em class="property">class </em><code class="descclassname">pyams_alchemy.mixin.</code><code class="descname">DynamicSchemaMixin</code><a class="headerlink" href="#pyams_alchemy.mixin.DynamicSchemaMixin" title="Permalink to this definition">¶</a></dt> |
|
308 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p> |
|
309 <p>Dynamic schema mixin class</p> |
|
310 <p>This class is used to set an entity schema name in Pyramid settings</p> |
|
311 <dl class="classmethod"> |
|
312 <dt id="pyams_alchemy.mixin.DynamicSchemaMixin.get_schema"> |
|
313 <em class="property">classmethod </em><code class="descname">get_schema</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.mixin.DynamicSchemaMixin.get_schema" title="Permalink to this definition">¶</a></dt> |
|
314 <dd></dd></dl> |
|
315 |
|
316 <dl class="classmethod"> |
|
317 <dt id="pyams_alchemy.mixin.DynamicSchemaMixin.get_schema_settings_name"> |
|
318 <em class="property">classmethod </em><code class="descname">get_schema_settings_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_alchemy.mixin.DynamicSchemaMixin.get_schema_settings_name" title="Permalink to this definition">¶</a></dt> |
|
319 <dd></dd></dl> |
|
320 |
|
321 </dd></dl> |
|
322 |
|
323 </div> |
|
324 </div> |
|
325 <div class="section" id="subpackages"> |
|
326 <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2> |
|
327 <div class="toctree-wrapper compound"> |
|
328 <ul> |
|
329 <li class="toctree-l1"><a class="reference internal" href="pyams_alchemy.interfaces.html">pyams_alchemy.interfaces package</a><ul> |
|
330 <li class="toctree-l2"><a class="reference internal" href="pyams_alchemy.interfaces.html#module-pyams_alchemy.interfaces">Module contents</a></li> |
|
331 </ul> |
|
332 </li> |
|
333 <li class="toctree-l1"><a class="reference internal" href="pyams_alchemy.tests.html">pyams_alchemy.tests package</a><ul> |
|
334 <li class="toctree-l2"><a class="reference internal" href="pyams_alchemy.tests.html#submodules">Submodules</a><ul> |
|
335 <li class="toctree-l3"><a class="reference internal" href="pyams_alchemy.tests.html#module-pyams_alchemy.tests.test_utilsdocs">pyams_alchemy.tests.test_utilsdocs module</a></li> |
|
336 <li class="toctree-l3"><a class="reference internal" href="pyams_alchemy.tests.html#module-pyams_alchemy.tests.test_utilsdocstrings">pyams_alchemy.tests.test_utilsdocstrings module</a></li> |
|
337 <li class="toctree-l3"><a class="reference internal" href="pyams_alchemy.tests.html#module-pyams_alchemy.tests">Module contents</a></li> |
|
338 </ul> |
|
339 </li> |
|
340 </ul> |
|
341 </li> |
|
342 <li class="toctree-l1"><a class="reference internal" href="pyams_alchemy.zmi.html">pyams_alchemy.zmi package</a><ul> |
|
343 <li class="toctree-l2"><a class="reference internal" href="pyams_alchemy.zmi.html#submodules">Submodules</a><ul> |
|
344 <li class="toctree-l3"><a class="reference internal" href="pyams_alchemy.zmi.html#module-pyams_alchemy.zmi.engine">pyams_alchemy.zmi.engine module</a></li> |
|
345 <li class="toctree-l3"><a class="reference internal" href="pyams_alchemy.zmi.html#module-pyams_alchemy.zmi">Module contents</a></li> |
|
346 </ul> |
|
347 </li> |
|
348 </ul> |
|
349 </li> |
|
350 </ul> |
|
351 </div> |
|
352 </div> |
|
353 </div> |
|
354 |
|
355 |
|
356 </div> |
|
357 </div> |
|
358 </div> |
|
359 <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
|
360 <div class="sphinxsidebarwrapper"> |
|
361 <h3><a href="index.html">Table Of Contents</a></h3> |
|
362 <ul> |
|
363 <li><a class="reference internal" href="#">PyAMS SQLAlchemy integration</a><ul> |
|
364 <li><a class="reference internal" href="#dynamic-schema-names">Dynamic schema names</a></li> |
|
365 <li><a class="reference internal" href="#module-pyams_alchemy">Module contents</a></li> |
|
366 <li><a class="reference internal" href="#submodules">Submodules</a><ul> |
|
367 <li><a class="reference internal" href="#module-pyams_alchemy.engine">pyams_alchemy.engine module</a></li> |
|
368 <li><a class="reference internal" href="#module-pyams_alchemy.loader">pyams_alchemy.loader module</a></li> |
|
369 <li><a class="reference internal" href="#module-pyams_alchemy.metaconfigure">pyams_alchemy.metaconfigure module</a></li> |
|
370 <li><a class="reference internal" href="#module-pyams_alchemy.metadirectives">pyams_alchemy.metadirectives module</a></li> |
|
371 <li><a class="reference internal" href="#module-pyams_alchemy.mixin">pyams_alchemy.mixin module</a></li> |
|
372 </ul> |
|
373 </li> |
|
374 <li><a class="reference internal" href="#subpackages">Subpackages</a></li> |
|
375 </ul> |
|
376 </li> |
|
377 </ul> |
|
378 |
|
379 <div id="searchbox" style="display: none" role="search"> |
|
380 <h3>Quick search</h3> |
|
381 <form class="search" action="search.html" method="get"> |
|
382 <div><input type="text" name="q" /></div> |
|
383 <div><input type="submit" value="Go" /></div> |
|
384 <input type="hidden" name="check_keywords" value="yes" /> |
|
385 <input type="hidden" name="area" value="default" /> |
|
386 </form> |
|
387 </div> |
|
388 <script type="text/javascript">$('#searchbox').show(0);</script> |
|
389 </div> |
|
390 </div> |
|
391 <div class="clearer"></div> |
|
392 </div> |
|
393 <div class="related" role="navigation" aria-label="related navigation"> |
|
394 <h3>Navigation</h3> |
|
395 <ul> |
|
396 <li class="right" style="margin-right: 10px"> |
|
397 <a href="genindex.html" title="General Index" |
|
398 >index</a></li> |
|
399 <li class="right" > |
|
400 <a href="py-modindex.html" title="Python Module Index" |
|
401 >modules</a> |</li> |
|
402 <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> »</li> |
|
403 </ul> |
|
404 </div> |
|
405 <div class="footer" role="contentinfo"> |
|
406 © Copyright 2017, Thierry Florac. |
|
407 Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5. |
|
408 </div> |
|
409 </body> |
|
410 </html> |