Commit Graph

229 Commits

Author SHA1 Message Date
Mike Bayer d533b8e922 - The ORM and Core tutorials, which have always been in doctest format,
are now exercised within the normal unit test suite in both Python
2 and Python 3.
- remove the old testdocs.py runner and replace with test/base/test_tutorials.py
- use pytest's unicode fixer so that we can test for unicode strings
in both py2k/3k
- use py3k format overall for prints, exceptions
- add other fixers to guarantee deterministic results
- add skips and ellipses to outputs that aren't worth matching
2015-12-10 17:09:47 -05:00
Mike Bayer 954aafa064 Merge remote-tracking branch 'origin/pr/217' 2015-11-30 12:55:26 -05:00
Mike Bayer 86e5419968 - make inserted_primary_key a link and be more clear what happens here 2015-11-30 11:25:07 -05:00
Mike Bayer c90f0a49f3 - Added support for parameter-ordered SET clauses in an UPDATE
statement.  This feature is available by passing the
:paramref:`~.sqlalchemy.sql.expression.update.preserve_parameter_order`
flag either to the core :class:`.Update` construct or alternatively
adding it to the :paramref:`.Query.update.update_args` dictionary at
the ORM-level, also passing the parameters themselves as a list of 2-tuples.
Thanks to Gorka Eguileor for implementation and tests.
adapted from pullreq github:200
2015-11-28 14:30:05 -05:00
Hugh Cole-Baker 0438065a20 Fix a typo in the disconnect handling code example 2015-11-28 15:21:11 +00:00
Mike Bayer 07a199d929 - cross-linking for pool recycle feature 2015-10-30 11:47:32 -04:00
Mike Bayer 2daaacef04 - update the pool pessimistic invalidation recipe to refer to the
engine_connect event, allowing easy detection of disconnects
and full invalidation of the pool
2015-10-22 11:58:25 -04:00
Mike Bayer 24a7241b5e - The :func:.type_coerce construct is now a fully fledged Core
expression element which is late-evaluated at compile time.  Previously,
the function was only a conversion function which would handle different
expression inputs by returning either a :class:`.Label` of a column-oriented
expression or a copy of a given :class:`.BindParameter` object,
which in particular prevented the operation from being logically
maintained when an ORM-level expression transformation would convert
a column to a bound parameter (e.g. for lazy loading).
fixes #3531
2015-09-16 18:46:53 -04:00
Mike Bayer 8be93c23ee - add new documentation that applies to all modern SQLA versions,
detailing ORM event recipes across the board.
2015-09-02 11:58:59 -04:00
Mike Bayer 7c4512cbeb - Added support for "set-aggregate" functions of the form
``<function> WITHIN GROUP (ORDER BY <criteria>)``, using the
method :class:`.FunctionElement.within_group`.  A series of common
set-aggregate functions with return types derived from the set have
been added. This includes functions like :class:`.percentile_cont`,
:class:`.dense_rank` and others.
fixes #1370
- make sure we use func.name for all _literal_as_binds in functions.py
so we get consistent naming behavior for parameters.
2015-08-26 17:19:27 -04:00
Mike Bayer 7024745a14 - build out a new base type for Array, as well as new any/all operators
- any/all work for Array as well as subqueries, accepted by MySQL
- Postgresql ARRAY now subclasses Array
- fixes #3516
2015-08-25 18:24:46 -04:00
Mike Bayer e0a8030048 - rework the "controlling DDL sequences" documentation to
refer mostly to the DDL object; this system is primarily useful
in that case, and not for built-in objects.  Reference that
the built-in case is not really viable right now. References #3442.
2015-08-21 16:36:15 -04:00
Mike Bayer ceeb033054 - merge of ticket_3499 indexed access branch
- The "hashable" flag on special datatypes such as :class:`.postgresql.ARRAY`,
:class:`.postgresql.JSON` and :class:`.postgresql.HSTORE` is now
set to False, which allows these types to be fetchable in ORM
queries that include entities within the row.  fixes #3499
- The Postgresql :class:`.postgresql.ARRAY` type now supports multidimensional
indexed access, e.g. expressions such as ``somecol[5][6]`` without
any need for explicit casts or type coercions, provided
that the :paramref:`.postgresql.ARRAY.dimensions` parameter is set to the
desired number of dimensions. fixes #3487
- The return type for the :class:`.postgresql.JSON` and :class:`.postgresql.JSONB`
when using indexed access has been fixed to work like Postgresql itself,
and returns an expression that itself is of type :class:`.postgresql.JSON`
or :class:`.postgresql.JSONB`.  Previously, the accessor would return
:class:`.NullType` which disallowed subsequent JSON-like operators to be
used. part of fixes #3503
- The :class:`.postgresql.JSON`, :class:`.postgresql.JSONB` and
:class:`.postgresql.HSTORE` datatypes now allow full control over the
return type from an indexed textual access operation, either ``column[someindex].astext``
for a JSON type or ``column[someindex]`` for an HSTORE type,
via the :paramref:`.postgresql.JSON.astext_type` and
:paramref:`.postgresql.HSTORE.text_type` parameters. also part of fixes #3503
- The :attr:`.postgresql.JSON.Comparator.astext` modifier no longer
calls upon :meth:`.ColumnElement.cast` implicitly, as PG's JSON/JSONB
types allow cross-casting between each other as well.  Code that
makes use of :meth:`.ColumnElement.cast` on JSON indexed access,
e.g. ``col[someindex].cast(Integer)``, will need to be changed
to call :attr:`.postgresql.JSON.Comparator.astext` explicitly.  This is
part of the refactor in references #3503 for consistency in operator
use.
2015-08-17 17:07:10 -04:00
Mike Bayer 4f51fa947f - work to bridge between core/ORM tutorials regarding the text() construct 2015-07-26 16:36:23 -04:00
Mike Bayer 3180f15837 - Organize the tree for 1.1 2015-07-24 18:27:45 -04:00
Mike Bayer cadc2e0ba0 - try to note under insert.values(), if you need
"multiple parameter sets" there is a much more common case
which works equally well for INSERT/UPDATE/DELETE e.g.
executemany().   reference #3476
2015-07-08 20:37:04 -04:00
Mike Bayer 7aa2100db3 - more edits, references #3461 2015-06-19 14:54:26 -04:00
Mike Bayer a1b6e9f324 - fix the bullets
- tone down the "never dispose an engine" language
- refer to NullPool for the "I don't like pooling" use case
references #3461
2015-06-19 13:08:47 -04:00
Mike Bayer 3d78705cf4 - add explciit section on engine disposal, fixes #3461 2015-06-19 11:49:49 -04:00
Mike Bayer b861b7537c - add a subsection on how to use Sequence with server_default,
fixes #3453
2015-06-16 13:16:59 -04:00
Jochen Van de Velde 1bc7881171 Remove spaces around kwargs in metadata.rst 2015-05-26 23:27:05 +02:00
Mike Bayer 138293c246 - fix typo, fixes #3325 2015-03-17 17:32:16 -04:00
Mike Bayer b7e151ac5c - The "auto close" for :class:.ResultProxy is now a "soft" close.
That is, after exhausing all rows using the fetch methods, the
DBAPI cursor is released as before and the object may be safely
discarded, but the fetch methods may continue to be called for which
they will return an end-of-result object (None for fetchone, empty list
for fetchmany and fetchall).   Only if :meth:`.ResultProxy.close`
is called explicitly will these methods raise the "result is closed"
error.
fixes #3330 fixes #3329
2015-03-17 12:32:33 -04:00
Mike Bayer e42d8184ac - fix quantize recipe, fixes #3322 2015-03-12 11:50:00 -04:00
Mike Bayer f211ad254d - try to document how to get columns from constraints.
unfortunately Sphinx refuses to work correctly for the columns
attribute so we just add a lame message to contains_column().
2015-03-12 10:14:52 -04:00
Mike Bayer 94d57374c4 - add a new section regarding multiprocessing 2015-02-17 13:43:48 -05:00
Mike Bayer 383bb3f708 - The :class:.CheckConstraint construct now supports naming
conventions that include the token ``%(column_0_name)s``; the
constraint expression is scanned for columns.  Additionally,
naming conventions for check constraints that don't include the
``%(constraint_name)s`` token will now work for :class:`.SchemaType`-
generated constraints, such as those of :class:`.Boolean` and
:class:`.Enum`; this stopped working in 0.9.7 due to 🎫`3067`.
fixes #3299
2015-01-30 13:38:51 -05:00
Mike Bayer 4032aaf097 - enhance detail here regarding the difference between
Connection.connection and engine.raw_connection()
2015-01-20 11:36:14 -05:00
Mike Bayer 1104dcaa67 - add MemoizedSlots, a generalized solution to using __getattr__
for memoization on a class that uses slots.
- apply many more __slots__.  mem use for nova now at 46% savings
2015-01-05 19:02:08 -05:00
Mike Bayer 378ad79713 - put this back now that we found the source of this 2015-01-02 16:43:11 -05:00
Mike Bayer 21f47124ab - restate sort_tables in terms of a more fine grained
sort_tables_and_constraints function.
- The DDL generation system of :meth:`.MetaData.create_all`
and :meth:`.Metadata.drop_all` has been enhanced to in most
cases automatically handle the case of mutually dependent
foreign key constraints; the need for the
:paramref:`.ForeignKeyConstraint.use_alter` flag is greatly
reduced.  The system also works for constraints which aren't given
a name up front; only in the case of DROP is a name required for
at least one of the constraints involved in the cycle.
fixes #3282
2015-01-01 20:17:06 -05:00
Mike Bayer 31e2fe75d9 - remove private superclasses from docs in favor of fixing
zzzeeksphinx to omit these from warning

Conflicts:
	doc/build/orm/internals.rst
2014-12-27 17:46:55 -05:00
Mike Bayer 5343d24fee corrections 2014-12-27 16:54:32 -05:00
Mike Bayer 544e72bcb6 - corrections
- attempt to add a script to semi-automate the fixing of links
2014-12-27 16:22:41 -05:00
Mike Bayer 9561321d03 - squash-merge the improve_toc branch, which moves all the Sphinx styling
and extensions into an external library, and also reorganizes most large documentation
pages into many small areas to reduce scrolling and better present the context
into a more fine-grained hierarchy.
2014-12-17 17:24:23 -05:00
Yuval Langer c86c593ec3 Removing unneeded space. 2014-12-09 04:19:18 +02:00
Mike Bayer 3f1477e2ec - A new series of :class:.Session methods which provide hooks
directly into the unit of work's facility for emitting INSERT
and UPDATE statements has been created.  When used correctly,
this expert-oriented system can allow ORM-mappings to be used
to generate bulk insert and update statements batched into
executemany groups, allowing the statements to proceed at
speeds that rival direct use of the Core.
fixes #3100
2014-12-08 01:10:30 -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 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 95be42c06f - :meth:.Insert.from_select now includes Python and SQL-expression
defaults if otherwise unspecified; the limitation where non-
server column defaults aren't included in an INSERT FROM
SELECT is now lifted and these expressions are rendered as
constants into the SELECT statement.
2014-10-10 17:15:19 -04:00
Mike Bayer 49e750a1d7 - changelog, migration for pr github:134 2014-10-04 12:18:20 -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 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 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 dfb5707dae - rework the entire approach to #3076. As we need to catch all exceptions
in all cases unconditionally, the number of use cases that go beyond what
dbapi_error() is expecting has gone too far for an 0.9 release.
Additionally, the number of things we'd like to track is really a lot
more than the five arguments here, and ExecutionContext is really not
suitable as totally public API for this.   So restore dbapi_error
to its old version, deprecate, and build out handle_error instead.
This is a lot more extensible and doesn't get in the way of anything
compatibility-wise.
2014-07-04 15:40:47 -04:00
Mike Bayer 4b6d6d5f80 - add new section Working with Raw DBAPI Connections, fixes #2218. 2014-06-30 11:08:05 -04:00
Mike Bayer 0932e16cb7 - switch master to be 1.0 2014-05-23 11:18:46 -04:00
Matthias Urlichs f341cfbfe1 Documentation fix-up: "its" vs. "it's"
Removed ungrammatical apostrophes from documentation, replacing
"it's" with "its" where appropriate (but in a few cases with "it is"
when that read better).

While doing that, I also fixed a couple of minor typos etc.
as I noticed them.
2014-05-11 16:49:56 +02:00