Commit Graph

31 Commits

Author SHA1 Message Date
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 0326f3cf01 - Added :paramref:.MetaData.reflect.**dialect_kwargs
to support dialect-level reflection options for all :class:`.Table`
objects reflected.

- Added a new dialect-level argument ``postgresql_ignore_search_path``;
this argument is accepted by both the :class:`.Table` constructor
as well as by the :meth:`.MetaData.reflect` method.  When in use
against Postgresql, a foreign-key referenced table which specifies
a remote schema name will retain that schema name even if the name
is present in the ``search_path``; the default behavior since 0.7.3
has been that schemas present in ``search_path`` would not be copied
to reflected :class:`.ForeignKey` objects.  The documentation has been
updated to describe in detail the behavior of the ``pg_get_constraintdef()``
function and how the ``postgresql_ignore_search_path`` feature essentially
determines if we will honor the schema qualification reported by
this function or not. [ticket:2922]
2014-02-02 16:33:54 -05:00
Mike Bayer 2104d0ba2d - rework the JSON expression system so that "astext" is called *after*
the indexing.  this is for more natural operation.
- also add cast() to the JSON expression to complement astext. This integrates
the CAST call which will be needed frequently.  Part of [ticket:2687].
- it's a little unclear how more advanced unicode attribute-access is going to go,
some quick attempts at testing yielded strange error messages from psycopg2.
- do other cross linking as mentioned in [ticket:2687].
2013-12-27 18:25:57 -05:00
Mike Bayer fec03c88d6 - make the json serializer and deserializer per-dialect, so that we are
compatible with psycopg2's per-connection/cursor approach.  add round trip tests for
both native and non-native.
2013-12-17 17:46:09 -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 e1802ff542 - using AssertsCompiledSQL so need __dialect__ 2013-12-17 15:33:27 -05:00
Mike Bayer 73013914e7 - rework JSON expressions to be based off __getitem__ exclusively
- add support for "standalone" JSON objects; this involves getting CAST
to upgrade the given type of a bound parameter.  should add a core-only test
for this.
- add tests for "standalone" json round trips both with and without unicode
- add mechanism by which we remove psycopg2's "json" handler in order to get
the effect of using our non-native result handlers
2013-12-17 15:13:39 -05:00
Mike Bayer 2c3afb4dcb Merge branch 'issue_2581' of github.com:nathan-rice/sqlalchemy into pg_json 2013-12-17 14:03:20 -05:00
nathan 015c73c83a sqlalchemy/dialects/postgresql/pgjson:
- Added support for additional operators
 - Made return as json default (rather than text)
2013-12-11 10:21:08 -05:00
nathan f285b3536f sqlalchemy/dialects/postgresql/pgjson:
- Fixed reference to HSTORE
 - Corrected spelling of SQLAlchemy

 sqlalchemy/dialects/postgresql/psycopg2:
 - Added psycopg2 specific wrapper type for JSON which uses inherent json deserialization facilities
 - Added code to detect and utilize the JSON wrapper if psycopg2 >= 2.5

test/dialect/postgresql/test_types:
- removed reference to use_native_hstore
2013-12-10 10:01:51 -05:00
Mike Bayer 164bff0749 - round trip test
- changelog
- some doc rearrangement
2013-12-09 21:27:14 -05:00
Noufal Ibrahim d3b65cd9bc Adds test to verify tsvector creation.
Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-12-10 01:07:53 +05:30
nathan 64288c7d6f sqlalchemy/dialects/postgresql/__init__.py:
- Added import references to JSON class

 sqlalchemy/dialects/postgresql/base.py:
 - Added visitor method for JSON class

 sqlalchemy/dialects/postgresql/pgjson (new):
 - JSON class, supports automatic serialization and deserialization of json data, as well as basic json operators.
2013-12-09 11:46:36 -05:00
Mike Bayer d52db834a5 - move additional enum compilation tests to postgresql/test_compiler.py 2013-11-30 16:12:20 -05:00
Mike Bayer 66773a8801 - Fixed bug where values within an ENUM weren't escaped for single
quote signs.   Note that this is backwards-incompatible for existing
workarounds that manually escape the single quotes. [ticket:2878]
2013-11-30 13:53:26 -05:00
Mike Bayer 31cecebd48 - add support for specifying tables or entities for "of"
- implement Query with_for_update()
- rework docs and tests
2013-11-28 23:23:27 -05:00
Mike Bayer 4aaf3753d7 - fix up rendering of "of"
- move out tests, dialect specific out of compiler, compiler tests use new API,
legacy API tests in test_selecatble
- add support for adaptation of ForUpdateArg, alias support in compilers
2013-11-28 22:25:09 -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 fff9079909 - Removed a 128-character truncation from the reflection of the
server default for a column; this code was original from
PG system views which truncated the string for readability.
[ticket:2844]
2013-10-18 19:00:05 -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
Mike Bayer a2cce1bf43 Parenthesis will be applied to a compound SQL expression as
rendered in the column list of a CREATE INDEX statement.
[ticket:2742]
2013-10-12 20:21:18 -04:00
Mike Bayer 9bc9d5c106 - Fixed bug in default compiler plus those of postgresql, mysql, and
mssql to ensure that any literal SQL expression values are
rendered directly as literals, instead of as bound parameters,
within a CREATE INDEX statement. [ticket:2742]
- don't need expression_as_ddl(); literal_binds and include_table
take care of this functionality.
2013-10-12 20:04:55 -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 08a6a8b519 - Removed some now unneeded version checks [ticket:2829] courtesy alex gaynor 2013-09-22 20:35:40 -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 3dde982171 set UTC timezone on the connection here so we can get consistent results 2013-06-29 11:08:07 -04:00
Mike Bayer d875f677a3 The behavior of :func:.extract has been simplified on the
Postgresql dialect to no longer inject a hardcoded ``::timestamp``
or similar cast into the given expression, as this interfered
with types such as timezone-aware datetimes, but also
does not appear to be at all necessary with modern versions
of psycopg2.  Also in 0.8.2.
[ticket:2740]
2013-06-28 23:53:27 -04:00
Mike Bayer 1c23741b8e refactor test suites for postgresql, mssql, mysql into packages. 2013-06-28 22:30:11 -04:00