Commit Graph

120 Commits

Author SHA1 Message Date
Audrius Kažukauskas dbdf4f25e2 Add ANY/ALL construct support for PostgreSQL's ARRAY type 2013-01-28 19:58:06 +02:00
Mike Bayer 2244c3febe - "postgres_where" has been removed 2013-01-16 23:53:00 -05:00
Mike Bayer a94f2f81af Fixed bug in :func:.postgresql.array construct whereby using it
inside of an :func:`.expression.insert` construct would produce an
error regarding a parameter issue in the ``self_group()`` method.
2013-01-02 11:26:37 -05:00
Mike Bayer 927b985983 - multivalued inserts, [ticket:2623]
- update "not supported" messages for empty inserts, mutlivalue inserts

- rework the ValuesBase approach for multiple value sets so that stmt.parameters
does store a list for multiple values; the _has_multiple_parameters flag now indicates
which of the two modes the statement is within.  it now raises exceptions if a subsequent
call to values() attempts to call a ValuesBase with one mode in the style of the other
mode; that is, you can't switch a single- or multi- valued ValuesBase to the other mode,
and also if a multiple value is passed simultaneously with a kwargs set.
Added tests for these error conditions

- Calling values() multiple times in multivalue mode now extends the parameter list to
include the new parameter sets.

- add error/test if multiple *args were passed to ValuesBase.values()

- rework the compiler approach for multivalue inserts, back to where
_get_colparams() returns the same list of (column, value) as before, thereby
maintaining the identical number of append() and other calls when multivalue
is not enabled.  In the case of multivalue, it makes a last-minute switch to return
a list of lists instead of the single list.  As it constructs the additional lists, the inline
defaults and other calculated default parameters of the first parameter
set are copied into the newly generated lists so that these features continue
to function for a multivalue insert.   Multivalue inserts now add no additional
function calls to the compilation for regular insert constructs.

- parameter lists for multivalue inserts now includes an integer index for all
parameter sets.

- add detailed documentation for ValuesBase.values(), including careful wording
to describe the difference between multiple values and an executemany() call.

- add a test for multivalue insert + returning - it works !

- remove the very old/never used "postgresql_returning"/"firebird_returning" flags.
2012-12-08 14:25:42 -05:00
Audrius Kažukauskas 64505dcd28 HSTORE.comparator_factory should subclass Concatenable.Comparator 2012-11-21 00:26:20 +02:00
Audrius Kažukauskas 8134f2d0bf Add special containment operation methods for PG array type 2012-11-20 23:24:34 +02:00
Mike Bayer d1adef463a another hide from 2to3 test 2012-11-18 13:34:25 -05:00
Mike Bayer 1e29a74bd6 Fixed a gotcha where inadvertently calling list() on a
:class:`.ColumnElement` would go into an endless loop, if
      :meth:`.ColumnOperators.__getitem__` were implemented.
      A new NotImplementedError is emitted via ``__iter__()``.
2012-11-18 10:38:02 -05:00
Mike Bayer cda08307be - hstore documentation, migration
- don't need a custom exception here, just use ValueError
2012-11-17 22:58:23 -05:00
Mike Bayer 4356741c48 - hstore adjustments 2012-11-17 20:45:17 -05:00
Audrius Kažukauskas 812b1d8614 Add PostgreSQL HStore type support 2012-11-13 16:43:41 +02:00
Mike Bayer bd48c8a9ec pg and oracle fixes 2012-09-30 01:02:56 -04:00
Mike Bayer 20cdc64588 trying different approaches to test layout. in this one, the testing modules
become an externally usable package but still remains within the main sqlalchemy parent package.
in this system, we use kind of an ugly hack to get the noseplugin imported outside of the
"sqlalchemy" package, while still making it available within sqlalchemy for usage by
third party libraries.
2012-09-27 02:37:33 -04:00
Mike Bayer e1d09859c5 - [bug] Columns in reflected primary key constraint
are now returned in the order in which the constraint
    itself defines them, rather than how the table
    orders them.  Courtesy Gunnlaugur Por Briem.
    [ticket:2531].
2012-09-23 13:42:24 -04:00
Mike Bayer 6a3e993490 - genericize the test for ischema_names
- some fixes to the patch to handle empty args, whitespace
- changelog clarifies where this API fits at the moment
2012-09-16 17:43:21 -04:00
Éric Lemoine 3a1cc85b20 breaking up PGDialect.get_columns, and add PostGIS column reflection tests 2012-09-12 08:55:10 +02:00
Hong Minhee 4acf7df4f5 Add a version test for EnterpriseDB 2012-08-31 07:49:01 +09:00
Mike Bayer 2ccd77e5dc - [feature] The Query.update() method is now
more lenient as to the table
being updated.  Plain Table objects are better
supported now, and additional a joined-inheritance
subclass may be used with update(); the subclass
table will be the target of the update,
and if the parent table is referenced in the
WHERE clause, the compiler will call upon
UPDATE..FROM syntax as allowed by the dialect
to satisfy the WHERE clause.  Target columns
must still be in the target table i.e.
does not support MySQL's multi-table update
feature (even though this is in Core).
PG's DELETE..USING is also not available
in Core yet.
2012-08-20 18:18:17 -04:00
Mike Bayer aef0c7a903 - [feature] The Core oeprator system now includes
the `getitem` operator, i.e. the bracket
operator in Python.  This is used at first
to provide index and slice behavior to the
Postgresql ARRAY type, and also provides a hook
for end-user definition of custom __getitem__
schemes which can be applied at the type
level as well as within ORM-level custom
operator schemes.

Note that this change has the effect that
descriptor-based __getitem__ schemes used by
the ORM in conjunction with synonym() or other
"descriptor-wrapped" schemes will need
to start using a custom comparator in order
to maintain this behavior.

- [feature] postgresql.ARRAY now supports
indexing and slicing.  The Python [] operator
is available on all SQL expressions that are
of type ARRAY; integer or simple slices can be
passed.  The slices can also be used on the
assignment side in the SET clause of an UPDATE
statement by passing them into Update.values();
see the docs for examples.

- [feature] Added new "array literal" construct
postgresql.array().  Basically a "tuple" that
renders as ARRAY[1,2,3].
2012-08-20 17:04:25 -04:00
Mike Bayer 22ba1c43b7 -whitespace bonanza, contd 2012-07-28 17:05:50 -04:00
Mike Bayer d5609d7784 - [feature] Added "MATCH" clause to ForeignKey,
ForeignKeyConstraint, courtesy Ryan Kelly.
[ticket:2502]
- [feature] Added support for DELETE and UPDATE from
an alias of a table, which would assumedly
be related to itself elsewhere in the query,
courtesy Ryan Kelly.  [ticket:2507]
- [feature] Added support for the Postgresql ONLY
keyword, which can appear corresponding to a
table in a SELECT, UPDATE, or DELETE statement.
The phrase is established using with_hint().
Courtesy Ryan Kelly [ticket:2506]
2012-06-21 16:32:38 -04:00
Mike Bayer 197e5ea941 adjust some test exclusions 2012-04-24 20:44:21 -04:00
Mike Bayer cfe56e3735 - [feature] postgresql.ARRAY features an optional
"dimension" argument, will assign a specific
number of dimensions to the array which will
render in DDL as ARRAY[][]..., also improves
performance of bind/result processing.
[ticket:2441]
2012-04-24 16:44:53 -04:00
Mike Bayer f37aa86df8 revert this, bad idea 2012-02-13 19:29:38 -05:00
Mike Bayer 4bbd814fff - [bug] Fixed the "render literal bind" function,
used by Alembic, to escape % signs with %%.
2012-02-13 18:53:21 -05:00
Mike Bayer 09553dc90f - [feature] Dialect-specific compilers now raise
CompileException for all type/statement compilation
issues, instead of InvalidRequestError or ArgumentError.
The DDL for CREATE TABLE will re-raise
CompileExceptions to include table/column information
for the problematic column.  [ticket:2361]
2012-01-28 15:20:21 -05:00
Mike Bayer b854074c6d - [feature] Added create_type constructor argument
to pg.ENUM.  When False, no CREATE/DROP or
checking for the type will be performed as part
of a table create/drop event; only the
create()/drop)() methods called directly
will do this.  Helps with Alembic "offline"
scripts.
2011-11-28 22:28:28 -05:00
Mike Bayer e6a5ea8fa7 - [bug] Postgresql dialect memoizes that an ENUM of a
particular name was processed
during a create/drop sequence.  This allows
a create/drop sequence to work without any
calls to "checkfirst", and also means with
"checkfirst" turned on it only needs to
check for the ENUM once.  [ticket:2311]
2011-10-29 17:38:56 -04:00
Mike Bayer 5397d95365 - Added client_encoding parameter to create_engine()
when the postgresql+psycopg2 dialect is used;
calls the psycopg2 set_client_encoding() method
with the value upon connect.  [ticket:1839]
2011-10-15 15:05:51 -04:00
Mike Bayer 771f6fba4c add a test to confirm alter table of pk column gets reflected 2011-10-04 12:30:23 -04:00
Mike Bayer bf2f3595d0 - Added "postgresql_using" argument to Index(), produces
USING clause to specify index implementation for
    PG.  [ticket:2290].  Thanks to Ryan P. Kelly for
    the patch.
2011-10-02 17:17:46 -04:00
Mike Bayer 843847740c - Reflection functions for Table, Sequence no longer
case insensitive.  Names can be differ only in case
    and will be correctly distinguished.  [ticket:2256]
2011-09-09 17:12:52 -04:00
Mike Bayer 5bc91d48c2 this test only runs for PG 2011-08-12 22:58:46 -04:00
Mike Bayer 8b505e7c24 - Narrowed the assumption made when reflecting
a foreign-key referenced table with schema in
the current search path; an explicit schema will
be applied to the referenced table only if
it actually matches that of the referencing table,
which also has an explicit schema.   Previously
it was assumed that "current" schema was synonymous
with the full search_path.  [ticket:2249]
2011-08-09 19:45:20 -04:00
Mike Bayer 1ae69566cc fix keyword error 2011-07-20 11:09:04 -04:00
Mike Bayer b2d50f2807 - Added new "postgresql_ops" argument to
Index, allows specification of PostgreSQL
    operator classes for indexed columns.
    [ticket:2198]  Courtesy Filip Zyzniewski.
2011-07-20 10:49:36 -04:00
Mike Bayer c0f9221160 - Some unit test fixes regarding numeric arrays,
MATCH operator.   A potential floating-point
inaccuracy issue was fixed, and certain tests
of the MATCH operator only execute within an
EN-oriented locale for now.  [ticket:2175].
Also in 0.6.8.
2011-06-04 20:20:28 -04:00
Mike Bayer ef654af35a - Fixed bug affecting PG 9 whereby index reflection
would fail if against a column whose name
had changed.  [ticket:2141].  Also in 0.6.8.
2011-05-20 17:53:13 -04:00
Philip Jenvey ee2154d994 mark more postgresql+zxjdbc failures 2011-05-11 18:44:23 -07:00
Mike Bayer 6850ba6ac5 - split all SS tests into separate + engine per test + close_all() + dispose within teardown 2011-05-01 00:45:39 -04:00
Philip Jenvey 24e6c56da8 update warnings per zxjdbc 2011-04-23 14:15:08 -07:00
Mike Bayer 55f87348f3 - add test for [ticket:2142] 2011-04-23 15:05:50 -04:00
Mike Bayer c718dea749 - Fixed the psycopg2_version parsing in the
psycopg2 dialect.
2011-04-18 12:38:08 -04:00
Mike Bayer 4dd69ff878 - remove obsolete test regarding PG server side cursors + ORM query, was failing + hanging jenkins 2011-04-17 16:51:04 -04:00
Mike Bayer b462373b46 - REAL has been added to the core types. Supported
by Postgresql, SQL Server, MySQL, SQLite.  Note
that the SQL Server and MySQL versions, which
add extra arguments, are also still available
from those dialects.  [ticket:2081]
2011-04-05 12:40:55 -04:00
Mike Bayer 7b24e458c7 - move all the comments that got shoved below the fixture grabs back up 2011-03-27 17:19:00 -04:00
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00
Mike Bayer ebd0fdad73 - convert @provide_metadata to use self access
- having occasional issues with BasicEntity grabbing, if it persists
may have to pass an explicit base class into setup_classes()/setup_mappers()
2011-03-26 21:40:05 -04:00
Mike Bayer 14a2fae239 - remove @testing.resolve_artifact_names, replace with direct attribute
access to the cls/self.tables/classes registries
- express orm/_base.py ORMTest in terms of engine/_base.py TablesTest,
factor out common steps into TablesTest, remove AltEngineTest as a
separate class.   will further consolidate these base classes
2011-03-26 19:03:11 -04:00
Mike Bayer f75ea6945c - Fixed the BIT type to allow a "length" parameter, "varying"
parameter.  Reflection also fixed.  [ticket:2073]
2011-03-16 11:01:20 -04:00