Commit Graph

2307 Commits

Author SHA1 Message Date
Mike Bayer 23c744b54e - Improvements to the operation of the pymysql dialect on
Python 3, including some important decode/bytes steps.
Issues remain with BLOB types due to driver issues.
Courtesy Ben Trofatter.
- start using util.py3k, we will eventually remove the
sa2to3 fixer entirely
2013-04-21 17:09:45 -04:00
Mike Bayer b5ab6d4107 - identify [ticket:2710] as a regression from [ticket:2229], doesn't
need to be in 0.7.
2013-04-21 11:47:43 -04:00
Mike Bayer 3a536ad1ba Fixed bug where many-to-many relationship with uselist=False
would fail to delete the association row and raise an error
if the scalar attribute were set to None.  Also in 0.7.11.
[ticket:2710]
2013-04-21 11:31:29 -04:00
Mike Bayer 7f0ee900b6 - this issue is a bug, mention the apply_labels issue sooner 2013-04-20 03:09:10 -04:00
Mike Bayer 6c1972e4ec Improved the behavior of instance management regarding
the creation of strong references within the Session;
an object will no longer have an internal reference cycle
created if it's in the transient state or moves into the
detached state - the strong ref is created only when the
object is attached to a Session and is removed when the
object is detached.  This makes it somewhat safer for an
object to have a `__del__()` method, even though this is
not recommended, as relationships with backrefs produce
cycles too.  A warning has been added when a class with
a `__del__()` method is mapped.
[ticket:2708]
2013-04-20 02:45:08 -04:00
Mike Bayer 15b3d2f5bd changelog for pullreq 54 gaerdbms 2013-04-19 21:41:11 -04:00
Mike Bayer b6bf8c2a30 Fixed a long-standing bug in the caching example, where
the limit/offset parameter values wouldn't be taken into
account when computing the cache key.  The
_key_from_query() function has been simplified to work
directly from the final compiled statement in order to get
at both the full statement as well as the fully processed
parameter list.
2013-04-18 20:11:08 -04:00
Mike Bayer 0790efcf87 - this pymssql test needs to be against the pymssql dialect
- Part of a longer series of fixes needed for pyodbc+
      mssql, a CAST to NVARCHAR(max) has been added to the bound
      parameter for the table name and schema name in all information schema
      queries to avoid the issue of comparing NVARCHAR to NTEXT,
      which seems to be rejected by the ODBC driver in some cases,
      such as FreeTDS (0.91 only?) plus unicode bound parameters being passed.
      The issue seems to be specific to the SQL Server information
      schema tables and the workaround is harmless for those cases
      where the problem doesn't exist in the first place.
[ticket:2355]
2013-04-18 17:41:30 -04:00
Mike Bayer 1b9c1a2ecf - test + changelog for [ticket:2691] 2013-04-18 12:01:16 -04:00
Mike Bayer 0bb05ffdf0 Reworked internal exception raises that emit
a rollback() before re-raising, so that the stack
trace is preserved from sys.exc_info() before entering
the rollback.  This so that the traceback is preserved
when using coroutine frameworks which may have switched
contexts before the rollback function returns.
[ticket:2703]
2013-04-18 11:00:12 -04:00
Mike Bayer f14ec0f517 add cymysql... 2013-04-14 19:32:54 -04:00
Mike Bayer ce5cff151a Fixed bug whereby ORM would run the wrong kind of
query when refreshing an inheritance-mapped class
where the superclass was mapped to a non-Table
object, like a custom join() or a select(),
running a query that assumed a hierarchy that's
mapped to individual Table-per-class.
[ticket:2697]
2013-04-11 20:04:57 -04:00
Mike Bayer 6e2bfaf769 Fixed __repr__() on mapper property constructs
to work before the object is initialized, so
that Sphinx builds with recent Sphinx versions
can read them.
2013-04-11 19:37:56 -04:00
Mike Bayer a0e95869a4 The _Binary base type now converts values through
the bytes() callable when run on Python 3; in particular
psycopg2 2.5 with Python 3.3 seems to now be returning
the "memoryview" type, so this is converted to bytes
before return.
2013-04-11 19:34:46 -04:00
Mike Bayer ee7bb9c174 Improvements to Connection auto-invalidation
handling.  If a non-disconnect error occurs,
but leads to a delayed disconnect error within error
handling (happens with MySQL), the disconnect condition
is detected.  The Connection can now also be closed
when in an invalid state, meaning it will raise "closed"
on next usage, and additionally the "close with result"
feature will work even if the autorollback in an error
handling routine fails and regardless of whether the
condition is a disconnect or not.
[ticket:2695]
2013-04-11 19:10:02 -04:00
Mike Bayer f35987d31a fix category 2013-04-11 16:51:27 -04:00
Mike Bayer 0d6e297d1f indentation fix 2013-04-11 16:33:53 -04:00
Mike Bayer a5ede47f12 A major fix to the way in which a select() object produces
labeled columns when apply_labels() is used; this mode
produces a SELECT where each column is labeled as in
<tablename>_<columnname>, to remove column name collisions
for a multiple table select.   The fix is that if two labels
collide when combined with the table name, i.e.
"foo.bar_id" and "foo_bar.id", anonymous aliasing will be
applied to one of the dupes.  This allows the ORM to handle
both columns independently; previously, 0.7
would in some cases silently emit a second SELECT for the
column that was "duped", and in 0.8 an ambiguous column error
would be emitted.   The "keys" applied to the .c. collection
of the select() will also be deduped, so that the "column
being replaced" warning will no longer emit for any select()
that specifies use_labels, though the dupe key will be given
an anonymous label which isn't generally user-friendly.
[ticket:2702]
2013-04-11 16:14:23 -04:00
Mike Bayer fa8c87eceb add calchipan 2013-04-10 14:02:24 -04:00
Mike Bayer d84ae4f754 Fixed indirect regression regarding :func:.has_inherited_table,
where since it considers the current class' ``__table__``, was
sensitive to when it was called.  This is 0.7's behavior also,
but in 0.7 things tended to "work out" within events like
``__mapper_args__()``.  :func:`.has_inherited_table` now only
considers superclasses, so should return the same answer
regarding the current class no matter when it's called
(obviously assuming the state of the superclass).
[ticket:2656]
2013-04-09 14:21:40 -04:00
Mike Bayer 70a173d22b 0.7 changelog 2013-04-09 12:01:31 -04:00
Mike Bayer df4e59ff55 Fixed bug when a query of the form:
``query(SubClass).options(subqueryload(Baseclass.attrname))``,
where ``SubClass`` is a joined inh of ``BaseClass``,
would fail to apply the ``JOIN`` inside the subquery
on the attribute load, producing a cartesian product.
The populated results still tended to be correct as additional
rows are just ignored, so this issue may be present as a
performance degradation in applications that are
otherwise working correctly. [ticket:2699]
2013-04-09 11:52:21 -04:00
Mike Bayer 82b6e07492 - Fixed bug in unit of work whereby a joined-inheritance
subclass could insert the row for the "sub" table
  before the parent table, if the two tables had no
  ForeignKey constraints set up between them.
  Also in 0.7.11. [ticket:2689]
- fix a glitch in the assertsql.CompiledSQL fixture regarding
when a multiparam compiledSQL is used within an AllOf
- add a new utility function randomize_unitofwork() which
does the function of --reversetop
2013-04-01 13:37:35 -04:00
Diana Clarke e49efb5e2c adding pullreq # to changelog 2013-03-29 15:05:18 -04:00
Diana Clarke 423cd7fbf6 adding convenience method exists() to Query (see # 2673) 2013-03-29 14:58:33 -04:00
Mike Bayer 7dff6f6d49 - test all pymssql messages here
- changelog
2013-03-29 12:09:11 -04:00
Mike Bayer a4703917d8 Loosened the check on dialect-specific argument names
passed to Table(); since we want to support external dialects
and also want to support args without a certain dialect
being installed, it only checks the format of the arg now,
rather than looking for that dialect in sqlalchemy.dialects.
2013-03-24 13:50:56 -04:00
Mike Bayer 35c5fd3fba Fixed bug whereby a DBAPI that can return "0"
for cursor.lastrowid would not function correctly
in conjunction with :attr:`.ResultProxy.inserted_primary_key`.
2013-03-23 19:00:11 -04:00
Mike Bayer e69b9542a8 Merged in tshepang/sqlalchemy/grammar (pull request #51)
fix grammar
2013-03-23 11:30:28 -04:00
Tshepang Lekhonkhobe fd23be645e fix grammar 2013-03-23 13:58:16 +02:00
Tshepang Lekhonkhobe 56ec242999 remove mistakenly-repeated words 2013-03-23 13:42:10 +02:00
Mike Bayer 25f1487d60 changelog 2013-03-18 14:20:28 -07:00
Mike Bayer 9ad9ccec87 0.8.1 bump + test, changelog for hstore fix [ticket:2680] 2013-03-18 12:55:56 -07:00
Mike Bayer 97d7123674 doc updates 2013-03-11 17:52:41 -04:00
Mike Bayer 522b426a1c - repair doctest for SQL expression tutorial
- remove most use of "whereclause" and "from_obj", not done yet,
part of [ticket:2679]
- add links to method chained versions for all Select.append_XYZ()
calls
- add "method chaining" and "generative" to glossary
2013-03-11 14:44:26 -04:00
Mike Bayer e061ed1843 0.8.0 2013-03-09 20:23:12 -05:00
Mike Bayer dc1ccca537 add ibm_db_sa 2013-03-09 19:42:49 -05:00
Mike Bayer a0de45185b Added support for Postgresql's traditional SUBSTRING
function syntax, renders as "SUBSTRING(x FROM y FOR z)"
when regular ``func.substring()`` is used.
Also in 0.7.11.  Courtesy Gunnlaugur Por Briem.
[ticket:2676]
2013-03-09 17:40:06 -05:00
Mike Bayer 852e9954aa A meaningful :attr:.QueryableAttribute.info attribute is
added, which proxies down to the ``.info`` attribute on either
the :class:`.schema.Column` object if directly present, or
the :class:`.MapperProperty` otherwise.  The full behavior
is documented and ensured by tests to remain stable.
[ticket:2675]
2013-03-09 13:24:54 -05:00
Mike Bayer d2a256a3ad changelog 2013-03-09 12:49:35 -05:00
Mike Bayer 3b7fbdb296 changelog 2013-03-07 12:38:10 -05:00
Mike Bayer 75a3f84e5f - Improved checking for an existing backref name conflict during
mapper configuration; will now test for name conflicts on
superclasses and subclasses, in addition to the current mapper,
as these conflicts break things just as much.  This is new for
0.8, but see below for a warning that will also be triggered
in 0.7.11.
- Improved the error message emitted when a "backref loop" is detected,
that is when an attribute event triggers a bidirectional
assignment between two other attributes with no end.
This condition can occur not just when an object of the wrong
type is assigned, but also when an attribute is mis-configured
to backref into an existing backref pair.  Also in 0.7.11.
- A warning is emitted when a MapperProperty is assigned to a mapper
that replaces an existing property, if the properties in question
aren't plain column-based properties.   Replacement of relationship
properties is rarely (ever?) what is intended and usually refers to a
mapper mis-configuration.   Also in 0.7.11.
[ticket:2674]
2013-03-03 13:51:54 -05:00
Mike Bayer b83dd4dc22 Can set/change the "cascade" attribute on a :func:.relationship
construct after it's been constructed already.  This is not
a pattern for normal use but we like to change the setting
for demonstration purposes in tutorials.
2013-03-02 20:27:53 -05:00
Mike Bayer 67f5c4a96d - add support for introductory notes following .. changelog:: directive 2013-03-02 17:48:22 -05:00
Mike Bayer 6ddfe3b390 - :meth:.MetaData.create_all and :meth:.MetaData.drop_all will
now accommodate an empty list as an instruction to not create/drop
any items, rather than ignoring the collection. [ticket:2664].
This is a behavioral change and extra notes to the changelog
and migration document have been added.

- create a new test suite for exercising codepaths
in engine/ddl.py
2013-03-02 17:47:58 -05:00
Mike Bayer d6b4c2edb5 merge 0.7 changelog 2013-03-02 16:26:10 -05:00
Mike Bayer 133e8fd388 - Fixed an import of "logging" in test_execute which was not
working on some linux platforms.  Also in 0.7.11.
- only need "logging.handlers" here, "logging" comes in implicitly
2013-03-02 16:20:49 -05:00
Mike Bayer 07cc4ecf05 - A clear error message is emitted if an event handler
attempts to emit SQL on a Session within the after_commit()
handler, where there is not a viable transaction in progress.
[ticket:2662]
- rework how SessionTransaction maintains state, using symbols
instead.
- add lots of notes and cross-linking for session events.
- add a link to :func:`.select()` within :meth:`.FromClause.select`.
2013-02-25 19:27:07 -05:00
Mike Bayer 95297c3544 Detection of a primary key change within the process
of cascading a natural primary key update will succeed
even if the key is composite and only some of the
attributes have changed.
[ticket:2665]
2013-02-25 18:55:09 -05:00
Mike Bayer 5eb8864463 - repair "map to selectable" example, place a caveat that this isn't
something people should be pursuing
2013-02-24 14:06:35 -05:00