Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# testing/engines.py 

2# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors 

3# <see AUTHORS file> 

4# 

5# This module is part of SQLAlchemy and is released under 

6# the MIT License: http://www.opensource.org/licenses/mit-license.php 

7r""" 

8.. dialect:: postgresql+psycopg2cffi 

9 :name: psycopg2cffi 

10 :dbapi: psycopg2cffi 

11 :connectstring: postgresql+psycopg2cffi://user:password@host:port/dbname[?key=value&key=value...] 

12 :url: http://pypi.python.org/pypi/psycopg2cffi/ 

13 

14``psycopg2cffi`` is an adaptation of ``psycopg2``, using CFFI for the C 

15layer. This makes it suitable for use in e.g. PyPy. Documentation 

16is as per ``psycopg2``. 

17 

18.. versionadded:: 1.0.0 

19 

20.. seealso:: 

21 

22 :mod:`sqlalchemy.dialects.postgresql.psycopg2` 

23 

24""" # noqa 

25from .psycopg2 import PGDialect_psycopg2 

26 

27 

28class PGDialect_psycopg2cffi(PGDialect_psycopg2): 

29 driver = "psycopg2cffi" 

30 supports_unicode_statements = True 

31 

32 # psycopg2cffi's first release is 2.5.0, but reports 

33 # __version__ as 2.4.4. Subsequent releases seem to have 

34 # fixed this. 

35 

36 FEATURE_VERSION_MAP = dict( 

37 native_json=(2, 4, 4), 

38 native_jsonb=(2, 7, 1), 

39 sane_multi_rowcount=(2, 4, 4), 

40 array_oid=(2, 4, 4), 

41 hstore_adapter=(2, 4, 4), 

42 ) 

43 

44 @classmethod 

45 def dbapi(cls): 

46 return __import__("psycopg2cffi") 

47 

48 @classmethod 

49 def _psycopg2_extensions(cls): 

50 root = __import__("psycopg2cffi", fromlist=["extensions"]) 

51 return root.extensions 

52 

53 @classmethod 

54 def _psycopg2_extras(cls): 

55 root = __import__("psycopg2cffi", fromlist=["extras"]) 

56 return root.extras 

57 

58 

59dialect = PGDialect_psycopg2cffi