Commit Graph

109 Commits

Author SHA1 Message Date
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
Jim Phares fde2a7f8fe Informix and postgresql reserved words changes -- almost done. 2011-03-15 16:56:45 -04:00
Mike Bayer 74f26d2279 - Fixed regression from 0.6 where SMALLINT and
BIGINT types would both generate SERIAL
on an integer PK column, instead of
SMALLINT and BIGSERIAL [ticket:2065]
2011-02-17 20:43:17 -05:00
Mike Bayer 2e4da52221 - The Sequence() construct, when passed a MetaData()
object via its 'metadata' argument, will be
included in CREATE/DROP statements within
metadata.create_all() and metadata.drop_all(),
including "checkfirst" logic.  [ticket:2055]
2011-02-13 19:32:00 -05:00
Mike Bayer 33eae4a140 make it more explicit in tests which dialect we want to use for things 2011-02-11 11:24:54 -05:00
Mike Bayer 134a4cb3a6 fix some tests 2011-02-10 23:37:15 -05:00
Mike Bayer 3f9a343d72 - Query.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
  as DISTINCT ON (<expr>). [ticket:1069]
- select.distinct() now accepts column expressions
  as *args, interpreted by the Postgresql dialect
  as DISTINCT ON (<expr>).  Note this was already
  available via passing a list to the `distinct`
  keyword argument to select(). [ticket:1069]
- select.prefix_with() accepts multiple expressions
  (i.e. *expr), 'prefix' keyword argument to select()
  accepts a list or tuple.
- Passing a string to the `distinct` keyword argument
  of `select()` for the purpose of emitting special
  MySQL keywords (DISTINCTROW etc.) is deprecated -
  use `prefix_with()` for this.
- put kw arguments to select() in order
- restore docs for _SelectBase, renamed from _SelectBaseMixin
2011-02-10 14:17:08 -05:00
Mike Bayer 7e8f351097 - Non-DBAPI errors which occur in the scope of an execute()
call are now wrapped in sqlalchemy.exc.StatementError,
and the text of the SQL statement and repr() of params
is included.  This makes it easier to identify statement
executions which fail before the DBAPI becomes
involved.  [ticket:2015]
2011-02-09 18:11:40 -05:00
Mike Bayer d5cc2f83c1 - When explicit sequence execution derives the name
of the auto-generated sequence of a SERIAL column,
which currently only occurs if implicit_returning=False,
now accommodates if the table + column name is greater
than 63 characters using the same logic Postgresql uses.
[ticket:1083]
2011-02-04 17:37:36 -05:00
Mike Bayer aa62a3a833 - factor consistent set_isolation_level(), get_isolation_level()
per-connection methods for sqlite, postgresql, psycopg2 dialects
- move isolation test suite to test engines/test_transaction
- preparing for [ticket:2001]
2011-01-16 13:05:18 -05:00
Mike Bayer fc0ffac241 stupid workaround for pg8000 2011-01-15 13:49:39 -05:00
Mike Bayer 75b5236e69 - the _pk_processors/_prefetch_processors approach relied upon calling RPs without a cursor.description
result, also generates procs that are not used in most cases.  simplify the approach
by passing type to _exec_default() to be used if needed by _execute_scalar(),
looking for the proc on just t._autoincrement_column in post_insert().
2011-01-15 11:53:37 -05:00