Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/psycopg2cffi.py: 74%

19 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:35 +0000

1# testing/engines.py 

2# Copyright (C) 2005-2023 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: https://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: https://pypi.org/project/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 supports_statement_cache = True 

32 

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

34 # __version__ as 2.4.4. Subsequent releases seem to have 

35 # fixed this. 

36 

37 FEATURE_VERSION_MAP = dict( 

38 native_json=(2, 4, 4), 

39 native_jsonb=(2, 7, 1), 

40 sane_multi_rowcount=(2, 4, 4), 

41 array_oid=(2, 4, 4), 

42 hstore_adapter=(2, 4, 4), 

43 ) 

44 

45 @classmethod 

46 def dbapi(cls): 

47 return __import__("psycopg2cffi") 

48 

49 @classmethod 

50 def _psycopg2_extensions(cls): 

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

52 return root.extensions 

53 

54 @classmethod 

55 def _psycopg2_extras(cls): 

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

57 return root.extras 

58 

59 

60dialect = PGDialect_psycopg2cffi