from peewee import * try: import psycopg #from psycopg.types.json import Jsonb except ImportError: psycopg = None class Psycopg3Database(PostgresqlDatabase): def _connect(self): if psycopg is None: raise ImproperlyConfigured('psycopg3 is not installed!') conn = psycopg.connect(dbname=self.database, **self.connect_params) if self._isolation_level is not None: conn.isolation_level = self._isolation_level conn.autocommit = True return conn def get_binary_type(self): return psycopg.Binary def _set_server_version(self, conn): self.server_version = conn.pgconn.server_version if self.server_version >= 90600: self.safe_create_index = True def is_connection_usable(self): if self._state.closed: return False # Returns True if we are idle, running a command, or in an active # connection. If the connection is in an error state or the connection # is otherwise unusable, return False. conn = self._state.conn return conn.pgconn.transaction_status < conn.TransactionStatus.INERROR
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 0 B | 0644 |
|
apsw_ext.py | File | 4.82 KB | 0644 |
|
cockroachdb.py | File | 9 KB | 0644 |
|
dataset.py | File | 14.09 KB | 0644 |
|
db_url.py | File | 4.15 KB | 0644 |
|
fields.py | File | 1.66 KB | 0644 |
|
flask_utils.py | File | 8 KB | 0644 |
|
hybrid.py | File | 1.49 KB | 0644 |
|
kv.py | File | 5.48 KB | 0644 |
|
migrate.py | File | 30.11 KB | 0644 |
|
mysql_ext.py | File | 3.17 KB | 0644 |
|
pool.py | File | 11.21 KB | 0644 |
|
postgres_ext.py | File | 14.41 KB | 0644 |
|
psycopg3_ext.py | File | 1.15 KB | 0644 |
|
reflection.py | File | 30.2 KB | 0644 |
|
shortcuts.py | File | 11.25 KB | 0644 |
|
signals.py | File | 2.46 KB | 0644 |
|
sqlcipher_ext.py | File | 3.55 KB | 0644 |
|
sqlite_changelog.py | File | 4.68 KB | 0644 |
|
sqlite_ext.py | File | 45.65 KB | 0644 |
|
sqlite_udf.py | File | 13.34 KB | 0644 |
|
sqliteq.py | File | 9.75 KB | 0644 |
|
test_utils.py | File | 1.81 KB | 0644 |
|