diff options
author | Daniel Rocco <drocco@gmail.com> | 2015-02-28 16:39:43 -0500 |
---|---|---|
committer | Daniel Rocco <drocco@gmail.com> | 2015-02-28 16:39:43 -0500 |
commit | 072d6053472cdc7fa1da404ac4af9a6c2d7705b5 (patch) | |
tree | c83ca06c30257af2fd3d4db30141301940907df5 | |
parent | cb39a712f96e74b193f7c62da9d062b047703162 (diff) |
Use ext shorthand for psycopg2.extensions everywhere
-rw-r--r-- | pgcli/pgexecute.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index e669d512..41e47eb3 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -10,19 +10,18 @@ _logger = logging.getLogger(__name__) # Cast all database input to unicode automatically. # See http://initd.org/psycopg/docs/usage.html#unicode-handling for more info. -ext.register_type(psycopg2.extensions.UNICODE) -ext.register_type(psycopg2.extensions.UNICODEARRAY) +ext.register_type(ext.UNICODE) +ext.register_type(ext.UNICODEARRAY) ext.register_type(ext.new_type((705,), "UNKNOWN", ext.UNICODE)) ext.register_type(ext.new_type((51766,), "HSTORE", ext.UNICODE)) # Cast bytea fields to text. By default, this will render as hex strings with # Postgres 9+ and as escaped binary in earlier versions. -psycopg2.extensions.register_type( - psycopg2.extensions.new_type((17,), 'BYTEA_TEXT', psycopg2.STRING)) +ext.register_type(ext.new_type((17,), 'BYTEA_TEXT', psycopg2.STRING)) # When running a query, make pressing CTRL+C raise a KeyboardInterrupt # See http://initd.org/psycopg/articles/2014/07/20/cancelling-postgresql-statements-python/ -psycopg2.extensions.set_wait_callback(psycopg2.extras.wait_select) +ext.set_wait_callback(psycopg2.extras.wait_select) class PGExecute(object): |