Python的ORM框架,SQLAlchemy 0.8 发布
fmms 12年前
<p><a href="/misc/goto?guid=4958193864039269840" target="_blank">SQLAlchemy </a>是一个Python 的SQL 工具包以及数据库对象映射框架<br /> <br /> SQLAlchemy 0.8 发布了,该版本是维护版本,主要是 bug 的修复。详细请看<a href="/misc/goto?guid=4958339010784243953" target="_blank">发行说明</a>。</p> <br /> <p>示例代码:</p> <pre><span class="python_name">user1 </span><span class="python_operator">= </span><span class="python_name">User</span><span class="python_enclosure">(</span><span class="python_name">name</span><span class="python_operator">=</span><span class="python_literal">'user1'</span><span class="python_enclosure">)</span><span class="python_operator"> </span><span class="python_name">user2 </span><span class="python_operator">= </span><span class="python_name">User</span><span class="python_enclosure">(</span><span class="python_name">name</span><span class="python_operator">=</span><span class="python_literal">'user2'</span><span class="python_enclosure">)</span><span class="python_operator"> </span><span class="python_name">session</span><span class="python_operator">.</span><span class="python_name">add</span><span class="python_enclosure">(</span><span class="python_name">user1</span><span class="python_enclosure">)</span><span class="python_operator"> </span><span class="python_name"> session</span><span class="python_operator">.</span><span class="python_name">add</span><span class="python_enclosure">(</span><span class="python_name">user2</span><span class="python_enclosure">)</span><span class="python_operator"> </span> <span class="python_name"> session</span><span class="python_operator">.</span><span class="python_name">commit</span><span class="python_enclosure">() </span><span class="python_comment"># write changes to the databas</span></pre>