Commit Graph

1217 Commits

Author SHA1 Message Date
Mike Bayer e3a7015f89 Fixes to the `sqlalchemy.ext.serializer` extension, including
that the "id" passed from the pickler is turned into a string
to prevent against bytes being parsed on Py3K, as well as that
``relationship()`` and ``orm.join()`` constructs are now properly
serialized. [ticket:2698] and some other observed issues.
2013-04-26 15:51:29 -04:00
Mike Bayer 22c4ae0aaf changelog for [ticket:2714] 2013-04-26 15:04:42 -04:00
Mike Bayer 7a26ad2ef1 - merge exists() patch + changelog 2013-04-23 20:06:04 -04:00
Mike Bayer 77e0a5dffe Added a conditional to the unpickling process for ORM
mapped objects, such that if the reference to the object
were lost when the object was pickled, we don't
erroneously try to set up _sa_instance_state - fixes
a NoneType error.
2013-04-23 13:23:48 -04:00
Mike Bayer 177ad548c4 - only search in the exception before the first newline, to avoid
false positives for SQL statements containing certain text
2013-04-23 13:07:36 -04:00
Mike Bayer 00c163bfb1 Opened up the checking for "disconnect" with psycopg2/libpq
to check for all the various "disconnect" messages within
the full exception hierarchy.  Specifically the
"closed the connection unexpectedly" message has now been
seen in at least three different exception types.
[ticket:2712]
2013-04-22 19:33:39 -04:00
Mike Bayer 5884c2e7e5 Fully implemented the IS and IS NOT operators with
regards to the True/False constants.  An expression like
``col.is_(True)`` will now render ``col IS true``
on the target platform, rather than converting the True/
False constant to an integer bound parameter.
This allows the ``is_()`` operator to work on MySQL when
given True/False constants.
[ticket:2682]
2013-04-22 19:12:47 -04:00
Mike Bayer d2f8c83e25 - change to [ticket:2681], pre-coerce the array to list
unconditonally instead so that it works in all cases.
2013-04-22 17:08:02 -04:00
Mike Bayer 422f471871 The operators for the Postgresql ARRAY type supports
input types of sets, generators, etc. but only when a dimension
is specified for the ARRAY; otherwise, the dialect
needs to peek inside of "arr[0]" to guess how many
dimensions are in use.  If this occurs with a non
list/tuple type, the error message is now informative
and directs to specify a dimension for the ARRAY.
[ticket:2681]
2013-04-22 16:57:15 -04:00
Mike Bayer e79fd50e58 - changelog
- just do a fetchone() here, no need for len() etc.
2013-04-21 17:23:03 -04:00
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