我们从Python开源项目中,提取了以下21个代码示例,用于说明如何使用psycopg2.__version__()。
def _has_lo64(conn): """Return (bool, msg) about the lo64 support""" if conn.server_version < 90300: return (False, "server version %s doesn't support the lo64 API" % conn.server_version) if 'lo64' not in psycopg2.__version__: return (False, "this psycopg build doesn't support the lo64 API") return (True, "this server and build support the lo64 API")
def get_summary(cls): """ Return a diction of information about this database backend. """ summary = { "DB-API version": "2.0", "Database SQL type": cls.__name__, "Database SQL module": "psycopg2", "Database SQL module version": psycopg2.__version__, "Database SQL module location": psycopg2.__file__, } return summary
def make_psycopg_green(): """Configure Psycopg to be used with eventlet in non-blocking way.""" if not hasattr(extensions, 'set_wait_callback'): raise ImportError( "support for coroutines not available in this Psycopg version (%s)" % psycopg2.__version__) extensions.set_wait_callback(eventlet_wait_callback)
def ensure_libs(sslrootcert=None): if not HAS_PSYCOPG2: raise LibraryError('psycopg2 is not installed. we need psycopg2.') if sslrootcert and psycopg2.__version__ < '2.4.3': raise LibraryError('psycopg2 must be at least 2.4.3 in order to use the ssl_rootcert parameter') # no problems return None
def make_psycopg_green(): """Configure Psycopg to be used with gevent in non-blocking way.""" if not hasattr(extensions, 'set_wait_callback'): raise ImportError( "support for coroutines not available in this Psycopg version (%s)" % psycopg2.__version__) extensions.set_wait_callback(gevent_wait_callback)