Commit Graph

10240 Commits

Author SHA1 Message Date
Mike Bayer 60e6ac8856 - rework the assert_sql system so that we have a context manager to work with,
use events that are local to the engine and to the run and are removed afterwards.
2014-12-07 18:54:52 -05:00
Mike Bayer 1b260c7959 Merge branch 'master' into ticket_3100 2014-12-07 17:48:32 -05:00
Mike Bayer c8817e6087 - SQL Server 2012 now recommends VARCHAR(max), NVARCHAR(max),
VARBINARY(max) for large text/binary types.  The MSSQL dialect will
now respect this based on version detection, as well as the new
``deprecate_large_types`` flag.
fixes #3039
2014-12-06 13:43:39 -05:00
Mike Bayer c24423bc2e - enhance only_on() to work with compound specs
- fix "temporary_tables" requirement
2014-12-06 13:33:57 -05:00
Mike Bayer 95cd2003bb pep8 2014-12-06 12:39:18 -05:00
Mike Bayer b8114a3576 - adjust _revalidate_connection() again such that we pass a _wrap=False
to it, so that we say we will do the wrapping just once right here
in _execute_context() / _execute_default().  An adjustment is made
to _handle_dbapi_error() to not assume self.__connection in case
we are already in an invalidated state

further adjustment to
0639c199a5, 41e7253dee, #3266
2014-12-05 19:08:47 -05:00
Mike Bayer 0639c199a5 - move inner calls to _revalidate_connection() outside of existing
_handle_dbapi_error(); these are now handled already and the reentrant
call is not needed / breaks things.  Adjustment to 41e7253dee /
2014-12-05 16:34:43 -05:00
Mike Bayer 0ce045bd85 - The SQLite dialect, when using the :class:.sqlite.DATE,
:class:`.sqlite.TIME`,
or :class:`.sqlite.DATETIME` types, and given a ``storage_format`` that
only renders numbers, will render the types in DDL as
``DATE_CHAR``, ``TIME_CHAR``, and ``DATETIME_CHAR``, so that despite the
lack of alpha characters in the values, the column will still
deliver the "text affinity".  Normally this is not needed, as the
textual values within the default storage formats already
imply text.
fixes #3257
2014-12-05 14:46:43 -05:00
Mike Bayer ec6214457e - pep8 2014-12-05 14:19:36 -05:00
Mike Bayer d204e61f63 - document / work around that dialect_options isn't necessarily there 2014-12-05 12:18:11 -05:00
Mike Bayer 41e7253dee - The engine-level error handling and wrapping routines will now
take effect in all engine connection use cases, including
when user-custom connect routines are used via the
:paramref:`.create_engine.creator` parameter, as well as when
the :class:`.Connection` encounters a connection error on
revalidation.
fixes #3266
2014-12-05 12:12:44 -05:00
Mike Bayer 6e53e866de - pep8 cleanup 2014-12-05 11:35:42 -05:00
Mike Bayer edef953797 - New Oracle DDL features for tables, indexes: COMPRESS, BITMAP.
Patch courtesy Gabor Gombas.
fixes #3127
2014-12-04 20:08:07 -05:00
Mike Bayer 6017414641 - the refactor of the visit_alias() method in Oracle revealed
that quoting should be applied in %(name)s under with_hint.
2014-12-04 19:45:14 -05:00
Mike Bayer e46c71b419 - Added support for CTEs under Oracle. This includes some tweaks
to the aliasing syntax, as well as a new CTE feature
:meth:`.CTE.suffix_with`, which is useful for adding in special
Oracle-specific directives to the CTE.
fixes #3220
2014-12-04 19:35:00 -05:00
Mike Bayer fda589487b - Updated the "supports_unicode_statements" flag to True for MySQLdb
and Pymysql under Python 2.   This refers to the SQL statements
themselves, not the parameters, and affects issues such as table
and column names using non-ASCII characters.   These drivers both
appear to support Python 2 Unicode objects without issue in modern
versions.
fixes #3121
2014-12-04 19:12:52 -05:00
Mike Bayer f5ff86983f - The :meth:.Operators.match operator is now handled such that the
return type is not strictly assumed to be boolean; it now
returns a :class:`.Boolean` subclass called :class:`.MatchType`.
The type will still produce boolean behavior when used in Python
expressions, however the dialect can override its behavior at
result time.  In the case of MySQL, while the MATCH operator
is typically used in a boolean context within an expression,
if one actually queries for the value of a match expression, a
floating point value is returned; this value is not compatible
with SQLAlchemy's C-based boolean processor, so MySQL's result-set
behavior now follows that of the :class:`.Float` type.
A new operator object ``notmatch_op`` is also added to better allow
dialects to define the negation of a match operation.
fixes #3263
2014-12-04 18:29:56 -05:00
Mike Bayer 87bfcf91e9 - The :meth:.PGDialect.has_table method will now query against
``pg_catalog.pg_table_is_visible(c.oid)``, rather than testing
for an exact schema match, when the schema name is None; this
so that the method will also illustrate that temporary tables
are present.  Note that this is a behavioral change, as Postgresql
allows a non-temporary table to silently overwrite an existing
temporary table of the same name, so this changes the behavior
of ``checkfirst`` in that unusual scenario.
fixes #3264
2014-12-04 12:01:19 -05:00
Sebastian Bank 0e61acaf14 warn on duplicate polymorphic_identity 2014-12-04 14:34:08 +01:00
Mike Bayer 156f473de0 Merge remote-tracking branch 'origin/pr/151' into pr151 2014-12-01 13:31:48 -05:00
Mike Bayer 98c2a67970 - Fixed bug in :meth:.Table.tometadata method where the
:class:`.CheckConstraint` associated with a :class:`.Boolean`
or :class:`.Enum` type object would be doubled in the target table.
The copy process now tracks the production of this constraint object
as local to a type object.
fixes #3260
2014-11-29 14:46:34 -05:00
Mike Bayer de62497b03 - Updated the :ref:examples_versioned_history example such that
mapped columns are re-mapped to
match column names as well as grouping of columns; in particular,
this allows columns that are explicitly grouped in a same-column-named
joined inheritance scenario to be mapped in the same way in the
history mappings, avoiding warnings added in the 0.9 series
regarding this pattern and allowing the same view of attribute
keys.
2014-11-26 14:58:44 -05:00
Mike Bayer a88be57fb7 - formatting 2014-11-26 14:58:32 -05:00
Mike Bayer 028f7b8a86 - set default dialect here 2014-11-26 13:51:39 -05:00
Mike Bayer 99e5115124 - changelog, improve docstring/test for #3217. fixes #3217 2014-11-26 13:50:43 -05:00
Mike Bayer 55ad1d9159 Merge branch 'issue_bb_3217' of https://bitbucket.org/jvanasco/sqlalchemy-alt into pr32 2014-11-26 13:45:25 -05:00
Mike Bayer 07f3aff03b Merged in jon_nelson/sqlalchemy/minor_spelling_error (pull request #37)
- fix minor spelling error
2014-11-26 13:41:42 -05:00
Mike Bayer ca320be944 Merged in jvanasco/sqlalchemy-alt/issue_docs_event_statement (pull request #33)
added docs to clarify that sql statement is already in a dialect
2014-11-26 13:40:15 -05:00
Mike Bayer fb06fa9d6e - add an order_by here 2014-11-26 10:34:46 -05:00
Mike Bayer 79c0aa6b73 - use self.parent, not table here as there's an attributeerror
trap for self.table that behaves differently in py3k
2014-11-25 23:33:47 -05:00
Mike Bayer ee38bcdec2 - refresh all zoomark profiles 2014-11-25 23:29:15 -05:00
Mike Bayer d69f44b780 - add a new option --force-write-profiles to rewrite profiles even if they
are passing
2014-11-25 23:28:54 -05:00
Mike Bayer 212d93366d - The behavioral contract of the :attr:.ForeignKeyConstraint.columns
collection has been made consistent; this attribute is now a
:class:`.ColumnCollection` like that of all other constraints and
is initialized at the point when the constraint is associated with
a :class:`.Table`.
fixes #3243
2014-11-25 18:01:31 -05:00
Mike Bayer de11f94982 - The :meth:.PropComparator.of_type modifier has been
improved in conjunction with loader directives such as
:func:`.joinedload` and :func:`.contains_eager` such that if
two :meth:`.PropComparator.of_type` modifiers of the same
base type/path are encountered, they will be joined together
into a single "polymorphic" entity, rather than replacing
the entity of type A with the one of type B.  E.g.
a joinedload of ``A.b.of_type(BSub1)->BSub1.c`` combined with
joinedload of ``A.b.of_type(BSub2)->BSub2.c`` will create a
single joinedload of ``A.b.of_type((BSub1, BSub2)) -> BSub1.c, BSub2.c``,
without the need for the ``with_polymorphic`` to be explicit
in the query.
fixes #3256
2014-11-24 18:49:32 -05:00
Mike Bayer ba926a09b4 - add some logging to path_registry to help debug eager loading
issues
2014-11-24 17:35:50 -05:00
Mike Bayer 2098001ad3 - Fixed a bug in the examples/generic_assocaitions/discriminator_on_association.py
example, where the subclasses of AddressAssociation were not being
mapped as "single table inheritance", leading to problems when trying
to use the mappings further.
2014-11-24 12:33:56 -05:00
Ryan P. Kelly 9fb6acad67 Report the type of unexpected expression objects 2014-11-20 14:40:32 -05:00
Jon Nelson 5fd779df0c - fix minor spelling error 2014-11-14 22:20:56 -06:00
Jon Nelson f6c64fd0a6 Merged zzzeek/sqlalchemy into master 2014-11-14 20:01:11 -06:00
Mike Bayer 69979c8b2e - callcounts 2014-11-14 11:07:02 -05:00
Mike Bayer de9103aae2 - correct this to rewrite a multiple profile line correctly 2014-11-14 11:06:43 -05:00
Mike Bayer 026449c15f - Fixed a leak which would occur in the unsupported and highly
non-recommended use case of replacing a relationship on a fixed
mapped class many times, referring to an arbitrarily growing number of
target mappers.  A warning is emitted when the old relationship is
replaced, however if the mapping were already used for querying, the
old relationship would still be referenced within some registries.
fixes #3251
2014-11-13 13:17:38 -05:00
Mike Bayer 64e53f26a5 Merged in jon_nelson/sqlalchemy/logging_interpolation (pull request #35)
- don't do inline string interpolation when logging
2014-11-12 09:38:41 -05:00
Jon Nelson 30075f9015 - don't do inline string interpolation when logging 2014-11-11 21:34:57 -06:00
Mike Bayer b013fb82f5 - Fixed issue where the columns from a SELECT embedded in an
INSERT, either through the values clause or as a "from select",
would pollute the column types used in the result set produced by
the RETURNING clause when columns from both statements shared the
same name, leading to potential errors or mis-adaptation when
retrieving the returning rows.
fixes #3248
2014-11-11 12:34:00 -05:00
Mike Bayer 21022f9760 - in lieu of adding a new system of translating bound parameter names
for psycopg2 and others, encourage users to take advantage of positional
styles by documenting "paramstyle".   A section is added to psycopg2
specifically as this is a pretty common spot for named parameters
that may be unusually named.  fixes #3246.
2014-11-10 17:58:09 -05:00
Mike Bayer a19b2f419c - The :attr:.Column.key attribute is now used as the source of
anonymous bound parameter names within expressions, to match the
existing use of this value as the key when rendered in an INSERT
or UPDATE statement.   This allows :attr:`.Column.key` to be used
as a "substitute" string to work around a difficult column name
that doesn't translate well into a bound parameter name.   Note that
the paramstyle is configurable on :func:`.create_engine` in any case,
and most DBAPIs today support a named and positional style.
fixes #3245
2014-11-10 17:37:26 -05:00
Mike Bayer 68f1bcc9da Merge branch 'master' into ticket_3100
Conflicts:
	lib/sqlalchemy/orm/persistence.py
2014-11-06 17:43:01 -05:00
mike bayer 9b1777288b Merge pull request #149 from pbu88/small_error_reporting_improvement_update
Small improvement on FlushError can't update error message
2014-11-06 17:41:16 -05:00
Mike Bayer 0c19d765dc bulk_updates 2014-11-06 17:31:14 -05:00