summaryrefslogtreecommitdiff
path: root/lib/extras.py
Commit message (Collapse)AuthorAgeFilesLines
* Use a proper LRU cache for namedtuplesfast-namedtupleDaniele Varrazzo2019-02-021-13/+13
| | | | | | | | | Previous one didn't refresh by last use. Use the stdlib version for py3 and one of our own for py2. Max size set to 512, which should be fine for everyone (tweaking is still possible by monkeypatching, as the tests do, but I don't want to make an interface of it).
* Added caching of types generated by NamedTupleCursorDaniele Varrazzo2019-02-021-10/+21
| | | | see #838
* Docs wordsmith for execute_values() fetch paramDaniele Varrazzo2018-12-271-2/+3
|
* Some harmless adjustments in execute_values() codeDaniele Varrazzo2018-12-271-3/+2
| | | | No optional result, and create the list only if requred.
* rename param name to fetchIvan Kotelnikov2018-11-241-4/+4
|
* add RETURNING clause support in execute_values functionIvan Kotelnikov2018-11-211-1/+10
|
* Don't barf on Composite passed to execute_values()fix-794Daniele Varrazzo2018-10-231-0/+4
| | | | Close #794
* Full flake8 3.5 cleanupDaniele Varrazzo2018-10-231-5/+2
|
* Use the connection.info properties instead of the legacy methodsconnection-infoDaniele Varrazzo2018-10-131-3/+3
|
* Prefer https:// URLs when availableJon Dufresne2018-09-221-3/+3
|
* Improve doc for extras.wait_selectDaniel Hahler2018-09-051-2/+2
|
* DictCursor and RealDictCursor rows maintain columns orderDaniele Varrazzo2018-05-211-4/+30
| | | | Close #177.
* Restored methods iter*() on dict cursors rowsDaniele Varrazzo2018-05-211-9/+24
|
* Merge branch 'master' into drop-2to3Daniele Varrazzo2018-05-201-1/+14
|\
| * Allow non-ascii chars in namedtuple fieldsDaniele Varrazzo2018-05-181-3/+6
| | | | | | | | | | | | | | They can be valid chars in Python 3. Or maybe not? In which case Python will throw an exception, but that's fine. Fix regression introduced fixing #211
| * Convert fields names into valid Python identifiers in NamedTupleCursorDaniele Varrazzo2018-01-291-1/+11
| | | | | | | | Close #211.
* | Drop 2to3 build step; make all code compatible with all PythonsJon Dufresne2017-12-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make all library code compatible with both Python 2 and Python 3. Helps move to modern Python idioms. Can now write for Python 3 (with workarounds for Python 2) instead of the other way around. In the future, when it is eventually time to drop Python 2, the library will be in a better position to remove workarounds Added a very small comparability module compat.py where required. It includes definitions for: - text_type -- A type. str on Python 3. unicode on Python 2. - string_types -- A tuple. Contains only str on Python 3. Contains str & unicode on Python 2.
* | Drop the Python 2 style interface from DictRowJon Dufresne2017-12-111-22/+3
| | | | | | | | | | Now standardizes on the Python 3 interface for all uses. Makes behavior of DictRow between Pythons more consistent and predictable.
* | User super() throughout DictRow classJon Dufresne2017-12-111-4/+4
|/ | | | Avoid calling parent method directly.
* Drop long deprecated function register_tstz_w_secs()Jon Dufresne2017-12-101-12/+0
| | | | | | | | | | Deprecated in commit b263fbf274f9085a1bddca018ed8a50d37023fc7 on 2010-01-13. The deprecation warning was first released in version 2.2.2. The function used to register an alternate type caster for TIMESTAMP WITH TIME ZONE to deal with historical time zones with seconds in the UTC offset. These are now correctly handled by the default type caster, so currently the function doesn't do anything.
* Use builtin function next() throughout projectJon Dufresne2017-12-011-6/+6
| | | | | | | Available since Python 2.6. Use of .next() is deprecated and not supported in Python 3. Forward compatible with modern Python. https://docs.python.org/2/library/functions.html#next
* Remove redundant parenthesesHugo2017-11-281-1/+1
|
* __slots__ should be a tupleHugo2017-11-281-1/+1
|
* Merge branch 'python3_mintimeloggingconnection'Daniele Varrazzo2017-11-281-0/+2
|\
| * Patch for issue #609 for MinTimeLoggingConnectionKevin Campbell2017-11-031-0/+2
| | | | | | | | | | On Python3 MinTimeLoggingConnection raises an exception as it tries to mix strings and bytes
* | Remove workarounds for namedtuple on Python <= 2.5Jon Dufresne2017-11-261-16/+5
| | | | | | | | | | | | namedtuple is available on all Python versions supported by psycopg2. It was first introduced in Python 2.6. Can remove all workarounds and special documentation.
* | Use modern except syntax throughout projectJon Dufresne2017-11-201-1/+1
|/ | | | | | The syntax "except Exception, exc:" is deprecated. All Python versions supported by psycopg2 support the newer, modern syntax. Forward compatible with future Python versions.
* Construct proper human sentences to describe execute_values()Daniele Varrazzo2017-08-311-6/+11
| | | | With bonus typos dropped.
* Note that the fast executemany functions don't respect rowcountDaniele Varrazzo2017-03-281-0/+6
| | | | See issue #540
* Stop a docstring generating a warningDaniele Varrazzo2017-02-071-1/+1
| | | | Valid reST, slightly less valid Python.
* Further minimal performance tweaks to execute_valuesfast-executemanyDaniele Varrazzo2017-02-021-5/+6
|
* Avoid an useless encode/decode roundtrip in execute_values()Daniele Varrazzo2017-02-021-4/+44
| | | | Tests moved into a separate module.
* Better docs for fast executemany functions.Daniele Varrazzo2017-02-021-15/+31
| | | | Issue #502.
* Fixed execute_values with unicodeDaniele Varrazzo2017-02-011-1/+1
| | | | Also added unicode tests.
* Fixed fast execute functions with Python 3Daniele Varrazzo2017-02-011-2/+4
|
* Added execute_batch and execute_values functionsDaniele Varrazzo2017-02-011-0/+80
|
* Fix DeprecationWarning: generator '__iter__' raised StopIterationfix-iter-warningNotSqrt2017-01-041-20/+26
| | | | Closes #498
* Don't try to write bytes in the LoggingConnection fileDaniele Varrazzo2016-12-291-0/+2
| | | | Close #483
* Fix "invalid escape sequence" warning in Python 3.6Tim Graham2016-12-251-1/+1
| | | | http://bugs.python.org/issue27364
* Added ipaddress objects conversionDaniele Varrazzo2016-10-111-0/+4
| | | | Close #387
* inet adapters deprecatedDaniele Varrazzo2016-10-111-0/+5
| | | | Close #343
* Python source cleanup using flake8Daniele Varrazzo2016-10-111-37/+63
|
* Dropped use of b() "macro" and 2to3 fixerDaniele Varrazzo2016-08-151-9/+8
| | | | Just use the b"" strings syntax supported from python 2.6.
* Move replication-related imports to extras.pyOleksandr Shulgin2016-03-081-4/+4
|
* Use python-defined make_dsn() for ReplicationConnection classOleksandr Shulgin2016-03-081-13/+2
|
* Move replication connection to C level.Oleksandr Shulgin2015-10-271-46/+11
|
* Move the `decode` parameter to `start_replication()`.Oleksandr Shulgin2015-10-231-2/+2
| | | | | It makes more sense this way, because otherwise it must be passed to every call of `read_message()`.
* Add quick start to the replication doc, minor doc fixes.Oleksandr Shulgin2015-10-201-1/+1
|
* Properly subclass ReplicationCursor on C level.Oleksandr Shulgin2015-10-191-6/+4
|
* Replace stop_replication with requirement for an exception.Oleksandr Shulgin2015-10-191-0/+12
|