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.
Mike Bayer [Tue, 17 Dec 2013 00:17:41 +0000 (19:17 -0500)]
- An adjustment to the :func:`.subqueryload` strategy which ensures that
the query runs after the loading process has begun; this is so that
the subqueryload takes precedence over other loaders that may be
hitting the same attribute due to other eager/noload situations
at the wrong time. [ticket:2887]
Mike Bayer [Mon, 16 Dec 2013 20:25:48 +0000 (15:25 -0500)]
- Fixed bug when using joined table inheritance from a table to a
select/alias on the base, where the PK columns were also not same
named; the persistence system would fail to copy primary key values
from the base table to the inherited table upon INSERT.
[ticket:2885]
Mike Bayer [Thu, 12 Dec 2013 18:30:16 +0000 (13:30 -0500)]
- :func:`.composite` will raise an informative error message when the
columns/attribute (names) passed don't resolve to a Column or mapped
attribute (such as an erroneous tuple); previously raised an unbound
local. [ticket:2889]
Mike Bayer [Thu, 12 Dec 2013 17:49:57 +0000 (12:49 -0500)]
- Error message when a string arg sent to :func:`.relationship` which
doesn't resolve to a class or mapper has been corrected to work
the same way as when a non-string arg is received, which indicates
the name of the relationship which had the configurational error.
[ticket:2888]
Mike Bayer [Sat, 7 Dec 2013 22:20:05 +0000 (17:20 -0500)]
- A DBAPI that raises an error on ``connect()`` which is not a subclass
of dbapi.Error (such as ``TypeError``, ``NotImplementedError``, etc.)
will propagate the exception unchanged. Previously,
the error handling specific to the ``connect()`` routine would both
inappropriately run the exception through the dialect's
:meth:`.Dialect.is_disconnect` routine as well as wrap it in
a :class:`sqlalchemy.exc.DBAPIError`. It is now propagated unchanged
in the same way as occurs within the execute process. [ticket:2881]
- add tests for this in test_parseconnect, but also add tests in test_execute
to ensure the execute() behavior as well
Mike Bayer [Sat, 7 Dec 2013 00:57:19 +0000 (19:57 -0500)]
- The :class:`.QueuePool` has been enhanced to not block new connection
attempts when an existing connection attempt is blocking. Previously,
the production of new connections was serialized within the block
that monitored overflow; the overflow counter is now altered within
it's own critical section outside of the connection process itself.
[ticket:2880]
Mike Bayer [Fri, 6 Dec 2013 20:53:59 +0000 (15:53 -0500)]
- Made a slight adjustment to the logic which waits for a pooled
connection to be available, such that for a connection pool
with no timeout specified, it will every half a second break out of
the wait to check for the so-called "abort" flag, which allows the
waiter to break out in case the whole connection pool was dumped;
normally the waiter should break out due to a notify_all() but it's
possible this notify_all() is missed in very slim cases.
This is an extension of logic first introduced in 0.8.0, and the
issue has only been observed occasionally in stress tests.
Roman Podolyaka [Sun, 9 Jun 2013 16:07:00 +0000 (19:07 +0300)]
- backport unique constraints reflection to 0.8.4, thereby
assisting with alembic installations that have upgraded and are dealing with
PG index/unique constraint reflection.
Inspection API already supports reflection of table
indexes information and those also include unique
constraints (at least for PostgreSQL and MySQL).
But it could be actually useful to distinguish between
indexes and plain unique constraints (though both are
implemented in the same way internally in RDBMS).
This change adds a new method to Inspection API - get_unique_constraints()
and implements it for SQLite, PostgreSQL and MySQL dialects.
Mike Bayer [Sat, 30 Nov 2013 22:31:00 +0000 (17:31 -0500)]
- the pronoun removal commit. there was only one instance of a
standalone gendered pronoun with a gender-neutral subject, but also
have replaced all occurences of "his/her", "his or her", etc. The docs have always
strived to account for both genders in any non-specific singular pronoun,
however recent controversy in the community suggests
that a zero-gendered-pronoun policy is probably best going forward.