Commit Graph

2307 Commits

Author SHA1 Message Date
Mike Bayer b510b99094 - use provide_metadata for new unique constraint / index tests
- add a test for PG reflection of unique index without any unique
constraint
- for PG, don't include 'duplicates_constraint' in the entry
if the index does not actually mirror a constraint
- use a distinct method for unique constraint reflection within table
- catch unique constraint not implemented condition; this may
be within some dialects and also is expected to be supported by
Alembic tests
- migration + changelogs for #3184
- add individual doc notes as well to MySQL, Postgreql
fixes #3184
2014-10-04 19:06:35 -04:00
Mike Bayer 49e750a1d7 - changelog, migration for pr github:134 2014-10-04 12:18:20 -04:00
Mike Bayer 4da020dae3 - rework tests for attached databases into individual tests,
test both memory and file-based
- When selecting from a UNION using an attached database file,
the pysqlite driver reports column names in cursor.description
as 'dbname.tablename.colname', instead of 'tablename.colname' as
it normally does for a UNION (note that it's supposed to just be
'colname' for both, but we work around it).  The column translation
logic here has been adjusted to retrieve the rightmost token, rather
than the second token, so it works in both cases.   Workaround
courtesy Tony Roberts.
fixes #3211
2014-09-29 18:09:25 -04:00
Mike Bayer b6496ba3d2 - A revisit to this issue first patched in 0.9.5, apparently
psycopg2's ``.closed`` accessor is not as reliable as we assumed,
so we have added an explicit check for the exception messages
"SSL SYSCALL error: Bad file descriptor" and
"SSL SYSCALL error: EOF detected" when detecting an
is-disconnect scenario.   We will continue to consult psycopg2's
connection.closed as a first check.
fixes #3021
2014-09-29 17:33:53 -04:00
Mike Bayer b89523f0b7 - Fixed bug where a "branched" connection, that is the kind you get
when you call :meth:`.Connection.connect`, would not share transaction
status with the parent.  The architecture of branching has been tweaked
a bit so that the branched connection defers to the parent for
all transactional status and operations.
fixes #3190
2014-09-26 16:25:26 -04:00
Mike Bayer fbddf193a6 - Fixed bug where a "branched" connection, that is the kind you get
when you call :meth:`.Connection.connect`, would not share invalidation
status with the parent.  The architecture of branching has been tweaked
a bit so that the branched connection defers to the parent for
all invalidation status and operations.
fixes #3215
2014-09-26 14:55:36 -04:00
Mike Bayer b1a956d421 - add explicit warning re: polymorphic_on, cascading is not supported
at this time.  ref #3214
2014-09-26 12:50:18 -04:00
Mike Bayer 7f82c55fa7 - refactor of declarative, break up into indiviudal methods
that are now affixed to _MapperConfig
- declarative now creates column copies ahead of time
so that they are ready to go for a declared_attr
- overhaul of declared_attr; memoization, cascading modifier
- A relationship set up with :class:`.declared_attr` on
a :class:`.AbstractConcreteBase` base class will now be configured
on the abstract base mapping automatically, in addition to being
set up on descendant concrete classes as usual.
fixes #2670
- The :class:`.declared_attr` construct has newly improved
behaviors and features in conjunction with declarative.  The
decorated function will now have access to the final column
copies present on the local mixin when invoked, and will also
be invoked exactly once for each mapped class, the returned result
being memoized.   A new modifier :attr:`.declared_attr.cascading`
is added as well. fixes #3150
- the original plan for #3150 has been scaled back; by copying
mixin columns up front and memoizing, we don't actually need
the "map properties later" thing.
- full docs + migration notes
2014-09-25 21:08:17 -04:00
Mike Bayer 5e7cb037e8 - convert to spaces 2014-09-25 21:07:15 -04:00
Mike Bayer 5508388f03 - The :mod:sqlalchemy.ext.automap extension will now set
``cascade="all, delete-orphan"`` automatically on a one-to-many
relationship/backref where the foreign key is detected as containing
one or more non-nullable columns.  This argument is present in the
keywords passed to :func:`.automap.generate_relationship` in this
case and can still be overridden.  Additionally, if the
:class:`.ForeignKeyConstraint` specifies ``ondelete="CASCADE"``
for a non-nullable or ``ondelete="SET NULL"`` for a nullable set
of columns, the argument ``passive_deletes=True`` is also added to the
relationship.  Note that not all backends support reflection of
ondelete, but backends that do include Postgresql and MySQL.
fixes #3210
2014-09-22 23:00:45 -04:00
Mike Bayer b36cdefba2 - Fixed bug that affected generally the same classes of event
as that of 🎫`3199`, when the ``named=True`` parameter
would be used.  Some events would fail to register, and others
would not invoke the event arguments correctly, generally in the
case of when an event was "wrapped" for adaption in some other way.
The "named" mechanics have been rearranged to not interfere with
the argument signature expected by internal wrapper functions.
fixes #3197
2014-09-18 17:49:07 -04:00
Mike Bayer c7ec21b29e - Fixed an unlikely race condition observed in some exotic end-user
setups, where the attempt to check for "duplicate class name" in
declarative would hit upon a not-totally-cleaned-up weak reference
related to some other class being removed; the check here now ensures
the weakref still references an object before calling upon it further.
fixes #3208
2014-09-18 15:42:27 -04:00
Mike Bayer 9ae4db27b9 - Fixed bug that affected many classes of event, particularly
ORM events but also engine events, where the usual logic of
"de duplicating" a redundant call to :func:`.event.listen`
with the same arguments would fail, for those events where the
listener function is wrapped.  An assertion would be hit within
registry.py.  This assertion has now been integrated into the
deduplication check, with the added bonus of a simpler means
of checking deduplication across the board.
fixes #3199
2014-09-18 15:24:40 -04:00
Mike Bayer f82f6d55dc - Added new method :meth:.Select.with_statement_hint and ORM
method :meth:`.Query.with_statement_hint` to support statement-level
hints that are not specific to a table.
fixes #3206
2014-09-18 11:44:48 -04:00
Mike Bayer e3f07f7206 - Added support for the Oracle table option ON COMMIT. This is being
kept separate from Postgresql's ON COMMIT for now even though ON COMMIT
is in the SQL standard; the option is still very specific to temp tables
and we eventually would provide a more first class temporary table
feature.
- oracle can apparently do get_temp_table_names() too, so implement that,
fix its get_table_names(), and add it to #3204.  fixes #3204 again.
2014-09-17 19:43:45 -04:00
Mike Bayer c926df3617 - changelog for #3203; fixes #3203 2014-09-17 15:19:19 -04:00
Mike Bayer cb23fa243f - Added :meth:.Inspector.get_temp_table_names and
:meth:`.Inspector.get_temp_view_names`; currently, only the
SQLite dialect supports these methods.    The return of temporary
table and view names has been **removed** from SQLite's version
of :meth:`.Inspector.get_table_names` and
:meth:`.Inspector.get_view_names`; other database backends cannot
support this information (such as MySQL), and the scope of operation
is different in that the tables can be local to a session and
typically aren't supported in remote schemas.
fixes #3204
2014-09-17 15:15:21 -04:00
Mike Bayer 3a6cd72bea Merge branch 'pr128' 2014-09-17 13:11:49 -04:00
Mike Bayer be57def4b9 - repair get_foreign_table_names() for PGInsp/dialect level
- repair get_view_names()
- changelog + migration note
2014-09-17 13:11:22 -04:00
Mike Bayer a985f84ed6 - Fixed the version string detection in the pymssql dialect to
work with Microsoft SQL Azure, which changes the word "SQL Server"
to "SQL Azure".
fixes #3151
2014-09-16 17:40:06 -04:00
mike bayer 7094193c61 Merge pull request #138 from BY-jk/master
Added EXASolution dialect to documentation
2014-09-16 15:10:36 -04:00
Jan 4f39e3839f Added EXASolution dialect to documentation 2014-09-16 20:54:27 +02:00
Mike Bayer d299c40265 Merge branch 'master' into ticket_3100 2014-09-15 16:31:40 -04:00
Jim Hokanson 7fd3f05805 Updated documenation for engines.rst
Clarified connecting to absolute path for sqlite using Windows.
2014-09-14 00:25:41 -04:00
Mike Bayer f98c89d2be - Fixed warning that would emit when a complex self-referential
primaryjoin contained functions, while at the same time remote_side
was specified; the warning would suggest setting "remote side".
It now only emits if remote_side isn't present.
fixes #3194
2014-09-11 11:51:44 -04:00
Mike Bayer 14d2bb074c - Fixed bug in ordering list where the order of items would be
thrown off during a collection replace event, if the
reorder_on_append flag were set to True.  The fix ensures that the
ordering list only impacts the list that is explicitly associated
with the object.
fixes #3191
2014-09-10 14:14:50 -04:00
Mike Bayer 706d4fcc4f - for whatever reason, Insert.values() with multi values wasn't
in the 0.8 migration, so let's just add that
2014-09-09 18:59:59 -04:00
Mike Bayer 390207e533 - Added new event handlers :meth:.AttributeEvents.init_collection
and :meth:`.AttributeEvents.dispose_collection`, which track when
a collection is first associated with an instance and when it is
replaced.  These handlers supersede the :meth:`.collection.linker`
annotation. The old hook remains supported through an event adapter.
2014-09-07 20:28:19 -04:00
Mike Bayer 77e6046ff0 - mako_layout isn't used, remove it
- to check for epub look at "builder"
2014-09-07 18:10:40 -04:00
mike bayer 56e14e2e28 Merge pull request #133 from hiaselhans/doc_epub
Docs: use layout.mako only when mako_layout=='html'
2014-09-07 17:38:05 -04:00
hiaselhans a8ef876f6c Docs: use the base layout when mako_layout=='epub'
- https://readthedocs.org/projects/sqlalchemy/downloads/epub/latest/ renders with the full template which is unreadable on e-readers
  - in the makefile the template-variable mako_layout is set for target: epub which makes mako use only the base layout.
  - this is the more elegant solution as proposed to #133
2014-09-07 22:55:05 +02:00
Mike Bayer 51eff5eb7a - changelog and migration for #3188, #3148.
fixes #3188
fixes #3148
2014-09-07 15:23:24 -04:00
Mike Bayer fa7c8f8811 - try to finish up the performance example for now 2014-09-06 13:01:21 -04:00
Mike Bayer 7b766591b0 - MySQL boolean symbols "true", "false" work again. 0.9's change
in 🎫`2682` disallowed the MySQL dialect from making use of the
"true" and "false" symbols in the context of "IS" / "IS NOT", but
MySQL supports this syntax even though it has no boolean type.
MySQL remains "non native boolean", but the :func:`.true`
and :func:`.false` symbols again produce the
keywords "true" and "false", so that an expression like
``column.is_(true())`` again works on MySQL.
fixes #3186
2014-09-05 16:44:42 -04:00
Mike Bayer 84d4651f3d Merge branch 'master' into ticket_3100 2014-09-03 19:44:40 -04:00
Mike Bayer 2b10aa45a1 - ensure literal_binds works with LIMIT clause, FOR UPDATE 2014-09-03 19:42:38 -04:00
Mike Bayer 4399431b53 - The hostname-based connection format for SQL Server when using
pyodbc will no longer specify a default "driver name", and a warning
is emitted if this is missing.  The optimal driver name for SQL Server
changes frequently and is per-platform, so hostname based connections
need to specify this. DSN-based connections are preferred.
fixes #3182
2014-09-03 10:31:29 -04:00
Mike Bayer 7e0c224162 Merge branch 'master' into ticket_3100 2014-09-02 15:05:32 -04:00
Mike Bayer ec840a6eea - An adjustment to table/index reflection such that if an index
reports a column that isn't found to be present in the table,
a warning is emitted and the column is skipped.  This can occur
for some special system column situations as has been observed
with Oracle. fixes #3180
2014-09-02 14:18:09 -04:00
Mike Bayer b621d23251 - reorganize 2014-09-01 20:31:00 -04:00
Mike Bayer 7c6a45c480 - The :func:~.expression.column and :func:~.expression.table
constructs are now importable from the "from sqlalchemy" namespace,
just like every other Core construct.
- The implicit conversion of strings to :func:`.text` constructs
when passed to most builder methods of :func:`.select` as
well as :class:`.Query` now emits a warning with just the
plain string sent.   The textual conversion still proceeds normally,
however.  The only method that accepts a string without a warning
are the "label reference" methods like order_by(), group_by();
these functions will now at compile time attempt to resolve a single
string argument to a column or label expression present in the
selectable; if none is located, the expression still renders, but
you get the warning again. The rationale here is that the implicit
conversion from string to text is more unexpected than not these days,
and it is better that the user send more direction to the Core / ORM
when passing a raw string as to what direction should be taken.
Core/ORM tutorials have been updated to go more in depth as to how text
is handled.
fixes #2992
2014-09-01 20:19:54 -04:00
Mike Bayer 382f82538b - more updates to text docs, literal_column, column etc. in prep
for ticket 2992.
2014-09-01 17:20:49 -04:00
Mike Bayer 62d81c2ebd - walk back these literal SQL lectures into something much more succinct.
the ORM one in particular was really long winded and I don't really care if people
use text() anyway, they'll figure it out ;)
2014-08-31 20:26:40 -04:00
Mike Bayer 3c60d3b1ca - A new style of warning can be emitted which will "filter" up to
N occurrences of a parameterized string.   This allows parameterized
warnings that can refer to their arguments to be delivered a fixed
number of times until allowing Python warning filters to squelch them,
and prevents memory from growing unbounded within Python's
warning registries.
fixes #3178
2014-08-31 15:22:00 -04:00
Mike Bayer 7e417665d2 - start encouraging the use of text() for injection of string-based SQL
rather than straight strings.  reference #2992
2014-08-31 11:45:20 -04:00
Mike Bayer f995a63d6c - alter the yield_per eager restriction such that joined many-to-one loads
are still OK, since these should be fine.
2014-08-30 15:45:50 -04:00
Mike Bayer eb8a39c58c - The :class:.Query will raise an exception when :meth:.Query.yield_per
is used with mappings or options where eager loading, either
joined or subquery, would take place.  These loading strategies are
not currently compatible with yield_per, so by raising this error,
the method is safer to use - combine with sending False to
:meth:`.Query.enable_eagerloads` to disable the eager loaders.
2014-08-29 14:01:38 -04:00
Mike Bayer faf319fff5 - we've got 25% improvement so let's talk about it 2014-08-29 13:35:25 -04:00
Mike Bayer fbcb056d90 - Changed the approach by which the "single inheritance criterion"
is applied, when using :meth:`.Query.from_self`, or its common
user :meth:`.Query.count`.  The criteria to limit rows to those
with a certain type is now indicated on the inside subquery,
not the outside one, so that even if the "type" column is not
available in the columns clause, we can filter on it on the "inner"
query.
fixes #3177
2014-08-29 12:05:00 -04:00
Mike Bayer c192e447f3 - major refactoring/inlining to loader.instances(), though not really
any speed improvements :(.   code is in a much better place to be run into
C, however
- The ``proc()`` callable passed to the ``create_row_processor()``
method of custom :class:`.Bundle` classes now accepts only a single
"row" argument.
- Deprecated event hooks removed:  ``populate_instance``,
``create_instance``, ``translate_row``, ``append_result``
- the getter() idea is somewhat restored; see ref #3175
2014-08-28 20:06:49 -04:00