Commit Graph

32 Commits

Author SHA1 Message Date
Jacob Hayes fe84543cc7 Add TRUNCATE to postgres autocommit regexp
Extends AUTOCOMMIT_REGEXP for the postgres dialect to include `TRUNCATE`.

Change-Id: I315e03674b89bb89aae669b8655481e4d890491e
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/407
(cherry picked from commit 756d578287)
2017-12-18 11:33:37 -05:00
Mike Bayer 2a8167f241 Support pg10
One test appears to use some awkward calling style
with the current_date function that isn't working in pg10
anymore, this looks like an extremely
old test that can be removed

Also cherry-picks f846a789b7 from master
to repair 'postgres'-deprecation warning test for multiple
calls within a single process

Change-Id: I5f8aee0f5ed423461be5a9060c812eb0acdc7df5
(cherry picked from commit 67ee56be69)
2017-10-03 13:01:58 -04:00
Mike Bayer 7bbf960a3d Parse for Postgresql version w/ "beta"
Continuing with the fix that correctly handles Postgresql
version string "10devel" released in 1.1.8, an additional regexp
bump to handle version strings of the form "10beta1".   While
Postgresql now offers better ways to get this information, we
are sticking w/ the regexp at least through 1.1.x for the least
amount of risk to compatibility w/ older or alternate Postgresql
databases.

Change-Id: I12ddb06465f7dcf80563c27632441ef5963f60d4
Fixes: #4005
(cherry picked from commit b6d3f60791)
2017-06-08 13:01:29 -04:00
Jacob Hayes 79de994529 Support autocommit for GRANT and REVOKE on postgresql
Extends `AUTOCOMMIT_REGEXP` for the postgres dialect to include `GRANT` and `REVOKE`.

Change-Id: Iba15f1ebf5bd7bc0fc1193fdf561417e53bf5d57
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/357
(cherry picked from commit 328248e6e31100aae03f060b83488f3116cd3450)
2017-05-09 11:46:50 -04:00
Sean McCully 6d13f0ace3 Support Postgresql development version numbers
Added support for parsing the Postgresql version string for
a development version like "PostgreSQL 10devel".  Pull request
courtesy Sean McCully.

Change-Id: I7bc18bc4d290349c23e9796367b7d694d0873096
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/351
(cherry picked from commit a86764d99b)
2017-03-29 16:18:48 -04:00
Mike Bayer 3b6004e6ab Add new DDL autocommit expressions for Postgresql
Added regular expressions for the "IMPORT FOREIGN SCHEMA",
"REFRESH MATERIALIZED VIEW" Postgresql statements so that they
autocommit when invoked via a connection or engine without
an explicit transaction.  Pull requests courtesy Frazer McLean
and Paweł Stiasny.

Fixes: #3840
Co-authored-by: Frazer McLean
Co-authored-by: Paweł Stiasny
Change-Id: I92b2b61683d29d57fa23a66a3559120cb1241c2f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/323
2017-02-13 14:45:40 -05:00
Khairi Hafsham 772374735d Make all tests to be PEP8 compliant
tested using pycodestyle version 2.2.0

Fixes: #3885
Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
2017-02-07 11:21:56 -05:00
Mike Bayer 428dfeee48 Repair PG BIGSERIAL w/ TypeDecorator, Variant
Some of the dialect impl memoization for TypeDecorator
necessarily keeps the top-level TypeDecorator type
around, since a user-defined type will have bind and result
set processing behavior.  For both TypeDecorator and Variant,
PG dialect needs to ensure it's looking at the SQLAlchemy
type to check for SmallInteger / BigInteger.

Fixes: 3739
Change-Id: I2d45fb997f17c6272d6bb826a77d2dba665adae7
(cherry picked from commit 421fa6b8bf)
2016-07-04 16:54:01 -04:00
Mike Bayer c59bf0007f - The `sqlalchemy.dialects.postgres` module, long deprecated, is
removed; this has emitted a warning for many years and projects
should be calling upon ``sqlalchemy.dialects.postgresql``.
Engine URLs of the form ``postgres://`` will still continue to function,
however.
2016-01-29 11:44:58 -05:00
Mike Bayer 4e6ec9eef4 - Repaired some typing and test issues related to the pypy
psycopg2cffi dialect, in particular that the current 2.7.0 version
does not have native support for the JSONB type.  The version detection
for psycopg2 features has been tuned into a specific sub-version
for psycopg2cffi.  Additionally, test coverage has been enabled
for the full series of psycopg2 features under psycopg2cffi.
fixes #3439
2015-06-05 17:34:02 -04:00
Mike Bayer a50dcb31b9 - Fixed bug where known boolean values used by
:func:`.engine_from_config` were not being parsed correctly;
these included ``pool_threadlocal`` and the psycopg2 argument
``use_native_unicode``. fixes #3435
- add legacy_schema_aliasing config parsing for mssql
- move use_native_unicode config arg to the psycopg2 dialect
2015-05-26 10:56:23 -04:00
Mike Bayer d140983148 Merge remote-tracking branch 'origin/pr/132' into pr132 2015-03-02 19:00:19 -05:00
Tony Locke 8038cfa077 pg8000 client_encoding in create_engine()
The pg8000 dialect now supports the setting of the PostgreSQL parameter
client_encoding from create_engine().
2014-12-16 20:55:55 +00:00
Mike Bayer 83326bf44c - The exception wrapping system for DBAPI errors can now accommodate
non-standard DBAPI exceptions, such as the psycopg2
TransactionRollbackError.  These exceptions will now be raised
using the closest available subclass in ``sqlalchemy.exc``, in the
case of TransactionRollbackError, ``sqlalchemy.exc.OperationalError``.
fixes #3075
2014-07-29 14:06:43 -04:00
Mike Bayer 54592942c4 - add support for tags, including include/exclude support.
simplify tox again now that we can exclude tests more easily
2014-07-27 18:46:20 -04:00
Mike Bayer 31178db914 - flake8 all of test/dialect/postgresql
- add __backend__ to most tests so that pg8000 can start coming in
2014-07-25 16:04:35 -04:00
Tony Locke f8f29d0a10 PEP 8 tidy of pg8000 dialect and postgresql/test_dialect.py 2014-05-22 20:36:27 +01:00
Tony Locke 66e0a7771f Autocommit isolation level for postgresql+pg8000
As with postgresql+psycopg2,
execution_options(isolation_level='AUTOCOMMIT') now works for the
postgresql+pg8000 dialect.

Also enabled the autocommit test in test_dialect.py for pg8000.
2014-05-22 20:13:10 +01:00
Tony Locke fc4e113cf1 pg8000 now passes test_extract() test 2014-05-21 19:17:41 +01:00
Alex Gaynor 1caa7fafbd Fix many typos throughout the codebase
Found using: https://github.com/intgr/topy
2014-04-26 13:13:13 -07:00
Shaun Stanworth 0953f26250 78-char width 2015-01-26 18:43:19 -05:00
Shaun Stanworth f94d75ede5 Added psycopg2cffi dialect 2015-01-26 18:43:19 -05:00
Mike Bayer ecdfc31774 - Support has been improved for Postgresql reflection behavior on very old
(pre 8.1) versions of Postgresql, and potentially other PG engines
such as Redshift (assuming Redshift reports the version as < 8.1).
The query for "indexes" as well as "primary keys" relies upon inspecting
a so-called "int2vector" datatype, which refuses to coerce to an array
prior to 8.1 causing failures regarding the "ANY()" operator used
in the query.  Extensive googling has located the very hacky, but
recommended-by-PG-core-developer query to use when PG version < 8.1
is in use, so index and primary key constraint reflection now work
on these versions.
2014-02-18 18:35:23 -05:00
Mike Bayer d98fcca0b3 this test appears to be failing with pg 9.3, not sure how to restore it 2013-12-17 15:37:50 -05:00
Mike Bayer 46ac022e57 - move this test to PG test_reflection
- don't use locals()
2013-10-25 17:19:03 -04:00
Mike Bayer e5a42a748b Merge branch 'master' of github.com:ijl/sqlalchemy into merge_2183 2013-10-25 17:01:38 -04:00
Mike Bayer a5dc173ea6 - Added support for rendering `SMALLSERIAL when a :class:.SmallInteger`
type is used on a primary key autoincrement column, based on server
version detection of Postgresql version 9.2 or greater.
[ticket:2840]
2013-10-15 19:06:21 -04:00
ijl 9d952e0a11 PostgreSQL foreign key inspection includes options 2013-10-11 15:01:14 -04:00
Mike Bayer 94d421ca2f - put exact version string in the test
- use match with a .* preceding instead of search
2013-09-29 17:24:29 -04:00
Mike Bayer 62463b95e0 add test for upcoming pullreq 2013-09-29 17:19:25 -04:00
Mike Bayer b38a76cd1d - replace most explicitly-named test objects called "Mock..." with
actual mock objects from the mock library.  I'd like to use mock
for new tests so we might as well use it in obvious places.
- use unittest.mock in py3.3
- changelog
- add a note to README.unittests
- add tests_require in setup.py
- have tests import from sqlalchemy.testing.mock
- apply usage of mock to one of the event tests.  we can be using
this approach all over the place.
2013-06-30 18:35:12 -04:00
Mike Bayer 1c23741b8e refactor test suites for postgresql, mssql, mysql into packages. 2013-06-28 22:30:11 -04:00