Commit Graph

2762 Commits

Author SHA1 Message Date
Mike Bayer dabe38bf56 - Changed the scheme used to generate truncated
"auto" index names when using the "index=True"
flag on Column.   The truncation only takes
place with the auto-generated name, not one
that is user-defined (an error would be
raised instead), and the truncation scheme
itself is now based on a fragment of an md5
hash of the identifier name, so that multiple
indexes on columns with similar names still
have unique names.  [ticket:1855]
2010-07-21 11:33:47 -04:00
Mike Bayer 2bd3c795cf - Column-entities (i.e. query(Foo.id)) copy their
state more fully when queries are derived from
themselves + a selectable (i.e. from_self(),
union(), etc.), so that join() and such have the
correct state to work from.  [ticket:1853]

- Fixed bug where Query.join() would fail if
querying a non-ORM column then joining without
an on clause when a FROM clause is already
present, now raises a checked exception the
same way it does when the clause is not
present.  [ticket:1853]
2010-07-15 09:59:17 -04:00
Mike Bayer 10db67be5b - More tweaks to cx_oracle Decimal handling.
"Ambiguous" numerics with no decimal place
are coerced to int at the connection handler
level.  The advantage here is that ints
come back as ints without SQLA type
objects being involved and without needless
conversion to Decimal first.

Unfortunately, some exotic subquery cases
can even see different types between
individual result rows, so the Numeric
handler, when instructed to return Decimal,
can't take full advantage of "native decimal"
mode and must run isinstance() on every value
to check if its Decimal already. Reopen of
[ticket:1840]
2010-07-14 14:50:45 -04:00
Mike Bayer ccafaab200 restore py2k directive that got whacked by python tidy 2010-07-13 20:40:58 -04:00
Mike Bayer e430aa915f test/dialect 2010-07-11 14:28:21 -04:00
Mike Bayer f2b43da1a8 tidy test/base, test/ex, test/ext 2010-07-11 13:41:38 -04:00
Mike Bayer a6b62cc3fe Python-tidy test/engine and test/aaa_profiling, 80% auto + 20% manual intervention 2010-07-11 13:15:51 -04:00
Mike Bayer 5cce6bf2a8 - experimenting with pytidy with mods as a textmate plugin along
the path to 78 chars.   eh
2010-07-10 14:50:13 -04:00
Mike Bayer 5f68031d15 - added "expr" to the column descriptions accessor, this is
an expression that matches on identity the original expression
passed to the query.  In particular you can pass it into order_by()
and similar.
2010-07-08 18:17:23 -04:00
Mike Bayer 85651a964c - 78 chars
- Added "column_descriptions" accessor to Query,
returns a list of dictionaries containing
naming/typing information about the entities
the Query will return.  Can be helpful for
building GUIs on top of ORM queries.
2010-07-08 14:13:56 -04:00
Mike Bayer 50176cf290 added an extra check for the correct class when __init__ is called,
to fix the second half of [ticket:1846]
2010-07-08 10:50:13 -04:00
Mike Bayer d559f9fc94 - Improved the check for an "unmapped class",
including the case where the superclass is mapped
but the subclass is not.  Any attempts to access
cls._sa_class_manager.mapper now raise
UnmappedClassError().  [ticket:1142]
2010-07-08 10:16:13 -04:00
Mike Bayer 91ad6902c5 - Removed errant many-to-many load in unitofwork
which triggered unnecessarily on expired/unloaded
collections. This load now takes place only if
passive_updates is False and the parent primary
key has changed, or if passive_deletes is False
and a delete of the parent has occurred.
[ticket:1845]
2010-07-07 12:01:02 -04:00
Mike Bayer 1efc6b9e77 78 chars 2010-07-07 10:20:43 -04:00
Mike Bayer 7e72edc9d3 - updated obsolete docs regarding sequences, RETURNING for pg
- 78 chars for postgresql/base.py, engine/default.py
2010-07-06 17:39:20 -04:00
Mike Bayer 43dbfccf4d up the variance on these as the call counts are very low and
things wiggle around even between 2.6.4/2.6.5
2010-07-06 17:09:42 -04:00
Mike Bayer a9f2ed7b46 - latest distribute
- added caveats to unittest README encountered with Py2.7 + current nose 0.11.3
- call counts for py2.7.   all tests pass for sqlite + mysql-python + psycopg2
2010-07-05 19:54:46 -04:00
Mike Bayer d6614c63b2 transfer docstrings from @classproperty to props 2010-07-04 12:06:19 -04:00
Mike Bayer 55ae7d7842 - Added support for @classproperty to provide
any kind of schema/mapping construct from a
declarative mixin, including columns with foreign
keys, relationships, column_property, deferred.
This solves all such issues on declarative mixins.
An error is raised if any MapperProperty subclass
is specified on a mixin without using @classproperty.
[ticket:1751] [ticket:1796] [ticket:1805]

- un-anglicized the declarative docs
2010-07-03 14:53:37 -04:00
Mike Bayer 0025a6a50e - The 'default' compiler is automatically copied over
when overriding the compilation of a built in
clause construct, so no KeyError is raised if the
user-defined compiler is specific to certain
backends and compilation for a different backend
is invoked. [ticket:1838]
2010-07-02 14:07:42 -04:00
Mike Bayer 8548ca8cc5 - add typing/operator converts to Float/Numeric to get Oracle tests going again,
as we have an unusually high level of dependence on SQLA typing now
- force oracle seqs to return integers
2010-07-02 13:55:24 -04:00
Mike Bayer 64d92c836c - If server_version_info is outside the usual
range of (8, ), (9, ), (10, ), a warning is emitted
which suggests checking that the FreeTDS version
configuration is using 7.0 or 8.0, not 4.2.
[ticket:1825]
2010-07-02 12:57:15 -04:00
Chris Withers 3c56bfde95 keep ordering of columns with mixins constant 2010-07-02 14:57:19 +01:00
Mike Bayer 87f3344881 - Query.join() will check for a call of the
form query.join(target, clause_expression),
i.e. missing the tuple, and raise an informative
error message that this is the wrong calling form.
2010-07-01 20:50:57 -04:00
Mike Bayer 25db56bc0c - Oracle's "native decimal" metadata begins to return
ambiguous typing information about numerics
    when columns are embedded in subqueries as well
    as when ROWNUM is consulted with subqueries, as we
    do for limit/offset.  We've added these ambiguous
    conditions to the cx_oracle "convert to Decimal()"
    handler, so that we receive numerics as Decimal
    in more cases instead of as floats.  These are
    then converted, if requested, into Integer
    or Float, or otherwise kept as the lossless
    Decimal [ticket:1840].
2010-07-01 16:57:02 -04:00
Mike Bayer 005d045350 - An instance which is moved to "transient", has
an incomplete or missing set of primary key
attributes, and contains expired attributes, will
raise an InvalidRequestError if an expired attribute
is accessed, instead of getting a recursion overflow.

- make_transient() removes all "loader" callables from
the state being made transient, removing any
"expired" state - all unloaded attributes reset back
to undefined, None/empty on access.
2010-06-30 16:12:32 -04:00
Mike Bayer 5095369ce8 fix oracle char length test for newer descriptors 2010-06-27 13:05:05 -04:00
Mike Bayer 29eb88eefb - Fixed bug that would prevent overridden clause
compilation from working for "annotated" expression
elements, which are often generated by the ORM.
2010-06-26 17:20:17 -04:00
Mike Bayer 3eab798253 - Won't generate "CREATE TYPE" / "DROP TYPE" if
using types.Enum on a PG version prior to 8.3 -
the supports_native_enum flag is fully
honored.  [ticket:1836]
2010-06-25 13:11:06 -04:00
Mike Bayer 7dcfc49b34 fix test 2010-06-24 12:45:37 -04:00
Mike Bayer 87664ce88a - The argument to "ESCAPE" of a LIKE operator or similar
is passed through render_literal_value(), which may
implement escaping of backslashes.  [ticket:1400]
- Postgresql render_literal_value() is overridden which escapes
backslashes, currently applies to the ESCAPE clause
of LIKE and similar expressions.
Ultimately this will have to detect the value of
"standard_conforming_strings" for full behavior.
[ticket:1400]
- MySQL render_literal_value() is overridden which escapes
backslashes, currently applies to the ESCAPE clause
of LIKE and similar expressions.   This behavior
is derived from detecting the value of
NO_BACKSLASH_ESCAPES.  [ticket:1400]
2010-06-24 12:19:15 -04:00
Mike Bayer 0adf381d99 - Fixed @memoized_property and @memoized_instancemethod
decorators so that Sphinx documentation picks up
these attributes and methods, such as
ResultProxy.inserted_primary_key. [ticket:1830]
2010-06-19 14:08:20 -04:00
Mike Bayer 77c3bb26c2 - Firebird dialect adds CHAR, VARCHAR types which
accept a "charset" flag, to support Firebird
"CHARACTER SET" clause.  [ticket:1813]
2010-06-19 13:51:55 -04:00
Mike Bayer 6457901f96 - Fixed ora-8 compatibility flags such that they
don't cache a stale value from before the first
database connection actually occurs. [ticket:1819]
2010-06-19 13:39:32 -04:00
Mike Bayer 6de7db07ce - a mixin class can now define a column that matches
one which is present on a __table__ defined on a
subclass.  It cannot, however, define one that is
not present in the __table__, and the error message
here now works.  [ticket:1821]
2010-06-19 13:25:37 -04:00
Mike Bayer 17073a0155 - MySQL dialect doesn't emit CAST() for MySQL version
detected < 4.0.2.  This allows the unicode
check on connect to proceed. [ticket:1826]
2010-06-19 13:21:19 -04:00
Mike Bayer fc7674bcc8 - moved "post update" functionality from _save_obj() into
its own method, which also groups updates into executemanys.
[ticket:1831]
2010-06-18 19:12:52 -04:00
Mike Bayer f272783f27 - cleanup of new post update, changelog 2010-06-18 15:42:01 -04:00
Mike Bayer 23d1f39ca7 add a test for the actual feature, that multiple post updates are batched 2010-06-18 15:11:32 -04:00
Mike Bayer 41cf0a7ac8 this one is actually doing it. removed the cruft we don't need from the old approach.
not sure if one-to-many with elaborate self-refs, etc., but we appear to be
as good as we were before.
2010-06-18 13:31:51 -04:00
Mike Bayer 1baca89084 adds some tests, refines out the m2o approach. 2010-06-18 13:11:19 -04:00
Mike Bayer 0276ec0cd8 - query.order_by() now accepts False, which cancels
any existing order_by() state on the Query, allowing
subsequent generative methods to be called which do
not support ORDER BY.  This is not the same as the
already existing feature of passing None, which
suppresses any existing order_by() settings, including
those configured on the mapper.  False will make it
as though order_by() was never called, while
None is an active setting.
2010-06-17 15:53:07 -04:00
Mike Bayer 89676b2452 add a test for query.order_by(None) 2010-06-17 10:13:23 -04:00
Mike Bayer a8e53a4f31 - Column.copy() takes along the "unique" attribute
among others, fixes [ticket:1829] regarding declarative
mixins
2010-06-15 17:56:17 -04:00
Mike Bayer c5ed8dfd8d version_info is the tuple 2010-06-15 14:05:02 -04:00
Mike Bayer 27b9b3578d - Can now call make_transient() on an instance that
is referenced by parent objects via many-to-one,
without the parent's foreign key value getting
temporarily set to None - this was a function
of the "detect primary key switch" flush handler.
It now ignores objects that are no longer
in the "persistent" state, and the parent's
foreign key identifier is left unaffected.
2010-06-15 14:04:13 -04:00
Mike Bayer 1769b2d8de - hypothesize that newer pysqlites are also growing a warning log on non-unicdoe strings 2010-06-14 20:15:27 -04:00
Mike Bayer 7a554d5267 - Query.statement, Query.subquery(), etc. now transfer
the values of bind parameters, i.e. those specified
by query.params(), into the resulting SQL expression.
Previously the values would not be transferred
and bind parameters would come out as None.

- Subquery-eager-loading now works with Query objects
which include params(), as well as get() Queries.
2010-06-14 20:07:44 -04:00
Mike Bayer 33f6dcc80b - Modified the internals of "column annotation" such that
a custom Column subclass can safely override
_constructor to return Column, for the purposes of
making "configurational" column classes that aren't
involved in proxying, etc.
2010-06-14 19:39:26 -04:00
Mike Bayer 92599bfec6 - Fixed bug regarding flushes on self-referential
bi-directional many-to-many relationships, where
two objects made to mutually reference each other
in one flush would fail to insert a row for both
sides.  Regression from 0.5. [ticket:1824]
2010-06-13 16:25:26 -04:00