Commit Graph

110 Commits

Author SHA1 Message Date
Mike Bayer 7d70dfd412 - fix array test that was essentially taking a weird guess
at the primary key of a row based on other tests invoking around it
2016-01-23 18:30:37 -05:00
Diana Clarke 104cfe149a - Postgres: Do not prefix table with schema in: "FOR UPDATE of <table>"
For example, this query:

    SELECT s1.users.name FROM s1.users FOR UPDATE OF s1.users

should actually be:

    SELECT s1.users.name FROM s1.users FOR UPDATE OF users

fixes #3573

(cherry picked from commit fd47fea6fb)
2015-11-30 13:06:39 -05:00
aisch bb2b486de5 fix postgresql exclude contraint to check when= against None rather than __bool__ eval
(cherry picked from commit 0921a6abbc)
2015-11-30 13:01:33 -05:00
Mike Bayer 29d6f6e19b - Fixed the `.python_type attribute of :class:.postgresql.INTERVAL`
to return ``datetime.timedelta`` in the same way as that of
:obj:`.types.Interval.python_type`, rather than raising
``NotImplementedError``.
fixes #3571
2015-11-19 15:10:46 -05:00
Mike Bayer fa829d0e1b - modernize some very old global-engine tests w/ bad teardowns
(cherry picked from commit affcfd1e52)

Conflicts:
	test/dialect/postgresql/test_query.py
2015-10-11 12:32:33 -04:00
Mike Bayer 9b7a00d93b - repair flake8 issues
(cherry picked from commit e6779d8437)
2015-10-11 12:28:20 -04:00
Mike Bayer 48ad282e37 - repair laziness about setting time zone here, which is leaking
out depending on connection pool state

(cherry picked from commit 2a8a06e33a)
2015-10-11 12:27:31 -04:00
Mike Bayer 9e092e3394 - An adjustment to the new Postgresql feature of reflecting storage
options and USING of 🎫`3455` released in 1.0.6,
to disable the feature for Postgresql versions < 8.2 where the
``reloptions`` column is not provided; this allows Amazon Redshift
to again work as it is based on an 8.0.x version of Postgresql.
Fix courtesy Pete Hollobon.
references #3455
2015-07-24 12:24:18 -04:00
Pete Hollobon e3c8eabb28 Fix typo 2015-06-22 14:54:21 +01:00
Mike Bayer e625d2ea88 - for #3455
- changelog
- versionadded + reflink for new pg storage parameters doc
- pep8ing
- add additional tests to definitely check that the Index object
is created all the way with the opts we want
fixes #3455
2015-06-19 14:10:47 -04:00
Mike Bayer 99ceed3e55 Merge remote-tracking branch 'origin/pr/179' into pr179 2015-06-19 13:45:01 -04:00
Mike Bayer 4a25c10e27 - Repaired the :class:.ExcludeConstraint construct to support common
features that other objects like :class:`.Index` now do, that
the column expression may be specified as an arbitrary SQL
expression such as :obj:`.cast` or :obj:`.text`.
fixes #3454
2015-06-16 14:33:53 -04: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
Pete Hollobon af19435b9c Add reflection of PostgreSQL index access methods (USING clause) 2015-06-04 16:45:41 +01:00
Pete Hollobon b03ee45f32 Add reflection of PostgreSQL index storage options 2015-06-04 15:12:09 +01:00
Pete Hollobon dff81500b1 Add support for PostgreSQL index storage parameters
Add support for specifying PostgreSQL index storage paramters (e.g.
fillfactor).
2015-06-03 17:32:12 +01: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 ecd7b31d5e - Fixed a long-standing bug where the :class:.Enum type as used
with the psycopg2 dialect in conjunction with non-ascii values
and ``native_enum=False`` would fail to decode return results properly.
This stemmed from when the PG :class:`.postgresql.ENUM` type used
to be a standalone type without a "non native" option.
fixes #3354
- corrected the assertsql comparison rule to expect a non-ascii
SQL string
2015-04-04 12:02:51 -04:00
Mike Bayer 4b16493548 - Fixed bug where updated PG index reflection as a result of
🎫`3184` would cause index operations to fail on Postgresql
versions 8.4 and earlier.  The enhancements are now
disabled when using an older version of Postgresql.
fixes #3343
2015-04-01 16:50:32 -04:00
Mike Bayer 71b8df2e53 - The Postgresql :class:.postgresql.ENUM type will emit a
DROP TYPE instruction when a plain ``table.drop()`` is called,
assuming the object is not associated directly with a
:class:`.MetaData` object.   In order to accomodate the use case of
an enumerated type shared between multiple tables, the type should
be associated directly with the :class:`.MetaData` object; in this
case the type will only be created at the metadata level, or if
created directly.  The rules for create/drop of
Postgresql enumerated types have been highly reworked in general.
fixes #3319
2015-03-11 11:41:52 -04:00
Mike Bayer 7ac81f6d0a Merge branch 'postgres-concurrently' of https://bitbucket.org/iurisilvio/sqlalchemy into pr45 2015-03-10 15:00:21 -04:00
Mike Bayer cfb2eee0f3 - add a skip for JSONB on pg8000 if we are on 1.10.1 or earlier 2015-03-02 19:16:37 -05:00
Mike Bayer d140983148 Merge remote-tracking branch 'origin/pr/132' into pr132 2015-03-02 19:00:19 -05:00
Iuri de Silvio 955576fcf6 Dialect option postgresql_concurrently to Index construct. 2015-02-25 21:05:31 -03: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 f5ff86983f - The :meth:.Operators.match operator is now handled such that the
return type is not strictly assumed to be boolean; it now
returns a :class:`.Boolean` subclass called :class:`.MatchType`.
The type will still produce boolean behavior when used in Python
expressions, however the dialect can override its behavior at
result time.  In the case of MySQL, while the MATCH operator
is typically used in a boolean context within an expression,
if one actually queries for the value of a match expression, a
floating point value is returned; this value is not compatible
with SQLAlchemy's C-based boolean processor, so MySQL's result-set
behavior now follows that of the :class:`.Float` type.
A new operator object ``notmatch_op`` is also added to better allow
dialects to define the negation of a match operation.
fixes #3263
2014-12-04 18:29:56 -05:00
Mike Bayer 87bfcf91e9 - The :meth:.PGDialect.has_table method will now query against
``pg_catalog.pg_table_is_visible(c.oid)``, rather than testing
for an exact schema match, when the schema name is None; this
so that the method will also illustrate that temporary tables
are present.  Note that this is a behavioral change, as Postgresql
allows a non-temporary table to silently overwrite an existing
temporary table of the same name, so this changes the behavior
of ``checkfirst`` in that unusual scenario.
fixes #3264
2014-12-04 12:01:19 -05:00
Mike Bayer b510b99094 - use provide_metadata for new unique constraint / index tests
- add a test for PG reflection of unique index without any unique
constraint
- for PG, don't include 'duplicates_constraint' in the entry
if the index does not actually mirror a constraint
- use a distinct method for unique constraint reflection within table
- catch unique constraint not implemented condition; this may
be within some dialects and also is expected to be supported by
Alembic tests
- migration + changelogs for #3184
- add individual doc notes as well to MySQL, Postgreql
fixes #3184
2014-10-04 19:06:35 -04:00
Johannes Erdfelt 7fa21b2298 Reflect unique constraints when reflecting a Table object
Calls to reflect a table did not create any UniqueConstraint objects.
The reflection core made no calls to get_unique_constraints and as
a result, the sqlite dialect would never reflect any unique constraints.

MySQL transparently converts unique constraints into unique indexes, but
SQLAlchemy would reflect those as an Index object and as a
UniqueConstraint. The reflection core will now deduplicate the unique
constraints.

PostgreSQL would reflect unique constraints as an Index object and as
a UniqueConstraint object. The reflection core will now deduplicate
the unique indexes.
2014-09-17 13:19:50 -07:00
Mike Bayer be57def4b9 - repair get_foreign_table_names() for PGInsp/dialect level
- repair get_view_names()
- changelog + migration note
2014-09-17 13:11:22 -04:00
Mike Bayer 414bc1c64d - the actual round trip requires password authent set up for the user;
we don't actually need a round trip test here as we're only testing reflection.
2014-09-17 12:41:08 -04:00
Mike Bayer 8546153d5d - break out and fix tests for materialized view and foreign tables. foreign tables not working 2014-09-16 17:24:34 -04:00
Mike Bayer ecda5429af Merge remote-tracking branch 'origin/pr/128' into pr128 2014-09-16 16:55:05 -04:00
Rodrigo Menezes fd2faa9bc2 Added documentation. Changed my mind - added get_foreign_table_names() only to PGInspect and not in the Dialect. Added tests for PGInspect and removed a bunch of the old test scaffolding. 2014-09-05 13:54:48 -04:00
Rodrigo Menezes fbd2d70a5c Fixing some pep8s and adding get_foreign_tables. 2014-09-03 16:38:43 -04:00
Mike Bayer 7c6a45c480 - The :func:~.expression.column and :func:~.expression.table
constructs are now importable from the "from sqlalchemy" namespace,
just like every other Core construct.
- The implicit conversion of strings to :func:`.text` constructs
when passed to most builder methods of :func:`.select` as
well as :class:`.Query` now emits a warning with just the
plain string sent.   The textual conversion still proceeds normally,
however.  The only method that accepts a string without a warning
are the "label reference" methods like order_by(), group_by();
these functions will now at compile time attempt to resolve a single
string argument to a column or label expression present in the
selectable; if none is located, the expression still renders, but
you get the warning again. The rationale here is that the implicit
conversion from string to text is more unexpected than not these days,
and it is better that the user send more direction to the Core / ORM
when passing a raw string as to what direction should be taken.
Core/ORM tutorials have been updated to go more in depth as to how text
is handled.
fixes #2992
2014-09-01 20:19:54 -04:00
Rodrigo Menezes b3f7cd8bf4 Merge branch 'master' of https://github.com/zzzeek/sqlalchemy into feature/postgres-relkind 2014-08-26 12:57:00 -04:00
Rodrigo Menezes 2f7dce1d6f Removed all mentions to postgresql_relkind 2014-08-26 12:53:34 -04:00
Mike Bayer b490534657 - pep8 formatting for pg table opts feature, tests
- add support for PG INHERITS
- fix mis-named tests
- changelog
fixes #2051
2014-08-23 15:21:16 -04:00
Malik Diarra 9eacc8d42a Correcting options name from withoids to with_oids 2014-08-17 02:48:21 +02:00
Malik Diarra 8e03430acd quoting tablespace name in create table command in postgresql dialect 2014-08-17 01:56:02 +02:00
Malik Diarra d6873904c4 Adding oids and on_commit table options 2014-08-17 01:56:02 +02:00
Malik Diarra ef6042ff46 Adding a tablespace options for postgresql create table 2014-08-17 01:56:02 +02:00
Rodrigo Menezes 8af9c7670e Merge branch 'master' of https://github.com/rclmenezes/sqlalchemy 2014-08-14 17:08:55 -04:00
Rodrigo Menezes 649f06759d Added support for postgres_relkind. 2014-08-14 14:47:23 -04:00
Mike Bayer f39767ad72 - public method name is get_enums()
- return a list of dicts like other methods do
- don't combine 'schema' with 'name', leave them separate
- support '*' argument so that we can retrieve cross-schema
if needed
- remove "conn" argument
- use bound parameters for 'schema' in SQL
- order by schema, name, label
- adapt _load_enums changes to column reflection
- changelog
- module docs for get_enums()
- add drop of enums to --dropfirst
2014-08-13 17:42:33 -04:00
Ilya Pekelny a0e0f4c289 Public inspector method to load enum list
Provide opportunity to get enums list via an inspector instance public
interface.
2014-08-08 10:05:30 +03:00
Mike Bayer 3c6ff6adae -Fixed bug where Postgresql JSON type was not able to persist or
otherwise render a SQL NULL column value, rather than a JSON-encoded
``'null'``.  To support this case, changes are as follows:

* The value :func:`.null` can now be specified, which will always
  result in a NULL value resulting in the statement.

* A new parameter :paramref:`.JSON.none_as_null` is added, which
  when True indicates that the Python ``None`` value should be
  peristed as SQL NULL, rather than JSON-encoded ``'null'``.

Retrival of NULL as None is also repaired for DBAPIs other than
psycopg2, namely pg8000.

fixes #3159
2014-08-07 10:43:55 -04: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