diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-18 18:49:42 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-18 18:49:42 -0500 |
commit | 09a82f90e63ec6eeaaa5610b0f495fb2b5a10fce (patch) | |
tree | df1bcbdf3884006eca0e84e8f1f81a51fab90369 /lib/sqlalchemy/dialects/postgresql/pg8000.py | |
parent | e85871c612587b808a145f1351e0c68e2eea2226 (diff) | |
parent | 2336b1cebfcb2f304e09cbc2a0e8bb3fb3a9ceeb (diff) | |
download | sqlalchemy-09a82f90e63ec6eeaaa5610b0f495fb2b5a10fce.tar.gz |
merge tip
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/pg8000.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/pg8000.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index 6af2cbd76..7b1d8e6a7 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -9,14 +9,16 @@ URLs are of the form Unicode ------- -pg8000 requires that the postgresql client encoding be configured in the postgresql.conf file -in order to use encodings other than ascii. Set this value to the same value as -the "encoding" parameter on create_engine(), usually "utf-8". +pg8000 requires that the postgresql client encoding be +configured in the postgresql.conf file in order to use encodings +other than ascii. Set this value to the same value as the +"encoding" parameter on create_engine(), usually "utf-8". Interval -------- -Passing data from/to the Interval type is not supported as of yet. +Passing data from/to the Interval type is not supported as of +yet. """ import decimal @@ -27,26 +29,28 @@ from sqlalchemy import processors from sqlalchemy import types as sqltypes from sqlalchemy.dialects.postgresql.base import PGDialect, \ PGCompiler, PGIdentifierPreparer, PGExecutionContext,\ - _DECIMAL_TYPES, _FLOAT_TYPES + _DECIMAL_TYPES, _FLOAT_TYPES, _INT_TYPES class _PGNumeric(sqltypes.Numeric): def result_processor(self, dialect, coltype): if self.asdecimal: if coltype in _FLOAT_TYPES: return processors.to_decimal_processor_factory(decimal.Decimal) - elif coltype in _DECIMAL_TYPES: + elif coltype in _DECIMAL_TYPES or coltype in _INT_TYPES: # pg8000 returns Decimal natively for 1700 return None else: - raise exc.InvalidRequestError("Unknown PG numeric type: %d" % coltype) + raise exc.InvalidRequestError( + "Unknown PG numeric type: %d" % coltype) else: if coltype in _FLOAT_TYPES: # pg8000 returns float natively for 701 return None - elif coltype in _DECIMAL_TYPES: + elif coltype in _DECIMAL_TYPES or coltype in _INT_TYPES: return processors.to_float else: - raise exc.InvalidRequestError("Unknown PG numeric type: %d" % coltype) + raise exc.InvalidRequestError( + "Unknown PG numeric type: %d" % coltype) class PGExecutionContext_pg8000(PGExecutionContext): pass |