Commit Graph

272 Commits

Author SHA1 Message Date
Jason Kirtland c194962019 - Undeclared SAWarnings are now fatal to tests as well.
- Fixed typo that was killing runs of individual named tests.
2008-01-12 04:52:05 +00:00
Mike Bayer 05a693fcb7 fixed NOT ILIKE 2008-01-11 21:30:02 +00:00
Mike Bayer 6d2d5e923e - added "ilike()" operator to column operations.
compiles to ILIKE on postgres, lower(x) LIKE lower(y)
on all others [ticket:727]
2008-01-11 21:24:01 +00:00
Jason Kirtland 3e9df22546 Include column name in length-less String warning (more [ticket:912]) 2008-01-10 23:16:56 +00:00
Mike Bayer f1cb136a62 - added a mapper() flag "eager_defaults"; when set to
True, defaults that are generated during an INSERT
or UPDATE operation are post-fetched immediately,
instead of being deferred until later.  This mimics
the old 0.3 behavior.
2008-01-10 22:32:51 +00:00
Jason Kirtland bf36c648f2 Reworked r4042- undeclared deprecation warnings are now *fatal* to tests. No surprises. 2008-01-10 02:37:39 +00:00
Jason Kirtland 84576e3258 test suite deprecation rampage 2008-01-09 22:54:51 +00:00
Jason Kirtland c83bb94e0d Added UnicodeText alias 2008-01-09 20:22:41 +00:00
Mike Bayer eefd1f78a2 redid the _for_ddl String/Text deprecation warning correctly [ticket:912] 2008-01-09 18:09:49 +00:00
Mike Bayer 6eb9c11e7b - fixed bug in union() so that select() statements which don't derive
from FromClause objects can be unioned
2008-01-08 21:53:37 +00:00
Mike Bayer e8feacf1db - fixed an attribute history bug whereby assigning a new collection
to a collection-based attribute which already had pending changes
would generate incorrect history [ticket:922]

- fixed delete-orphan cascade bug whereby setting the same
object twice to a scalar attribute could log it as an orphan
[ticket:925]
- generative select.order_by(None) / group_by(None) was not managing to
reset order by/group by criterion, fixed [ticket:924]
2008-01-07 18:52:02 +00:00
Mike Bayer 64de56e55e fix select tests for labeled functions 2008-01-04 03:09:17 +00:00
Mike Bayer a8b62a02dd - further fix to new TypeDecorator, so that subclasses of TypeDecorators work properly
- _handle_dbapi_exception() usage changed so that unwrapped exceptions can be rethrown with the original stack trace
2008-01-02 01:29:38 +00:00
Mike Bayer 226a95cb4f fix to new TypeDecorator 2008-01-01 01:47:58 +00:00
Mike Bayer 65c618534f fix up oracle handling of LOB/string [ticket:902], slight fixes to defaults.py but we
will need to fix up result-type handling some more
2008-01-01 00:43:24 +00:00
Mike Bayer 267523e4da - sqlite SLDate type will not erroneously render "microseconds" portion
of a datetime or time object when sent to the DB.
2007-12-20 01:45:36 +00:00
Mike Bayer b9b0aca757 - auto-reconnect support improved; a Connection can now automatically
reconnect after its underlying connection is invalidated, without
needing to connect() again from the engine.  This allows an ORM session
bound to a single Connection to not need a reconnect.
Open transactions on the Connection must be rolled back after an invalidation
of the underlying connection else an error is raised.  Also fixed
bug where disconnect detect was not being called for cursor(), rollback(),
or commit().
2007-12-19 19:51:46 +00:00
Mike Bayer df68f30777 get most oracle tests in sql working again.... 2007-12-18 06:13:42 +00:00
Mike Bayer faf4aca165 - cleanup; lambdas removed from properties; properties mirror same-named functions (more like eventual decorator syntax); remove some old methods, factor out some "raiseerr" ugliness to outer lying functions.
- corresponding_column() integrates "require_embedded" flag with other set arithmetic
2007-12-18 05:40:06 +00:00
Mike Bayer f6068a3522 - select().as_scalar() will raise an exception if the select does not have
exactly one expression in its columns clause.
- added "helper exception" to select.type access, generic functions raise
the chance of this happening
- a slight behavioral change to attributes is, del'ing an attribute
does *not* cause the lazyloader of that attribute to fire off again;
the "del" makes the effective value of the attribute "None".  To
re-trigger the "loader" for an attribute, use
session.expire(instance, [attrname]).
- fix ormtutorial for IS NULL
2007-12-18 00:24:03 +00:00
Mike Bayer abc33bd32d - more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads,
in this case when mapped against a select statement [ticket:904]
- _hide_froms logic in expression totally localized to Join class, including search through previous clone sources
- removed "stop_on" from main visitors, not used
- "stop_on" in AbstractClauseProcessor part of constructor, ClauseAdapter sets it up based on given clause
- fixes to is_derived_from() to take previous clone sources into account, Alias takes self + cloned sources into account. this is ultimately what the #904 bug was.
2007-12-16 18:32:25 +00:00
Mike Bayer 8cf05355bb oof...unicode object still needs to return the value if it just warned... 2007-12-14 23:47:33 +00:00
Jason Kirtland f44a7f6ae9 correction... 2007-12-14 10:30:14 +00:00
Mike Bayer 1694e33838 try to bang mysql tests to work 2007-12-14 06:29:31 +00:00
Jason Kirtland 8128a6378a - Removed @testing.supported. Dialects in development or maintained outside
the tree can now run the full suite of tests out of the box.
- Migrated most @supported to @fails_on, @fails_on_everything_but, or (last
  resort) @unsupported.  @fails_on revealed a slew of bogus test skippage,
  which was corrected.
- Added @fails_on_everything_but.  Yes, the first usage *was*
  "fails_on_everything_but('postgres')".  How did you guess!
- Migrated @supported in dialect/* to the new test-class attribute __only_on__.
- Test classes can also have __unsupported_on__ and __excluded_on__.
2007-12-13 09:59:14 +00:00
Lele Gaifax 2522534311 Disabled some tests with INTERSECT, not handled by Firebird 2007-12-12 23:06:22 +00:00
Mike Bayer 41df778985 - more query tests
- trying to refine some of the adaptation stuff
- query.from_statement() wont allow further generative criterion
- added a warning to columncollection when selectable is formed with
conflicting columns (only in the col export phase)
- some method rearrangement on schema/columncollection....
- property conflicting relation warning doesnt raise for concrete
2007-12-10 04:31:17 +00:00
Mike Bayer 5cdb942791 - Query.select_from() now replaces all existing FROM criterion with
the given argument; the previous behavior of constructing a list
of FROM clauses was generally not useful as is required
filter() calls to create join criterion, and new tables introduced
within filter() already add themselves to the FROM clause.  The
new behavior allows not just joins from the main table, but select
statements as well.  Filter criterion, order bys, eager load
clauses will be "aliased" against the given statement.
2007-12-09 23:27:04 +00:00
Mike Bayer c9b3f0bcef - added new methods to TypeDecorator, process_bind_param() and
process_result_value(), which automatically take advantage of the processing
of the underlying type.  Ideal for using with Unicode or Pickletype.
TypeDecorator should now be the primary way to augment the behavior of any
existing type including other TypeDecorator subclasses such as PickleType.
2007-12-08 23:03:22 +00:00
Mike Bayer 8693d4b287 - flush() refactor merged from uow_nontree branch r3871-r3885
- topological.py cleaned up, presents three public facing functions which
return list/tuple based structures, without exposing any internals.  only
the third function returns the "hierarchical" structure.  when results
include "cycles" or "child" items, 2- or 3- tuples are used to represent
results.
- unitofwork uses InstanceState almost exclusively now.  new and deleted lists
are now dicts which ref the actual object to provide a strong ref for the
duration that they're in those lists.  IdentitySet is only used for the public
facing versions of "new" and "deleted".
- unitofwork topological sort no longer uses the "hierarchical" version of the sort
for the base sort, only for the "per-object" secondary sort where it still
helps to group non-dependent operations together and provides expected insert
order.  the default sort deals with UOWTasks in a straight list and is greatly
simplified.  Tests all pass but need to see if svilen's stuff still works,
one block of code in _sort_cyclical_dependencies() seems to not be needed anywhere
but i definitely put it there for a reason at some point; if not hopefully we
can derive more test coverage from that.
- the UOWEventHandler is only applied to object-storing attributes, not
scalar (i.e. column-based) ones.  cuts out a ton of overhead when setting
non-object based attributes.
- InstanceState also used throughout the flush process, i.e. dependency.py,
mapper.save_obj()/delete_obj(), sync.execute() all expect InstanceState objects
in most cases now.
- mapper/property cascade_iterator() takes InstanceState as its argument,
but still returns lists of object instances so that they are not dereferenced.
- a few tricks needed when dealing with InstanceState, i.e. when loading a list
of items that are possibly fresh from the DB, you *have* to get the actual objects
into a strong-referencing datastructure else they fall out of scope immediately.
dependency.py caches lists of dependent objects which it loads now (i.e. history
collections).
- AttributeHistory is gone, replaced by a function that returns a 3-tuple of
added, unchanged, deleted.  these collections still reference the object
instances directly for the strong-referencing reasons mentiontioned, but
it uses less IdentitySet logic to generate.
2007-12-08 18:58:03 +00:00
Mike Bayer 78bb82a44b changed the anonymous numbering scheme to be more appealing
got tests running
2007-12-08 18:38:18 +00:00
Mike Bayer 7bf90e2f4d fix to unique bind params, you *can* use the same unique bindparam multiple times
in a statement.  the collision check is strictly detecting non-unique's that happen to have
the same name.
2007-12-07 16:47:00 +00:00
Mike Bayer 541b6772e9 - generation of "unique" bind parameters has been simplified to use the same
"unique identifier" mechanisms as everything else.  This doesn't affect
user code, except any code that might have been hardcoded against the generated
names.  Generated bind params now have the form "<paramname>_<num>",
whereas before only the second bind of the same name would have this form.

- bindparam() objects themselves can be used as keys for execute(), i.e.
statement.execute({bind1:'foo', bind2:'bar'})
2007-12-06 22:23:10 +00:00
Mike Bayer 594784a206 assert_unicode=True replaced with default of assert_unicode='warn' 2007-12-05 22:21:37 +00:00
Mike Bayer 238c2c8dbe - basic framework for generic functions, [ticket:615]
- changed the various "literal" generation functions to use an anonymous
bind parameter.  not much changes here except their labels now look
like ":param_1", ":param_2" instead of ":literal"
- from_obj keyword argument to select() can be a scalar or a list.
2007-12-05 03:07:21 +00:00
Mike Bayer d56e11ffe2 default value of assert_unicode is None on String, False on create_engine(), and True on Unicode type. 2007-11-28 00:44:16 +00:00
Mike Bayer 3f6e94e818 - column labels in the form "tablename.columname", i.e. with a dot, are now
supported.
2007-11-27 16:57:56 +00:00
Mike Bayer 65abc78010 added a test to validate ResultProxy truncation behavior 2007-11-27 16:13:45 +00:00
Paul Johnston 6753cb7f72 MSSQL doesn't support subqueries in insert values; disable test 2007-11-25 23:36:20 +00:00
Paul Johnston 2c873f0ee4 Fix: test_decimal on MSSQL - use a value that is accurately represented as a float, and make when asdecimal=False, convert Decimal to float 2007-11-25 23:34:39 +00:00
Mike Bayer e4056a1787 - added new flag to String and create_engine(), assert_unicode=(True|False|None).
When convert_unicode=True, this flag also defaults to `True`, and results in all
unicode conversion operations raising an exception when a non-unicode bytestring
is passed as a bind parameter.  It is strongly advised that all unicode-aware
applications make proper use of Python unicode objects (i.e. u'hello' and
not 'hello').
2007-11-25 23:14:03 +00:00
Mike Bayer b6b720609d added self referential test 2007-11-10 14:36:03 +00:00
Mike Bayer ea46e556f9 - anonymous column expressions are automatically labeled.
e.g. select([x* 5]) produces "SELECT x * 5 AS anon_1".
    This allows the labelname to be present in the cursor.description
    which can then be appropriately matched to result-column processing
    rules. (we can't reliably use positional tracking for result-column
    matches since text() expressions may represent multiple columns).

  - operator overloading is now controlled by TypeEngine objects - the
    one built-in operator overload so far is String types overloading
    '+' to be the string concatenation operator.
    User-defined types can also define their own operator overloading
    by overriding the adapt_operator(self, op) method.

  - untyped bind parameters on the right side of a binary expression
    will be assigned the type of the left side of the operation, to better
    enable the appropriate bind parameter processing to take effect
    [ticket:819]
2007-11-10 03:02:16 +00:00
Jason Kirtland 681c8fc51c - mysql float types now do an end run around the base class and respect precision=None and length=None
- Added the mysteriously missing mysql cast support
- Added mysql REAL synonym for schema generation
2007-11-09 19:55:31 +00:00
Mike Bayer 2cbb133567 more changes to traverse-and-clone; a particular element will only be cloned once and is
then re-used.  the FROM calculation of a Select normalizes the list of hide_froms against all
previous incarnations of each FROM clause, using a tag attached from cloned clause to
previous.
2007-11-08 18:06:21 +00:00
Mike Bayer 7a25be0f42 - identified some cases where Alias needs to be cloned; but still cant clone
when its an alias of a Table; added some test coverage for one particular
case from the doctests
- fixed "having" example in doctests, updated eager load example
2007-11-08 00:26:23 +00:00
Mike Bayer 750439ac5f - fixed remainder of [ticket:853]
- bindparam 'shortname' is deprecated
- fixed testing.assert_compile() to actually generate bind param dict before asserting
- added bind param assertions to CRUDTest.test_update
2007-11-07 22:25:01 +00:00
Jason Kirtland bcb586a93c Migrated maxdb behavioral assumptions from unsupported to fails_on 2007-11-05 22:11:30 +00:00
Mike Bayer 00c2077cbc - oid_column proxies more intelligently off of Select, CompoundSelect - fixes platform-affected bugs in missing the correct "oid" column
- locate_all_froms() is expensive; added an attribute-level cache for it
- put a huge warning on all select.append_XXX() methods stating that derived collections like locate_all_froms() may become invalid if
already initialized
2007-11-05 18:30:30 +00:00
Mike Bayer 0e25c2d9e8 - rewrote and simplified the system used to "target" columns across
selectable expressions.  On the SQL side this is represented by the
"corresponding_column()" method. This method is used heavily by the ORM
to "adapt" elements of an expression to similar, aliased expressions,
as well as to target result set columns originally bound to a
table or selectable to an aliased, "corresponding" expression.  The new
rewrite features completely consistent and accurate behavior.
- the "orig_set" and "distance" elements as well as all associated
fanfare are gone (hooray !)
- columns now have an optional "proxies" list which is a list of all
columns they are a "proxy" for; only CompoundSelect cols proxy more than one column
(just like before).  set operations are used to determine lineage.
- CompoundSelects (i.e. unions) only create one public-facing proxy column per
column name.  primary key collections come out with just one column per embedded
PK column.
- made the alias used by eager load limited subquery anonymous.
2007-11-05 00:59:19 +00:00