snipt

Ctrl+h for KB shortcuts

Text only

set psycopg2 to return unicode objects

1
2
3
4
import psycopg2
import psycopg2.extensions
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
https://snipt.net/embed/7a2dd85c29300da943e1d0d84e963816/
/raw/7a2dd85c29300da943e1d0d84e963816/
7a2dd85c29300da943e1d0d84e963816
text
Text only
5
2019-08-23T03:26:06
True
False
False
/api/public/snipt/19547/
set-psycopg2-to-return-unicode-objects
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>import psycopg2 </span><span id="L-2"><a name="L-2"></a>import psycopg2.extensions </span><span id="L-3"><a name="L-3"></a>psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) </span><span id="L-4"><a name="L-4"></a>psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY) </span></pre></div> </td></tr></table>
psycopg2