Fix indentation and escape *args and **kwargs

This commit is contained in:
Vraj Mohan
2013-11-12 14:39:18 -05:00
parent 631eb84108
commit 226c7ec790
9 changed files with 124 additions and 119 deletions
+14 -13
View File
@@ -182,7 +182,7 @@
:tickets:
added a "mods" system which allows pluggable modules that modify/augment
core functionality, using the function "install_mods(*modnames)".
core functionality, using the function "install_mods(\*modnames)".
.. change::
:tags:
@@ -421,7 +421,7 @@
:tags:
:tickets:
added *args, **kwargs pass-thru to engine.transaction(func) allowing easier
added \*args, \**kwargs pass-thru to engine.transaction(func) allowing easier
creation of transactionalizing decorator functions
.. change::
@@ -520,7 +520,7 @@
create_engine() now uses genericized parameters; host/hostname,
db/dbname/database, password/passwd, etc. for all engine connections. makes
engine URIs much more "universal"
engine URIs much more "universal"
.. change::
:tags:
@@ -672,7 +672,7 @@
:tags:
:tickets:
added 'get_session().invalidate(*obj)' method to objectstore, instances will
added 'get_session().invalidate(\*obj)' method to objectstore, instances will
refresh() themselves upon the next attribute access.
.. change::
@@ -805,7 +805,7 @@
:tags:
:tickets:
added "refresh(*obj)" method to objectstore / Session to reload the attributes of
added "refresh(\*obj)" method to objectstore / Session to reload the attributes of
any set of objects from the database unconditionally
.. changelog::
@@ -856,14 +856,15 @@
two issues related to postgres, which doesnt want to give you the "lastrowid"
since oids are deprecated:
* postgres database-side defaults that are on primary key cols *do* execute
explicitly beforehand, even though thats not the idea of a PassiveDefault. this is
because sequences on columns get reflected as PassiveDefaults, but need to be explicitly
executed on a primary key col so we know what we just inserted.
* if you did add a row that has a bunch of database-side defaults on it,
and the PassiveDefault thing was working the old way, i.e. they just execute on
the DB side, the "cant get the row back without an OID" exception that occurred
also will not happen unless someone (usually the ORM) explicitly asks for it.
* postgres database-side defaults that are on primary key cols *do* execute
explicitly beforehand, even though thats not the idea of a PassiveDefault. this is
because sequences on columns get reflected as PassiveDefaults, but need to be explicitly
executed on a primary key col so we know what we just inserted.
* if you did add a row that has a bunch of database-side defaults on it,
and the PassiveDefault thing was working the old way, i.e. they just execute on
the DB side, the "cant get the row back without an OID" exception that occurred
also will not happen unless someone (usually the ORM) explicitly asks for it.
.. change::
:tags:
+1 -1
View File
@@ -170,7 +170,7 @@
:tags:
:tickets: 287
fix to using query.count() with distinct, **kwargs with SelectResults
fix to using query.count() with distinct, \**kwargs with SelectResults
count()
.. change::
+17 -18
View File
@@ -695,7 +695,7 @@
:tags: orm
:tickets:
session.get() and session.load() propagate **kwargs through to
session.get() and session.load() propagate \**kwargs through to
query
.. change::
@@ -979,7 +979,7 @@
:tickets:
query strings in unicode URLs get keys encoded to ascii
for **kwargs compat
for \**kwargs compat
.. change::
:tags: sql
@@ -1113,7 +1113,7 @@
:tickets:
support for SSL arguments given as inline within URL query string,
prefixed with "ssl_", courtesy terjeros@gmail.com.
prefixed with "ssl\_", courtesy terjeros@gmail.com.
.. change::
:tags: <schemaname>, mysql
@@ -1266,7 +1266,7 @@
:tags: sql
:tickets:
the "else_" parameter to the case statement now properly works when
the "else\_" parameter to the case statement now properly works when
set to zero.
.. change::
@@ -1279,16 +1279,15 @@
and a new one returned with additional criterion added.
The new methods include:
filter() - applies select criterion to the query
filter_by() - applies "by"-style criterion to the query
avg() - return the avg() function on the given column
join() - join to a property (or across a list of properties)
outerjoin() - like join() but uses LEFT OUTER JOIN
limit()/offset() - apply LIMIT/OFFSET
range-based access which applies limit/offset:
session.query(Foo)[3:5]
distinct() - apply DISTINCT
list() - evaluate the criterion and return results
* filter() - applies select criterion to the query
* filter_by() - applies "by"-style criterion to the query
* avg() - return the avg() function on the given column
* join() - join to a property (or across a list of properties)
* outerjoin() - like join() but uses LEFT OUTER JOIN
* limit()/offset() - apply LIMIT/OFFSET range-based access
which applies limit/offset: session.query(Foo)[3:5]
* distinct() - apply DISTINCT
* list() - evaluate the criterion and return results
no incompatible changes have been made to Query's API and no methods
have been deprecated. Existing methods like select(), select_by(),
@@ -1321,7 +1320,7 @@
:tags: orm
:tickets:
strings and columns can also be sent to the *args of instances()
strings and columns can also be sent to the \*args of instances()
where those exact result columns will be part of the result tuples.
.. change::
@@ -1488,7 +1487,7 @@
:tags: mysql
:tickets:
added a catchall **kwargs to MSString, to help reflection of
added a catchall \**kwargs to MSString, to help reflection of
obscure types (like "varchar() binary" in MS 4.0)
.. change::
@@ -1526,7 +1525,7 @@
:tickets:
fixed argument passing to straight textual execute() on engine,
connection. can handle *args or a list instance for positional, **kwargs
connection. can handle \*args or a list instance for positional, \**kwargs
or a dict instance for named args, or a list of list or dicts to invoke
executemany()
@@ -2364,7 +2363,7 @@
:tags: engine/pool
:tickets:
create_engine() reworked to be strict about incoming **kwargs. all keyword
create_engine() reworked to be strict about incoming \**kwargs. all keyword
arguments must be consumed by one of the dialect, connection pool, and engine
constructors, else a TypeError is thrown which describes the full set of
invalid kwargs in relation to the selected dialect/pool/engine configuration.
+24 -26
View File
@@ -83,14 +83,11 @@
:tickets:
Added "add()" and "add_all()" to scoped_session
methods. Workaround for 0.4.7:
methods. Workaround for 0.4.7::
from sqlalchemy.orm.scoping import ScopedSession,\
instrument
setattr(
ScopedSession, "add", instrument("add"))
setattr(
ScopedSession, "add_all", instrument("add_all"))
from sqlalchemy.orm.scoping import ScopedSession, instrument
setattr(ScopedSession, "add", instrument("add"))
setattr(ScopedSession, "add_all", instrument("add_all"))
.. change::
:tags: orm
@@ -344,7 +341,7 @@
:tags: orm
:tickets:
set-based collections |=, -=, ^= and &= are stricter about
set-based collections \|=, -=, ^= and &= are stricter about
their operands and only operate on sets, frozensets or
subclasses of the collection type. Previously, they would
accept any duck-typed set.
@@ -424,7 +421,7 @@
:tags: ext
:tickets:
set-based association proxies |=, -=, ^= and &= are
set-based association proxies \|=, -=, ^= and &= are
stricter about their operands and only operate on sets,
frozensets or other association proxies. Previously, they
would accept any duck-typed set.
@@ -541,11 +538,12 @@
The new approach also automatically allows eager loads
to work for subclasses, if they are present, for
example
example::
sess.query(Company).options(
eagerload_all(
))
to load Company objects, their employees, and the
'machines' collection of employees who happen to be
Engineers. A "with_polymorphic" Query option should be
@@ -561,7 +559,7 @@
is not carved in stone just yet: _values() and
_from_self(). We'd like feedback on these.
- _values(*columns) is given a list of column
- _values(\*columns) is given a list of column
expressions, and returns a new Query that only
returns those columns. When evaluated, the return
value is a list of tuples just like when using
@@ -594,7 +592,7 @@
:tickets:
query.order_by() and query.group_by() will accept
multiple arguments using *args (like select()
multiple arguments using \*args (like select()
already does).
.. change::
@@ -1780,7 +1778,7 @@
:tags: ext
:tickets:
'+', '*', '+=' and '*=' support for association
'+', '*', '+=' and '\*=' support for association
proxied lists.
.. change::
@@ -1866,7 +1864,7 @@
:tickets:
added new flag to String and create_engine(),
assert_unicode=(True|False|'warn'|None). Defaults to `False` or `None` on
assert_unicode=(True|False|'warn'\|None). Defaults to `False` or `None` on
create_engine() and String, `'warn'` on the Unicode type. When `True`,
results in all unicode conversion operations raising an exception when a
non-unicode bytestring is passed as a bind parameter. 'warn' results
@@ -2010,8 +2008,8 @@
:tickets: 908
mapped classes which extend "object" and do not provide an
__init__() method will now raise TypeError if non-empty *args
or **kwargs are present at instance construction time (and are
__init__() method will now raise TypeError if non-empty \*args
or \**kwargs are present at instance construction time (and are
not consumed by any extensions such as the scoped_session mapper),
consistent with the behavior of normal Python classes
@@ -2818,10 +2816,10 @@
:tickets:
Improvements and fixes on Firebird reflection:
. FBDialect now mimics OracleDialect, regarding case-sensitivity of TABLE and
COLUMN names (see 'case_sensitive remotion' topic on this current file).
. FBDialect.table_names() doesn't bring system tables (ticket:796).
. FB now reflects Column's nullable property correctly.
* FBDialect now mimics OracleDialect, regarding case-sensitivity of TABLE and
COLUMN names (see 'case_sensitive remotion' topic on this current file).
* FBDialect.table_names() doesn't bring system tables (ticket:796).
* FB now reflects Column's nullable property correctly.
.. change::
:tags:
@@ -2963,7 +2961,7 @@
:tags:
:tickets:
Changed the API for the in_ operator. in_() now accepts a single argument
Changed the API for the in\_ operator. in_() now accepts a single argument
that is a sequence of values or a selectable. The old API of passing in
values as varargs still works but is deprecated.
@@ -3246,7 +3244,7 @@
:tags:
:tickets:
Tidied up what ends up in your namespace when you 'from sqlalchemy import *':
Tidied up what ends up in your namespace when you 'from sqlalchemy import \*':
.. change::
:tags:
@@ -3816,10 +3814,10 @@
is represented by more than one column, when using the ORM. Objects of
the new type are fully functional in query expressions, comparisons,
query.get() clauses, etc. and act as though they are regular single-column
scalars... except they're not! Use the function composite(cls, *columns)
scalars... except they're not! Use the function composite(cls, \*columns)
inside of the mapper's "properties" dict, and instances of cls will be
created/mapped to a single attribute, comprised of the values correponding
to *columns.
to \*columns.
.. change::
:tags: orm
@@ -3912,7 +3910,7 @@
:tickets:
All "type" keyword arguments, such as those to bindparam(), column(),
Column(), and func.<something>(), renamed to "type_". Those objects still
Column(), and func.<something>(), renamed to "type\_". Those objects still
name their "type" attribute as "type".
.. change::
+5 -5
View File
@@ -1093,7 +1093,7 @@
Session.scalar() now converts raw SQL strings to text()
the same way Session.execute() does and accepts same
alternative **kw args.
alternative \**kw args.
.. change::
:tags: orm
@@ -1506,7 +1506,7 @@
:tickets:
ColumnProperty (and front-end helpers such as ``deferred``) no
longer ignores unknown **keyword arguments.
longer ignores unknown \**keyword arguments.
.. change::
:tags: orm
@@ -2903,7 +2903,7 @@
:tags: orm
:tickets:
The RowTuple object returned by Query(*cols) now features
The RowTuple object returned by Query(\*cols) now features
keynames which prefer mapped attribute names over column keys,
column keys over column names, i.e. Query(Class.foo,
Class.bar) will have names "foo" and "bar" even if those are
@@ -2984,7 +2984,7 @@
:tickets: 1140
class.someprop.in_() raises NotImplementedError pending the
implementation of "in_" for relation
implementation of "in\_" for relation
.. change::
:tags: orm
@@ -3499,7 +3499,7 @@
Unicode, UnicodeText types now set "assert_unicode" and
"convert_unicode" by default, but accept overriding
**kwargs for these values.
\**kwargs for these values.
.. change::
:tags: sql
+31 -25
View File
@@ -1013,7 +1013,7 @@
New Query methods: query.label(name), query.as_scalar(),
return the query's statement as a scalar subquery
with /without label;
query.with_entities(*ent), replaces the SELECT list of
query.with_entities(\*ent), replaces the SELECT list of
the query with new entities.
Roughly equivalent to a generative form of query.values()
which accepts mapped entities as well as column
@@ -1246,7 +1246,7 @@
:tags: sql
:tickets:
Added type_coerce(expr, type_) expression element.
Added type_coerce(expr, type\_) expression element.
Treats the given expression as the given type when evaluating
expressions and processing result rows, but does not
affect the generation of SQL, other than an anonymous
@@ -3005,7 +3005,7 @@
:tags: orm
:tickets:
Query gains an add_columns(*columns) method which is a multi-
Query gains an add_columns(\*columns) method which is a multi-
version of add_column(col). add_column(col) is future
deprecated.
@@ -3641,9 +3641,9 @@
:tags: declarative
:tickets:
DeclarativeMeta exclusively uses cls.__dict__ (not dict_)
DeclarativeMeta exclusively uses cls.__dict__ (not dict\_)
as the source of class information; _as_declarative exclusively
uses the dict_ passed to it as the source of class information
uses the dict\_ passed to it as the source of class information
(which when using DeclarativeMeta is cls.__dict__). This should
in theory make it easier for custom metaclasses to modify
the state passed into _as_declarative.
@@ -4190,10 +4190,10 @@
* Passing a single list of elements to eagerload(),
eagerload_all(), contains_eager(), lazyload(),
defer(), and undefer() instead of multiple positional
*args is deprecated.
\*args is deprecated.
* Passing a single list of elements to query.order_by(),
query.group_by(), query.join(), or query.outerjoin()
instead of multiple positional *args is deprecated.
instead of multiple positional \*args is deprecated.
* query.iterate_instances() is removed. Use query.instances().
* Query.query_from_parent() is removed. Use the
sqlalchemy.orm.with_parent() function to produce a
@@ -4363,7 +4363,7 @@
"expr != expr" can be very expensive, and it's preferred
that the user not issue in_() if the list is empty,
instead simply not querying, or modifying the criterion
as appropriate for more complex situations.
as appropriate for more complex situations.
.. change::
:tags: sql
@@ -4523,7 +4523,7 @@
* the "connection" argument from engine.transaction() and
engine.run_callable() is removed - Connection itself
now has those methods. All four methods accept
*args and **kwargs which are passed to the given callable,
\*args and \**kwargs which are passed to the given callable,
as well as the operating connection.
.. change::
@@ -4570,11 +4570,13 @@
Removed public mutability from Index and Constraint
objects:
- ForeignKeyConstraint.append_element()
- Index.append_column()
- UniqueConstraint.append_column()
- PrimaryKeyConstraint.add()
- PrimaryKeyConstraint.remove()
* ForeignKeyConstraint.append_element()
* Index.append_column()
* UniqueConstraint.append_column()
* PrimaryKeyConstraint.add()
* PrimaryKeyConstraint.remove()
These should be constructed declaratively (i.e. in one
construction).
@@ -4682,18 +4684,22 @@
The signature of the "on" callable passed to DDL() and
DDLElement() is revised as follows:
"ddl" - the DDLElement object itself.
"event" - the string event name.
"target" - previously "schema_item", the Table or
MetaData object triggering the event.
"connection" - the Connection object in use for the operation.
**kw - keyword arguments. In the case of MetaData before/after
create/drop, the list of Table objects for which
CREATE/DROP DDL is to be issued is passed as the kw
argument "tables". This is necessary for metadata-level
DDL that is dependent on the presence of specific tables.
ddl
the DDLElement object itself
event
the string event name.
target
previously "schema_item", the Table or MetaData object triggering the event.
connection
the Connection object in use for the operation.
\**kw
keyword arguments. In the case of MetaData before/after
create/drop, the list of Table objects for which
CREATE/DROP DDL is to be issued is passed as the kw
argument "tables". This is necessary for metadata-level
DDL that is dependent on the presence of specific tables.
- the "schema_item" attribute of DDL has been renamed to
The "schema_item" attribute of DDL has been renamed to
"target".
.. change::
+28 -26
View File
@@ -11,7 +11,7 @@
:tickets: 2851
:versions: 0.8.3, 0.9.0b1
The regexp used by the :func:`.url.make_url` function now parses
The regexp used by the :func:`~.sqlalchemy.engine.url.make_url` function now parses
ipv6 addresses, e.g. surrounded by brackets.
.. change::
@@ -1188,12 +1188,12 @@
:tickets:
Added some decent context managers
to Engine, Connection:
to Engine, Connection::
with engine.begin() as conn:
<work with conn in a transaction>
and:
and::
with engine.connect() as conn:
<work with conn>
@@ -1778,10 +1778,10 @@
polymorphic_on now accepts many
new kinds of values:
- standalone expressions that aren't
* standalone expressions that aren't
otherwise mapped
- column_property() objects
- string names of any column_property()
* column_property() objects
* string names of any column_property()
or attribute name of a mapped Column
The docs include an example using
@@ -2174,7 +2174,7 @@
Enhanced the instrumentation in the ORM to support
Py3K's new argument style of "required kw arguments",
i.e. fn(a, b, *, c, d), fn(a, b, *args, c, d).
i.e. fn(a, b, \*, c, d), fn(a, b, \*args, c, d).
Argument signatures of mapped object's __init__
method will be preserved, including required kw rules.
@@ -2196,8 +2196,9 @@
Fixed a variety of synonym()-related regressions
from 0.6:
- making a synonym against a synonym now works.
- synonyms made against a relationship() can
* making a synonym against a synonym now works.
* synonyms made against a relationship() can
be passed to query.join(), options sent
to query.options(), passed by name
to query.with_parent().
@@ -2306,19 +2307,20 @@
:tickets: 2239
New declarative features:
- __declare_last__() method, establishes an event
listener for the class method that will be called
when mappers are completed with the final "configure"
step.
- __abstract__ flag. The class will not be mapped
at all when this flag is present on the class.
- New helper classes ConcreteBase, AbstractConcreteBase.
Allow concrete mappings using declarative which automatically
set up the "polymorphic_union" when the "configure"
mapper step is invoked.
- The mapper itself has semi-private methods that allow
the "with_polymorphic" selectable to be assigned
to the mapper after it has already been configured.
* __declare_last__() method, establishes an event
listener for the class method that will be called
when mappers are completed with the final "configure"
step.
* __abstract__ flag. The class will not be mapped
at all when this flag is present on the class.
* New helper classes ConcreteBase, AbstractConcreteBase.
Allow concrete mappings using declarative which automatically
set up the "polymorphic_union" when the "configure"
mapper step is invoked.
* The mapper itself has semi-private methods that allow
the "with_polymorphic" selectable to be assigned
to the mapper after it has already been configured.
.. change::
:tags: orm
@@ -2856,7 +2858,7 @@
:tickets: 2206
Fixed bug whereby adaptation of old append_ddl_listener()
function was passing unexpected **kw through
function was passing unexpected \**kw through
to the Table event. Table gets no kws, the MetaData
event in 0.6 would get "tables=somecollection",
this behavior is preserved.
@@ -4321,7 +4323,7 @@
:tickets: 1069
Query.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
as \*args, interpreted by the Postgresql dialect
as DISTINCT ON (<expr>).
.. change::
@@ -4421,7 +4423,7 @@
:tickets: 1069
select.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
as \*args, interpreted by the Postgresql dialect
as DISTINCT ON (<expr>). Note this was already
available via passing a list to the `distinct`
keyword argument to select().
@@ -4431,7 +4433,7 @@
:tickets:
select.prefix_with() accepts multiple expressions
(i.e. *expr), 'prefix' keyword argument to select()
(i.e. \*expr), 'prefix' keyword argument to select()
accepts a list or tuple.
.. change::
+3 -3
View File
@@ -749,10 +749,10 @@ Just like it says:
b = bindparam('foo', type_=String)
in_ Function Changed to Accept Sequence or Selectable
-----------------------------------------------------
in\_ Function Changed to Accept Sequence or Selectable
------------------------------------------------------
The in_ function now takes a sequence of values or a
The in\_ function now takes a sequence of values or a
selectable as its sole argument. The previous API of passing
in values as positional arguments still works, but is now
deprecated. This means that
+1 -2
View File
@@ -288,8 +288,7 @@ events back to the owning parent or parents. The extension
includes an approach for scalar database values, such as
those managed by ``PickleType``, ``postgresql.ARRAY``, or
other custom ``MutableType`` classes, as well as an approach
for ORM "composites", those configured using :ref:`composite()
<mapper_composite>`_.
for ORM "composites", those configured using :func:`~.sqlalchemy.orm.composite`.
.. seealso::