Mike Bayer [Wed, 2 Apr 2014 22:11:11 +0000 (18:11 -0400)]
- reverse order of columns in sample CTEs as this is a UNION and the cols need to line up
- alter this in the unit tests as well as these queries were just copied from the tests
- remove the included_parts.join(parts) from the core CTE doc (also just copied from the
test, where we want to make sure joins don't get screwed up with the CTE) as it doesn't
contribute to the query itself
fixes #3014
Mike Bayer [Fri, 28 Mar 2014 21:42:55 +0000 (17:42 -0400)]
- revert part of c01558ae7f4a for now as we also test that a DELETE of two rows
where one is to be deleted from ON DELETE CASCADE succeeds; the check here makes that fail.
We will need to add an option to enable/disable this check per mapping, will likely
do this in next version
Mike Bayer [Fri, 28 Mar 2014 20:32:11 +0000 (16:32 -0400)]
- Fixed ORM bug where changing the primary key of an object, then marking
it for DELETE would fail to target the correct row for DELETE.
Then to compound matters, basic "number of rows matched" checks were
not being performed. Both issues are fixed, however note that the
"rows matched" check requires so-called "sane multi-row count"
functionality; the DBAPI's executemany() method must count up the
rows matched by individual statements and SQLAlchemy's dialect must
mark this feature as supported, currently applies to some mysql dialects,
psycopg2, sqlite only. fixes #3006
- Enabled "sane multi-row count" checking for the psycopg2 DBAPI, as
this seems to be supported as of psycopg2 2.0.9.
Mike Bayer [Tue, 25 Mar 2014 16:26:42 +0000 (12:26 -0400)]
- Fixed regression caused by release 0.8.5 / 0.9.3's compatibility
enhancements where index reflection on Postgresql versions specific
to only the 8.1, 8.2 series again
broke, surrounding the ever problematic int2vector type. While
int2vector supports array operations as of 8.1, apparently it only
supports CAST to a varchar as of 8.3.
fix #3000
Mike Bayer [Sat, 22 Mar 2014 23:55:00 +0000 (19:55 -0400)]
- Fixed regression from 0.8.3 as a result of :ticket:`2818`
where :meth:`.Query.exists` wouldn't work on a query that only
had a :meth:`.Query.select_from` entry but no other entities.
re: #2818 fixes #2995
Mike Bayer [Sat, 22 Mar 2014 21:31:50 +0000 (17:31 -0400)]
- Adjusted ``setup.py`` file to support the possible future
removal of the ``setuptools.Feature`` extension from setuptools.
If this keyword isn't present, the setup will still succeed
with setuptools rather than falling back to distutils. C extension
building can be disabled now also by setting the
DISABLE_SQLALCHEMY_CEXT environment variable. This variable works
whether or not setuptools is even available. fixes #2986
- using platform.python_implementation() in setup.py to detect CPython.
I've tested this function on OSX and linux on Python 2.6 through 3.4,
including 3.1, 3.2, 3.3.
Unfortunately, on OSX + 3.2 only, it seems to segfault. I've tried
installing 3.2.5 from the python.org .dmg, building it from source,
and also blew away the whole 3.2 directory, something seems to be wrong
with the "platform" module on that platform only, and there's also no
issue on bugs.python.org; however, I'm going with
it anyway. If someone is using 3.2 on OSX they really should be upgrading.
- adjusted the logic for platform_implementation(), apparently "platform"
is there in python 2.5, so we are doing a version check.
Conflicts:
doc/build/intro.rst
setup.py
Mike Bayer [Fri, 21 Mar 2014 02:46:23 +0000 (22:46 -0400)]
- reword the paragraph which talks about web framework integration for sessions:
1. fix the typo in the paragraph, fixes #2998
2. as zope-sqlalchemy only provides transaction integration and not session scoping,
dial back the language here as people are probably using scoped_session with pyramid anyway
3. as I'm going to again start recommending people don't cling to flask-sqlalchemy so hard,
take out the word "strongly" from the recommendation.
4. as flask is the only framework I can think of that actually has an explicit SQLAlchemy
layer that handles setting up scoped_session, take out the word "most", now it's "some web frameworks"
(by which it means "only flask...and flask-sqlalchemy is probably not worth using anyway")
Mike Bayer [Wed, 19 Mar 2014 15:09:38 +0000 (11:09 -0400)]
- Fixed bug in mutable extension as well as
:func:`.attributes.flag_modified` where the change event would not be
propagated if the attribute had been reassigned to itself.
fixes #2997
Mike Bayer [Mon, 17 Mar 2014 20:25:51 +0000 (16:25 -0400)]
- Improved an error message which would occur if a query() were made
against a non-selectable, such as a :func:`.literal_column`, and then
an attempt was made to use :meth:`.Query.join` such that the "left"
side would be determined as ``None`` and then fail. This condition
is now detected explicitly.
Mike Bayer [Fri, 28 Feb 2014 00:54:49 +0000 (19:54 -0500)]
- Fixed bug in :func:`.tuple_` construct where the "type" of essentially
the first SQL expression would be applied as the "comparison type"
to a compared tuple value; this has the effect in some cases of an
inappropriate "type coersion" occurring, such as when a tuple that
has a mix of String and Binary values improperly coerces target
values to Binary even though that's not what they are on the left
side. :func:`.tuple_` now expects heterogeneous types within its
list of values.
fixes #2977
Mike Bayer [Thu, 27 Feb 2014 00:27:22 +0000 (19:27 -0500)]
- Removed stale names from ``sqlalchemy.orm.interfaces.__all__`` and
refreshed with current names, so that an ``import *`` from this
module again works.
fixes #2975
Mike Bayer [Thu, 20 Feb 2014 00:22:17 +0000 (19:22 -0500)]
- Added an additional message to psycopg2 disconnect detection,
"could not send data to server", which complements the existing
"could not receive data from server" and has been observed by users,
fixes #2936
Mike Bayer [Tue, 18 Feb 2014 23:35:23 +0000 (18:35 -0500)]
- Support has been improved for Postgresql reflection behavior on very old
(pre 8.1) versions of Postgresql, and potentially other PG engines
such as Redshift (assuming Redshift reports the version as < 8.1).
The query for "indexes" as well as "primary keys" relies upon inspecting
a so-called "int2vector" datatype, which refuses to coerce to an array
prior to 8.1 causing failures regarding the "ANY()" operator used
in the query. Extensive googling has located the very hacky, but
recommended-by-PG-core-developer query to use when PG version < 8.1
is in use, so index and primary key constraint reflection now work
on these versions.
Mike Bayer [Wed, 19 Feb 2014 20:49:37 +0000 (15:49 -0500)]
- Added new MySQL-specific :class:`.mysql.DATETIME` which includes
fractional seconds support; also added fractional seconds support
to :class:`.mysql.TIMESTAMP`. DBAPI support is limited, though
fractional seconds are known to be supported by MySQL Connector/Python.
Patch courtesy Geert JM Vanderkelen. #2941
Mike Bayer [Wed, 19 Feb 2014 20:18:22 +0000 (15:18 -0500)]
- Fixed bug where calling :meth:`.Insert.values` with an empty list
or tuple would raise an IndexError. It now produces an empty
insert construct as would be the case with an empty dictionary.
Mike Bayer [Wed, 19 Feb 2014 15:48:32 +0000 (10:48 -0500)]
- Fixed a critical regression caused by :ticket:`2880` where the newly
concurrent ability to return connections from the pool means that the
"first_connect" event is now no longer synchronized either, thus leading
to dialect mis-configurations under even minimal concurrency situations.
Mike Bayer [Sun, 16 Feb 2014 19:28:56 +0000 (14:28 -0500)]
- extensive cross-linking of relationship options with their documentation sections
- convert all paramter references in relationship documentation to :paramref:
Mike Bayer [Sun, 16 Feb 2014 01:51:38 +0000 (20:51 -0500)]
- expand docs on MySQL table arguments beyond just storage engines
- clarify section on "foreign key reflection" and group this in a
section that refers to foreign keys.
Mike Bayer [Fri, 14 Feb 2014 19:32:00 +0000 (14:32 -0500)]
- Revised this very old issue where the Postgresql "get primary key"
reflection query were updated to take into account primary key constraints
that were renamed; the newer query fails on very old versions of
Postgresql such as version 7, so the old query is restored in those cases
when server_version_info < (8, 0) is detected. #2291
Roman Podoliaka [Fri, 14 Feb 2014 11:04:57 +0000 (13:04 +0200)]
Fix unique constraints reflection in SQLite
Reflection of unique constraints didn't work properly, if reserved
identifiers had been used as column names. In this case column names
would be put in double quotes (e.g. the name of column asc would be
returned as "asc").
This issue is only present in 0.8.4 and not in 0.9.x.
Mike Bayer [Thu, 13 Feb 2014 20:19:12 +0000 (15:19 -0500)]
- Fixed bug where :meth:`.in_()` would go into an endless loop if
erroneously passed a column expression whose comparator included
the ``__getitem__()`` method, such as a column that uses the
:class:`.postgresql.ARRAY` type. [ticket:2957]
Mike Bayer [Mon, 10 Feb 2014 21:33:48 +0000 (16:33 -0500)]
- Fixed bug where :meth:`.Query.get` would fail to consistently
raise the :class:`.InvalidRequestError` that invokes when called
on a query with existing criterion, when the given identity is
already present in the identity map. [ticket:2951]
Mike Bayer [Mon, 3 Feb 2014 17:04:51 +0000 (12:04 -0500)]
- Fixed bug which prevented MySQLdb-based dialects (e.g.
pymysql) from working in Py3K, where a check for "connection
charset" would fail due to Py3K's more strict value comparison
rules. The call in question wasn't taking the database
version into account in any case as the server version was
still None at that point, so the method overall has been
simplified to rely upon connection.character_set_name().
[ticket:2933]
Kyle Stark [Mon, 13 Jan 2014 16:52:31 +0000 (08:52 -0800)]
Fix TypeError for class_mapper called w/ iterable
When the class_ passed is not a mapped class but is actually an iterable, the string formatting operation fails with a TypeError, and the expected ArgumentError is not raised. Calling code which is using reflection and expects this error will fail (e.g. the sadisplay module).
Conflicts:
lib/sqlalchemy/orm/base.py
Mike Bayer [Thu, 2 Jan 2014 19:23:14 +0000 (14:23 -0500)]
- support addition of fails_if()/only_on(), just wraps the decorators
- update a few exclusions to support current pymssql. passes all of test_suite and dialect/mssql
Mike Bayer [Sat, 28 Dec 2013 22:50:19 +0000 (17:50 -0500)]
- apply a similar fix for floats to mssql+pyodbc as we did to firebird
- wrangle through osx+pyodbc+freetds to get at least test_suite to pass again
with mssql+pyodbc. invovled adding some silly requirements
Ben Alpert [Sat, 28 Dec 2013 06:11:23 +0000 (23:11 -0700)]
session docs: Change `object` to `someobject`
This makes the code block more consistent with the preceding one and also prevents the variable from being colored as a builtin (which `object` is) during syntax highlighting.
Mike Bayer [Fri, 27 Dec 2013 18:28:18 +0000 (13:28 -0500)]
- add a test which creates tables and views at the same time, then tests that the lists
of each can be reflected independently. Testing [ticket:2898] at the moment.
Mike Bayer [Fri, 27 Dec 2013 18:20:58 +0000 (13:20 -0500)]
- Fixed bug in Firebird index reflection where the columns within the
index were not sorted correctly; they are now sorted
in order of RDB$FIELD_POSITION.
Mike Bayer [Fri, 27 Dec 2013 18:16:48 +0000 (13:16 -0500)]
- The "asdecimal" flag used with the :class:`.Float` type will now
work with Firebird dialects; previously the decimal conversion was
not occurring.
- scale back some firebird FP numeric tests
John Anderson [Mon, 16 Dec 2013 20:50:10 +0000 (12:50 -0800)]
Remove terminated connections from the pool.
In pymssql, if you terminate a long running query manually
it will give you a connection reset by peer message, but this
connection remains in the pool and will be re-used.
Mike Bayer [Fri, 20 Dec 2013 15:26:09 +0000 (10:26 -0500)]
- Fixed issue where a primary key column that has a Sequence on it,
yet the column is not the "auto increment" column, either because
it has a foreign key constraint or ``autoincrement=False`` set,
would attempt to fire the Sequence on INSERT for backends that don't
support sequences, when presented with an INSERT missing the primary
key value. This would take place on non-sequence backends like
SQLite, MySQL. [ticket:2896]
Mike Bayer [Thu, 19 Dec 2013 21:02:14 +0000 (16:02 -0500)]
- Fixed bug with :meth:`.Insert.from_select` method where the order
of the given names would not be taken into account when generating
the INSERT statement, thus producing a mismatch versus the column
names in the given SELECT statement. Also noted that
:meth:`.Insert.from_select` implies that Python-side insert defaults
cannot be used, since the statement has no VALUES clause. [ticket:2895]
Mike Bayer [Tue, 17 Dec 2013 00:32:10 +0000 (19:32 -0500)]
- for [ticket:2651], leaving CheckConstraint alone, preferring to keep
backwards compatibility. A note about backslashing escapes is added.
Because the Text() construct now supports bind params better, the example
given in the code raises an exception now, so that should cover us.
The exception itself has been enhanced to include the key name of the
bound param. We're backporting this to 0.8 but 0.8 doesn't have the
text->bind behavior that raises.