Commit Graph

384 Commits

Author SHA1 Message Date
Daniele Varrazzo
8bd7ad7bb5 Faster check for empty range in str() 2018-10-04 11:46:07 +01:00
Michel Albert
d317977205 Implement __str__ for range types 2018-09-30 10:15:55 +02:00
Daniel Hahler
6af55ee51c Improve doc for extras.wait_select 2018-09-05 16:45:33 +01:00
Daniele Varrazzo
0bb7d0db48 DictCursor and RealDictCursor rows maintain columns order
Close #177.
2018-05-21 03:14:08 +01:00
Daniele Varrazzo
7bdaf0affd Restored methods iter*() on dict cursors rows 2018-05-21 02:51:37 +01:00
Daniele Varrazzo
e8a831dda2 Merge branch 'master' into drop-2to3 2018-05-20 23:56:29 +01:00
Daniele Varrazzo
0161d54dbb Merge branch 'master' into encrypt-pass 2018-05-20 17:57:34 +01:00
Daniele Varrazzo
bc84b6233e Allow non-ascii chars in namedtuple fields
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
2018-05-18 12:15:50 +01:00
Ashesh Vashi
1bec2bdc43
Merge branch 'master' into master 2018-05-08 15:17:59 +05:30
Daniele Varrazzo
ddb87b7727 Convert fields names into valid Python identifiers in NamedTupleCursor
Close #211.
2018-01-29 03:30:46 +00:00
Jon Dufresne
8ad2098b74 Drop 2to3 build step; make all code compatible with all Pythons
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.
2017-12-11 20:26:58 -08:00
Jon Dufresne
f35465231f Drop the Python 2 style interface from DictRow
Now standardizes on the Python 3 interface for all uses. Makes behavior
of DictRow between Pythons more consistent and predictable.
2017-12-11 20:02:16 -08:00
Jon Dufresne
3a6a8e96fb User super() throughout DictRow class
Avoid calling parent method directly.
2017-12-11 19:01:38 -08:00
Jon Dufresne
19b1efd629 Drop long deprecated function register_tstz_w_secs()
Deprecated in commit b263fbf274 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.
2017-12-10 07:57:11 -08:00
Daniele Varrazzo
861e389fcf Dropped psycopg1 module 2017-12-04 11:56:27 +00:00
Jon Dufresne
f5703dc3e5 Use builtin function next() throughout project
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
2017-12-01 19:57:37 -08:00
Daniele Varrazzo
f939f39580 Use dict comprehensions 2017-11-28 16:11:06 +00:00
Daniele Varrazzo
a0229cff82 Documentation tweaked to omit Python 2.6 distinctions 2017-11-28 16:11:06 +00:00
Hugo
283de27098 Remove redundant parentheses 2017-11-28 16:06:52 +00:00
Hugo
08b479bc10 __slots__ should be a tuple 2017-11-28 16:05:59 +00:00
Jon Dufresne
c1d3948be9 Update documentation to reflect JSON import behavior
The docs don't need to describe what will happen on Python versions
before 2.6 as they are unsupported by psycopg2.

Should have been included in commit
d58844e548, but was missed.
2017-11-28 06:38:44 -08:00
Daniele Varrazzo
914ccbacb5 Merge branch 'python3_mintimeloggingconnection' 2017-11-28 03:23:42 +00:00
Daniele Varrazzo
fc8574fdd8 Merge remote-tracking branch 'jdufresne/decimal' 2017-11-28 03:05:06 +00:00
Daniele Varrazzo
06d4788811 Merge remote-tracking branch 'jdufresne/json' 2017-11-28 03:04:59 +00:00
Jon Dufresne
048f1bb95a Remove workaround for decimal module
The decimal module is available on all Python versions supported by
psycopg2. It has been available since Python 2.4. No need to catch an
ImportError.

https://docs.python.org/2/library/decimal.html
2017-11-26 17:55:24 -08:00
Jon Dufresne
d58844e548 Clean up JSON workarounds for unsupported Python versions
All Python versions supported by psycopg2 have the json module. It was
added in Python 2.6. Can remove checks for availability, slightly
simplifying the code.
2017-11-26 17:11:27 -08:00
Jon Dufresne
05c28cce78 Remove workarounds for namedtuple on Python <= 2.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.
2017-11-26 13:55:30 -08:00
Jon Dufresne
390e43fcb1 Use modern except syntax throughout project
The syntax "except Exception, exc:" is deprecated. All Python versions
supported by psycopg2 support the newer, modern syntax. Forward
compatible with future Python versions.
2017-11-20 20:00:35 -08:00
Kevin Campbell
b804c092ac Patch for issue #609 for MinTimeLoggingConnection
On Python3 MinTimeLoggingConnection raises an exception as it tries to
mix strings and bytes
2017-11-03 17:30:06 +08:00
Ashesh Vashi
84d405894c Moving the encrypt_password method from the connection class to the
psycopgmodule, and exported it from psycopg2.extensions as per review
comments.
2017-09-14 23:42:54 +05:30
Daniele Varrazzo
3ec06b88f0 Construct proper human sentences to describe execute_values()
With bonus typos dropped.
2017-08-31 16:34:04 +01:00
Daniele Varrazzo
991f0988ee Use an import style reported not broken on Python 3.6
Couldn't reproduce the issue but it has been documented in #550.
2017-06-17 01:51:37 +01:00
Daniele Varrazzo
789eb64f3a Added Json.prepare()
Close #562
2017-06-16 01:37:49 +01:00
Daniele Varrazzo
89169e6e53 Error codes updated to PG 10 beta 1 2017-06-05 12:34:17 +01:00
Daniele Varrazzo
75d84f0b25 errcodes updated to PG 9.6 2017-06-05 12:18:21 +01:00
Daniele Varrazzo
3b48918bef Note that the fast executemany functions don't respect rowcount
See issue #540
2017-03-28 10:37:04 +01:00
Daniele Varrazzo
ee9948fa86 Expose *DATETIMETZ* objects in the extensions module 2017-03-22 03:42:12 +00:00
Daniele Varrazzo
1e0aef032f Dropped repeated doc links in the same paragraph
And some more sql docs cleanup.
2017-03-16 04:40:22 +00:00
Daniele Varrazzo
c7f5690426 Added docs about the usability of sql objects with copy_expert()
See issue #529.
2017-03-16 00:55:20 +00:00
Daniele Varrazzo
3bfbd3a0a5 Added test to verify sql objects work with copy_expert()
I'll be honest: I lucked out, I didn't think about this combination. But
maybe sheer luck, maybe using common code paths, it just works. Let's
make it stays so.
2017-03-16 00:55:20 +00:00
Daniele Varrazzo
44d8edfd8c Ignore None arguments passed to make_dsn()
Close #517.
2017-03-01 20:12:13 +00:00
Daniele Varrazzo
20c9c17457 connection.isolation_level is now writable 2017-02-16 12:46:35 +00:00
Daniele Varrazzo
7210287e76 Stop a docstring generating a warning
Valid reST, slightly less valid Python.
2017-02-07 12:29:05 +00:00
Daniele Varrazzo
665e9dc665 Exposing ISOLATION_LEVEL_DEFAULT to Python
This is now the state that is returned to Python if nothing has been
explicitly set.
2017-02-04 14:43:54 +00:00
Daniele Varrazzo
de8b335d80 Merge branch 'master' into sql-compose 2017-02-03 04:56:02 +00:00
Daniele Varrazzo
1911b250e3 Merge branch 'async-keyword'
Close #495
2017-02-03 04:45:17 +00:00
Daniele Varrazzo
ce9be69615 Added async_ as an alias for async
Added in argument for psycopg2.connect() and connection.__init__, and
for the connection.async attribute.
2017-02-03 04:43:49 +00:00
Daniele Varrazzo
95226baa9b Further minimal performance tweaks to execute_values 2017-02-02 17:44:25 +00:00
Daniele Varrazzo
dc1b4fff90 Avoid an useless encode/decode roundtrip in execute_values()
Tests moved into a separate module.
2017-02-02 17:29:17 +00:00
Daniele Varrazzo
d2fdc5ca9f Better docs for fast executemany functions.
Issue #502.
2017-02-02 16:02:33 +00:00