chtd / psycopg2cffi

Port to cffi with some speed improvements
Other
177 stars 43 forks source link

Cannot map to psycopg2 #60

Closed Kadrian closed 8 years ago

Kadrian commented 8 years ago
Python 2.7.9 (9c4588d731b7, Mar 23 2015, 16:20:40)
[PyPy 2.5.1 with GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> from psycopg2cffi import compat
>>>> compat.register()
>>>> psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: global name 'psycopg2' is not defined

Is there something I'm missing?

lopuhin commented 8 years ago

compat.register registers psycopg2 as an alias for psycopg2cffi, but you still need to import it:

>>> from psycopg2cffi import compat
>>> compat.register()
>>> psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'psycopg2' is not defined
>>> import psycopg2
>>> psycopg2
<module 'psycopg2cffi' from 'psycopg2cffi/__init__.pyc'>
lopuhin commented 8 years ago

I tried to clarify it in the README - does it look better now?

Kadrian commented 8 years ago

Aha! :-) Thanks for clarification!

lopuhin commented 8 years ago

You're welcome! :)