summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/processors.py
Commit message (Collapse)AuthorAgeFilesLines
* Ensure all nested exception throws have a causeMike Bayer2020-03-021-4/+7
| | | | | | | | | | | | | | | Applied an explicit "cause" to most if not all internally raised exceptions that are raised from within an internal exception catch, to avoid misleading stacktraces that suggest an error within the handling of an exception. While it would be preferable to suppress the internally caught exception in the way that the ``__suppress_context__`` attribute would, there does not as yet seem to be a way to do this without suppressing an enclosing user constructed context, so for now it exposes the internally caught exception as the cause so that full information about the context of the error is maintained. Fixes: #4849 Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751
* happy new yearMike Bayer2020-01-011-1/+1
| | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* happy new yearMike Bayer2019-01-111-1/+1
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Post black reformattingMike Bayer2019-01-061-17/+20
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-061-17/+39
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* happy new yearMike Bayer2018-01-121-1/+1
| | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* Disallow all ambiguous boolean values for BooleanMike Bayer2017-10-121-7/+0
| | | | | | | | | | | | | | In release 1.1, the :class:`.Boolean` type was broken in that boolean coercion via ``bool()`` would occur for backends that did not feature "native boolean", but would not occur for native boolean backends, meaning the string ``"0"`` now behaved inconsistently. After a poll, a consensus was reached that non-boolean values should be raising an error, especially in the ambiguous case of string ``"0"``; so the :class:`.Boolean` datatype will now raise ``ValueError`` if an incoming value is not within the range ``None, True, False, 1, 0``. Change-Id: If70c4f79c266f0dd1a0306c0ffe7acb9c66c4cc3 Fixes: #4102
* Support python3.6Mike Bayer2017-01-131-3/+3
| | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Make boolean processors consistent between Py/C; coerce to 1/0Mike Bayer2016-06-231-2/+2
| | | | | | | | | | | | | The processing performed by the :class:`.Boolean` datatype for backends that only feature integer types has been made consistent between the pure Python and C-extension versions, in that the C-extension version will accept any integer value from the database as a boolean, not just zero and one; additionally, non-boolean integer values being sent to the database are coerced to exactly zero or one, instead of being passed as the original integer value. Change-Id: I01e647547fd7047bd549dd70e1fa202c51e8328b Fixes: #3730
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* PEP8 style fixesBrian Jarrett2014-07-131-10/+12
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - rework Oracle to no longer do its own unicode conversion; this has been ↵Mike Bayer2014-01-171-1/+22
| | | | | | | | | | | observed to be very slow. this now has the effect of producing "conditional" unicode conversion for the Oracle backend, as it still returns NVARCHAR etc. as unicode [ticket:2911] - add new "conditional" functionality to unicode processors; the C-level function now uses PyUnicode_Check() as a fast alternative to the isinstance() check in Python
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - The precision used when coercing a returned floating point value toMike Bayer2013-11-221-2/+2
| | | | | | | | | | Python ``Decimal`` via string is now configurable. The flag ``decimal_return_scale`` is now supported by all :class:`.Numeric` and :class:`.Float` types, which will ensure this many digits are taken from the native floating point value when it is converted to string. If not present, the type will make use of the value of ``.scale``, if the type supports this setting and it is non-None. Otherwise the original default length of 10 is used. [ticket:2867]
* - the raw 2to3 runMike Bayer2013-04-271-3/+3
| | | | - went through examples/ and cleaned out excess list() calls
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/Diana Clarke2012-11-191-1/+4
|
* - add new C extension "utils", so far includes distill_paramsMike Bayer2012-08-071-2/+3
| | | | | - repair test_processors which wasn't hitting the python functions - add another suite to test_processors that does distill_params
* -whitespace bonanza, contdMike Bayer2012-07-281-4/+4
|
* Improve SQLite DATETIME storage format handling [ticket:2363]Nathan Wright2012-03-121-1/+7
| | | | | | | | | | | | | | This breaks backwards compatibility with old SQLite DATETIME, DATE, and TIME storage_format strings. Formatting now occurs with named instead of positional parameters. The regexp argument can still use positional arguments, but named groupings are also supported. This means that you can omit fields and change the order of date fields as desired. SQLite's DATETIME and TIME also gained a truncate_microseconds argument. This is shorthand for modifying the format string. Fortunately the str_to_datetime and str_to_time processors written in C already support omitting microseconds, so we don't have to resort to python processing for this case.
* - [bug] Improved error messages when a non-stringMike Bayer2012-01-221-25/+34
| | | | | | | | | or invalid string is passed to any of the date/time processors used by SQLite, including C and Python versions. [ticket:2382] - changed the import model of processors.py so that we can get at the pure python versions and C versions simultaneously in tests.
* - Ensured that the same ValueError is raised forMike Bayer2011-08-041-1/+4
| | | | | | illegal date/time/datetime string parsed from the database regardless of whether C extensions are in use or not.
* - whitespace removal bonanzaMike Bayer2011-01-021-1/+1
|
* - clean up copyright, update for 2011, stamp every file withMike Bayer2011-01-021-1/+2
| | | | | a consistent tag - AUTHORS file
* - Added a bind processor for booleans which coercesMike Bayer2010-11-151-0/+6
| | | | | to int, for DBAPIs such as pymssql that naively call str() on values.
* - more 78 charsMike Bayer2010-07-101-1/+2
| | | | | - BIGINT doc - clean up docs in schema.py
* support scale argument for the C implementation of the decimal processorGaëtan de Menten2010-02-281-23/+18
|
* - the "scale" argument of the Numeric() type is honored whenMike Bayer2010-02-261-10/+22
| | | | | | coercing a returned floating point value into a string on its way to Decimal - this allows accuracy to function on SQLite, MySQL. [ticket:1717]
* rename "error" kwarg to "errors" to be consistent with builtin unicodeGaëtan de Menten2010-02-231-6/+6
| | | | conversion functions.
* - Added "unicode_errors" parameter to String, Unicode, etc.Mike Bayer2010-02-231-4/+8
| | | | | | | | | | | | | | Behaves like the 'errors' keyword argument to the standard library's string.decode() functions. This flag requires that `convert_unicode` is set to `"force"` - otherwise, SQLAlchemy is not guaranteed to handle the task of unicode conversion. Note that this flag adds significant performance overhead to row-fetching operations for backends that already return unicode objects natively (which most DBAPIs do). This flag should only be used as an absolute last resort for reading strings from a column with varied or corrupted encodings, which only applies to databases that accept invalid encodings in the first place (i.e. MySQL. *not* PG, Sqlite, etc.)
* - Added an optional C extension to speed up the sql layer byGaëtan de Menten2010-02-131-0/+90
reimplementing the highest impact functions. The actual speedups will depend heavily on your DBAPI and the mix of datatypes used in your tables, and can vary from a 50% improvement to more than 200%. It also provides a modest (~20%) indirect improvement to ORM speed for large queries. Note that it is *not* built/installed by default. See README for installation instructions. - The most common result processors conversion function were moved to the new "processors" module. Dialect authors are encouraged to use those functions whenever they correspond to their needs instead of implementing custom ones.