Commit Graph

2415 Commits

Author SHA1 Message Date
Mike Bayer bee34dfcd6 - a change to the previous __mapper_args__ commit.
- the __mapper_args__ dict is copied when propagating to a subclass,
and is taken straight off the class __dict__ to avoid any
propagation from the parent.  mapper inheritance already
propagates the things you want from the parent mapper.
[ticket:1393]
2010-02-23 00:57:08 +00:00
Mike Bayer c2060e8943 - the __mapper_args__ dict is copied when propagating to a subclass.
Still need to decide how the argument propagation should
work in the bigger picture.  [ticket:1393]
2010-02-23 00:39:35 +00:00
Mike Bayer 733d8e593a - session.merge() will not expire existing scalar attributes
on an existing target if the target has a value for that
attribute, even if the incoming merged doesn't have
a value for the attribute.  This prevents unnecessary loads
on existing items.  Will still mark the attr as expired
if the destination doesn't have the attr, though, which
fulfills some contracts of deferred cols.  [ticket:1681]

- session.merge() works with relations that specifically
don't include "merge" in their cascade options - the target
is ignored completely.
2010-02-23 00:35:56 +00:00
Michael Trier 2a1eca4bbc Changed the py-postgresql dialect to indicate that it is using the pyformat parameter style. 2010-02-23 00:27:37 +00:00
Mike Bayer 9f020d3ba3 - The "allow_null_pks" flag is now called "allow_partial_pks",
defaults to True, acts like it did in 0.5 again.  Except,
it also is implemented within merge() such that a SELECT
won't be issued for an incoming instance with partially
NULL primary key if the flag is False.  [ticket:1680]
2010-02-22 23:53:35 +00:00
Michael Trier e3ffcf82ce The py-postgresql dialect supports raw python. 2010-02-22 22:54:35 +00:00
Mike Bayer 75c5c0322f - DeclarativeMeta exclusively uses cls.__dict__ (not dict_)
as the source of class information; _as_declarative exclusively
uses the  dict_ passed to it as the source of class information
(which when using DeclarativeMeta is cls.__dict__).  This should
in theory make it easier for custom metaclasses to modify
the state passed into _as_declarative.
2010-02-22 22:31:49 +00:00
Michael Trier c6dd43b252 Found another float / Decimal issue that needs to be changed to be consistent on Python2/3. 2010-02-22 22:10:28 +00:00
Mike Bayer c8e8d77fdc - added util.portable_instancemethod to provide a quick way to make an instancemethod "serializable"
- SchemaType and subclasses Boolean, Enum are now serializable,
including their ddl listener and other event callables.
[ticket:1694] [ticket:1698]
- AddConstraint/DropConstraint use the wrapper for _create_rule
- added test coverage for AddConstraint override of _create_rule
2010-02-22 20:37:44 +00:00
Mike Bayer 4460f998e3 - Composite PK table on InnoDB where the "autoincrement" column
isn't first will emit an explicit "KEY" phrase within
CREATE TABLE thereby avoiding errors, [ticket:1496]
2010-02-22 19:28:25 +00:00
Michael Trier 055ac80eb2 Fixed native unicode test to work with pypostgresql. 2010-02-22 19:03:44 +00:00
Michael Trier 19e85665e4 Python 3 changes the round to return a Decimal not a float. 2010-02-22 17:08:30 +00:00
Mike Bayer 154f5a9434 generalized "test all the picklers" iterator works cross platform 2010-02-22 16:35:35 +00:00
Mike Bayer 03bcdb5bfb increase the timeout here to accommodate slowness on the buildbot 2010-02-22 16:17:57 +00:00
Mike Bayer b3f1513eaf clean up some skips, added skip for sqlite + python2 2010-02-21 21:26:11 +00:00
Michael Trier 8c0567ea83 Fixed cPickle problem in Python3. 2010-02-20 23:08:18 +00:00
Mike Bayer 20d6baa09f more py3k fixes 2010-02-20 23:02:08 +00:00
Mike Bayer 0ee04dfcb0 another weird nose + py3k fix 2010-02-20 20:16:18 +00:00
Mike Bayer 874bd42726 callcounts 2010-02-16 23:42:06 +00:00
Mike Bayer 1f7e0c069c - Fixed cascade bug in many-to-one relation() when attribute
was set to None, introduced in r6711 (cascade deleted
items into session during add()).
2010-02-16 23:33:20 +00:00
Mike Bayer ebe7f7b15e - A change to the solution for [ticket:1579] - an end-user
defined bind parameter name that directly conflicts with
a column-named bind generated directly from the SET or
VALUES clause of an update/insert generates a compile error.
This reduces call counts and eliminates some cases where
undesirable name conflicts could still occur.
2010-02-16 19:47:54 +00:00
Mike Bayer 95096847d8 get tests to pass for OurSQL 2010-02-15 23:59:42 +00:00
Mike Bayer 029a6aaadd pg8000 doesn't seem to support this either 2010-02-15 23:39:39 +00:00
Mike Bayer 739b7b0c25 some more 2.4 test fixes 2010-02-15 22:37:37 +00:00
Mike Bayer 23735fd8e1 2.6.4 has higher numbers for some reason here 2010-02-15 21:33:08 +00:00
Mike Bayer e0215c12d7 2.4 fix 2010-02-15 19:17:09 +00:00
Mike Bayer 7eeb1412d3 exclude this test for everyone but sqlite 2010-02-15 19:09:21 +00:00
Mike Bayer 563972b0ff update call counts 2010-02-15 18:59:21 +00:00
Mike Bayer b5c4bf2e4c more cleanup 2010-02-15 00:26:04 +00:00
Mike Bayer a83f643c81 Gave the "state" internals a good solid
cleanup with less complexity, datamembers,
method calls, blank dictionary creates.
2010-02-14 23:43:40 +00:00
Mike Bayer 6a935a0e27 - Further fixes for the mysql-connector dialect. [ticket:1668] 2010-02-14 20:24:15 +00:00
Mike Bayer 4e9a2307a7 - query.one() no longer applies LIMIT to the query, this to
ensure that it fully counts all object identities present
in the result, even in the case where joins may conceal
multiple identities for two or more rows.  As a bonus,
one() can now also be called with a query that issued
from_statement() to start with since it no longer modifies
the query.  [ticket:1688]
2010-02-14 19:23:35 +00:00
Gaëtan de Menten 165609a190 - Added an optional C extension to speed up the sql layer by
reimplementing the highest impact functions.
  The actual speedups will depend heavily on your DBAPI and
  the mix of datatypes used in your tables, and can vary from
  a 50% improvement to more than 200%. It also provides a modest
  (~20%) indirect improvement to ORM speed for large queries.
  Note that it is *not* built/installed by default.
  See README for installation instructions.

- The most common result processors conversion function were
  moved to the new "processors" module.  Dialect authors are
  encouraged to use those functions whenever they correspond
  to their needs instead of implementing custom ones.
2010-02-13 22:53:39 +00:00
Mike Bayer aedcd6aea6 - reduced a bit of overhead in attribute expiration, particularly
the version called by column loaders on an incomplete row (i.e.
joined table inheritance).  there are more dramatic changes
that can be made here but this one is conservative so far
as far as how much we're altering how InstanceState tracks
"expired" attributes.
2010-02-13 21:16:08 +00:00
Gaëtan de Menten f4573f73d0 misc cleanups in tests (courtesy of Michael Bayer's revisiting of my
patch)
2010-02-13 20:53:17 +00:00
Mike Bayer ffe0ab5ba6 - For those who might use debug logging on
sqlalchemy.orm.strategies, most logging calls during row
loading have been removed.   These were never very helpful
and cluttered up the code.

- Some internal streamlining of object loading grants a
small speedup for large results, estimates are around
10-15%.
2010-02-13 19:27:14 +00:00
Mike Bayer d0d5f79240 - Made sqlalchemy.sql.expressions.Executable part of public
API, used for any expression construct that can be sent to
    execute().  FunctionElement now inherits Executable so that
    it gains execution_options(), which are also propagated
    to the select() that's generated within execute().
    Executable in turn subclasses _Generative which marks
    any ClauseElement that supports the @_generative
    decorator - these may also become "public" for the benefit
    of the compiler extension at some point.
2010-02-12 19:54:49 +00:00
Mike Bayer 85d335b01b - The type/expression system now does a more complete job
of determining the return type from an expression
as well as the adaptation of the Python operator into
a SQL operator, based on the full left/right/operator
of the given expression.  In particular
the date/time/interval system created for Postgresql
EXTRACT in [ticket:1647] has now been generalized into
the type system.   The previous behavior which often
occured of an expression "column + literal" forcing
the type of "literal" to be the same as that of "column"
will now usually not occur - the type of
"literal" is first derived from the Python type of the
literal, assuming standard native Python types + date
types, before falling back to that of the known type
on the other side of the expression.  Also part
of [ticket:1683].
2010-02-11 19:33:06 +00:00
Mike Bayer 44626e9659 - Added "native_datetime=True" flag to create_engine().
This will cause the DATE and TIMESTAMP types to skip
     all bind parameter and result row processing, under
     the assumption that PARSE_DECLTYPES has been enabled
     on the connection.  Note that this is not entirely
     compatible with the "func.current_date()", which
     will be returned as a string. [ticket:1685]
2010-02-11 02:23:32 +00:00
Jason Kirtland e38b11928a Fixed bug in session.merge() blocking dict-like collections from merging. 2010-02-11 00:43:34 +00:00
Jason Kirtland bef9e234de Fix mysql reflection of TINYINT(1) UNSIGNED columns. 2010-02-10 18:32:56 +00:00
Mike Bayer 2d03b08483 - Restored the keys() method to ResultProxy. 2010-02-10 14:55:37 +00:00
Mike Bayer 10b14a6c5c - Fixed reflection bug whereby when COLLATE was present,
nullable flag and server defaults would not be reflected.
[ticket:1655]
2010-02-10 05:46:03 +00:00
Mike Bayer 9deea462a5 - Query called in the context of an expression will render
disambiguating labels in all cases.    Note that this does
not apply to the existing .statement and .subquery()
accessor/method, which still honors the .with_labels()
setting that defaults to False.

- Query.union() retains disambiguating labels within the
returned statement, thus avoiding various SQL composition
errors which can result from column name conflicts.
[ticket:1676]
2010-02-08 18:37:47 +00:00
Mike Bayer 03167fb4bb - Now uses sqlalchemy.orm.exc.DetachedInstanceError when an
attribute load or refresh action fails due to object
being detached from any Session.   UnboundExecutionError
is specific to engines bound to sessions and statements.
2010-02-07 23:58:17 +00:00
Mike Bayer 1c73149d5d - FunctionElement subclasses are now directly executable the
same way any func.foo() construct is, with automatic
SELECT being applied when passed to execute().

- The "type" and "bind" keyword arguments of a func.foo()
construct are now local to "func." constructs and are
not part of the FunctionElement base class, allowing
a "type" to be handled in a custom constructor or
class-level variable.
2010-02-07 00:56:05 +00:00
Mike Bayer b69cbec135 - Slight improvement to the fix for [ticket:1362] to not issue
needless updates of the primary key column during a so-called
"row switch" operation, i.e. add + delete of two objects
with the same PK.
2010-02-05 19:16:10 +00:00
Mike Bayer 15fd2f79b8 - Fixed bug in session.rollback() which involved not removing
formerly "pending" objects from the session before
re-integrating "deleted" objects, typically occured with
natural primary keys. If there was a primary key conflict
between them, the attach of the deleted would fail
internally. The formerly "pending" objects are now expunged
first. [ticket:1674]
2010-02-05 18:12:38 +00:00
Mike Bayer a4a38a982a - Added math negation operator support, -x. 2010-02-05 15:49:02 +00:00
Mike Bayer bde3ceb1d9 the order of rollback()s wasn't correct. slightly disturbing as the test usually passed,
began failing on PG as of somewhat unrelated commit r6705, and only when the full test/engine series
of tests were run.  very heisenbuggy. may want to add tests to assert that TLEngine is enforcing
nesting even with subtransactions.
2010-02-02 23:26:34 +00:00