Commit Graph

4078 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 3e49ac5161 and a lot of tests. five fail without the change 2013-04-26 13:08:28 -04:00
Mike Bayer 6f05aa06bf everything passes with this!!!!!!! holy crap !!!!! and its the simplest of all 2013-04-25 13:54:40 -04:00
Mike Bayer 6372327097 - attempt to replace the whole idea of "join_to_left" with a more
fundamental and general purpose heuristic.   this initial approach
has about 60 tests failing but seems to have gone pretty far
2013-04-24 18:58:09 -04:00
Mike Bayer c3c9a3f701 break into multiple tests 2013-04-24 18:10:16 -04:00
Mike Bayer b25e11f6a8 formatting 2013-04-24 17:49:24 -04:00
Mike Bayer 7a26ad2ef1 - merge exists() patch + changelog 2013-04-23 20:06:04 -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 63c211f427 tweak this some more to handle the array being empty again 2013-04-22 17:24:31 -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 e4c50c07bb merge cymysql branch 2013-04-21 17:19:07 -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 d5af821b5d Merged in bentrofatter/sqlalchemy-2663 (pull request #49)
Fixed PyMySQL problems for Python 2.x and mitigated some issues with Python 3.x
2013-04-21 16:58:55 -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 a6906cd0a9 - remove lots of old tests here that are covered
elsewhere, cleanup
2013-04-21 11:09:51 -04:00
Mike Bayer 41b70ff888 - establish ordering here for the hstore repr test 2013-04-20 11:47:25 -04:00
Mike Bayer 666fda3c9c order the properties here to get the SQL to be deterministic 2013-04-20 11:44:27 -04:00
Mike Bayer 6ae1e89961 - these pickle the assoc proxy by itself tests can't really pass
now without strong ref on the parent
- fix message compare for py3k
2013-04-20 05:34:40 -04:00
Hajime Nakagami fbcdba12f8 merge from default 2013-04-20 17:10:23 +09:00
Hajime Nakagami af9ed1ff16 testing.crashes on cymysql >= 0.6 2013-04-20 16:33:32 +09:00
Hajime Nakagami a6a311cd1a skip with cymysql 0.6 2013-04-20 15:54:33 +09: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 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 e5d0592180 - additional test + correction for [ticket:2699] 2013-04-18 10:34:59 -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 b19f3db870 - unit test failing on python3.3 + psycopg2, add an order by 2013-04-11 19:38:49 -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 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 37a9c5f52d order by... 2013-04-09 14:48:59 -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 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 6bdd3bb93f - reinstate insert returning back into test_insert.py; defaultdialect
needs to be explicit here since tablestest sticks testing.db onto metadata.bind
2013-04-01 15:41:57 -04:00
Mike Bayer 5ee1bb09de merge default 2013-04-01 13:57:44 -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 25c6732019 moving insert returning test back into CRUD test class until I figure out why moving it broke the oracle/postgres builds 2013-03-30 09:30:58 -04:00
Diana Clarke 2fa9dd6bb8 whitespace 2013-03-30 01:39:40 -04:00
Diana Clarke 2ffc925588 move the update tests from CRUDTest into sql/test_update.py (see #2630) 2013-03-30 01:38:17 -04:00
Diana Clarke e6d6cfbf6b fixing tests for --db=mysql: VARCHAR requires a length on dialect mysql 2013-03-30 01:01:59 -04:00
Diana Clarke 192bddc720 starting on the update tests next, pep8 pass first (see #2630) 2013-03-30 00:33:07 -04:00
Diana Clarke 17487a0db7 move the insert tests from CRUDTest into sql/test_insert.py (see #2630) 2013-03-29 19:10:01 -04:00
Diana Clarke 0f203d57cd move the delete tests from CRUDTest into sql/test_delete.py (see #2630) 2013-03-29 17:25:39 -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 7aea1bfc8e Merged in sontek/sqlalchemy/add_better_disconnect_checks (pull request #47)
Add disconnect check on timeouts
2013-03-29 12:03:17 -04:00
Mike Bayer 728e272201 Merged in msabramo/sqlalchemy (pull request #48)
Make MonkeyPatchedBinaryTest only run when using mssql. Prevents failed
2013-03-24 14:32:19 -04:00
Mike Bayer b5b751e3de fix syntax error 2013-03-24 13:45:37 -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
Marc Abramowitz f79b41243d Make MonkeyPatchedBinaryTest not fail on Python 2.5 (which doesn't have
the `b` notation for byte string literals)
2013-03-20 22:37:05 -07:00