summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/expression.py
Commit message (Collapse)AuthorAgeFilesLines
...
* documentation patch for [ticket:1354]Mike Bayer2009-12-091-2/+8
|
* - removed needless "counter" behavior with select()Mike Bayer2009-12-081-8/+0
| | | | | | | | | | labelnames that match a column name in the table, i.e. generates "tablename_id" for "id", instead of "tablename_id_1" in an attempt to avoid naming conflicts, when the table has a column actually named "tablename_id" - this is because the labeling logic is always applied to all columns so a naming conflict will never occur.
* - multi-part schema names, i.e. with dots such asMike Bayer2009-12-081-1/+1
| | | | | | | "dbo.master", are now rendered in select() labels with underscores for dots, i.e. "dbo_master_table_column". This is a "friendly" label that behaves better in result sets. [ticket:1428]
* - The "use get" behavior of many-to-one relations, i.e. that aMike Bayer2009-12-081-8/+3
| | | | | | | | | | | | | | lazy load will fallback to the possibly cached query.get() value, now works across join conditions where the two compared types are not exactly the same class, but share the same "affinity" - i.e. Integer and SmallInteger. Also allows combinations of reflected and non-reflected types to work with 0.5 style type reflection, such as PGText/Text (note 0.6 reflects types as their generic versions). [ticket:1556] - types now support an "affinity comparison" operation, i.e. that an Integer/SmallInteger are "compatible", or a Text/String, PickleType/Binary, etc. Part of [ticket:1556].
* scan for autocommit based on text() specific flag, saves isinstance() call ↵Mike Bayer2009-11-101-2/+2
| | | | on each execution.
* - subclassed Function off of new FunctionElement generic baseMike Bayer2009-11-101-51/+57
| | | | | | - removed "key" accessor of Function, Grouping - this doesn't seem to be used for anything - various formatting - documented the four "Element" classes in the compiler extension as per [ticket:1590]
* added docs to case() illusrtating usage of `literal_column()`, can't ↵Mike Bayer2009-10-281-1/+11
| | | | implement #809 directly
* - generalized Enum to issue a CHECK constraint + VARCHAR on default platformMike Bayer2009-10-251-3/+3
| | | | - added native_enum=False flag to do the same on MySQL, PG, if desired
* - Added new ENUM type to the Postgresql dialect, which exists as a schema-levelMike Bayer2009-10-251-32/+23
| | | | | | | | | | | | | | | | | | | | | | | | | construct and extends the generic Enum type. Automatically associates itself with tables and their parent metadata to issue the appropriate CREATE TYPE/DROP TYPE commands as needed, supports unicode labels, supports reflection. [ticket:1511] - MySQL ENUM now subclasses the new generic Enum type, and also handles unicode values implicitly, if the given labelnames are unicode objects. - Added a new Enum generic type, currently supported on Postgresql and MySQL. Enum is a schema-aware object to support databases which require specific DDL in order to use enum or equivalent; in the case of PG it handles the details of `CREATE TYPE`, and on other databases without native enum support can support generation of CHECK constraints. [ticket:1109] [ticket:1511] - types documentation updates - some cleanup on schema/expression docs
* deprecations per [ticket:1498]:Mike Bayer2009-10-151-25/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - deprecated PassiveDefault - use DefaultClause. - the BINARY and MSBinary types now generate "BINARY" in all cases. Omitting the "length" parameter will generate "BINARY" with no length. Use BLOB to generate an unlengthed binary column. - the "quoting='quoted'" argument to MSEnum/ENUM is deprecated. It's best to rely upon the automatic quoting. - "shortname" attribute on bindparam() is removed. - fold_equivalents flag on join is deprecated (will remain until [ticket:1131] is implemented) - "scalar" flag on select() is removed, use select.as_scalar(). - 'transactional' flag on sessionmaker() and others is removed. Use 'autocommit=True' to indicate 'transactional=False'. - 'polymorphic_fetch' argument on mapper() is removed. Loading can be controlled using the 'with_polymorphic' option. - 'select_table' argument on mapper() is removed. Use 'with_polymorphic=("*", <some selectable>)' for this functionality. - 'proxy' argument on synonym() is removed. This flag did nothing throughout 0.5, as the "proxy generation" behavior is now automatic. - Passing a single list of elements to eagerload(), eagerload_all(), contains_eager(), lazyload(), defer(), and undefer() instead of multiple positional -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. - query.iterate_instances() is removed. Use query.instances(). - Query.query_from_parent() is removed. Use the sqlalchemy.orm.with_parent() function to produce a "parent" clause, or alternatively query.with_parent(). - query._from_self() is removed, use query.from_self() instead. - the "comparator" argument to composite() is removed. Use "comparator_factory". - RelationProperty._get_join() is removed. - the 'echo_uow' flag on Session is removed. Use logging on the "sqlalchemy.orm.unitofwork" name. - session.clear() is removed. use session.expunge_all(). - session.save(), session.update(), session.save_or_update() are removed. Use session.add() and session.add_all(). - the "objects" flag on session.flush() remains deprecated. - the "dont_load=True" flag on session.merge() is deprecated in favor of "load=False". - passing an InstanceState (internal SQLAlchemy state object) to attributes.init_collection() or attributes.get_history() is deprecated. These functions are public API and normally expect a regular mapped object instance. - the 'engine' parameter to declarative_base() is removed. Use the 'bind' keyword argument.
* - an executemany() now requires that all bound parameterMike Bayer2009-10-151-6/+13
| | | | | | | | | | | | sets require that all keys are present which are present in the first bound parameter set. The structure and behavior of an insert/update statement is very much determined by the first parameter set, including which defaults are going to fire off, and a minimum of guesswork is performed with all the rest so that performance is not impacted. For this reason defaults would otherwise silently "fail" for missing parameters, so this is now guarded against. [ticket:1566]
* merge from branches/clauseelement-nonzeroPhilip Jenvey2009-09-241-37/+48
| | | | | | adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash collisions (which only occur on Jython) fixes #1547
* doc fixesMike Bayer2009-08-251-18/+18
|
* - added **kw to ClauseElement.compare(), so that we can smarten up the ↵Mike Bayer2009-08-081-12/+44
| | | | | | | | | | | | | "use_get" operation - many-to-one relation to a joined-table subclass now uses get() for a simple load (known as the "use_get" condition), i.e. Related->Sub(Base), without the need to redefine the primaryjoin condition in terms of the base table. [ticket:1186] - specifying a foreign key with a declarative column, i.e. ForeignKey(MyRelatedClass.id) doesn't break the "use_get" condition from taking place [ticket:1492]
* unwrapped _get_colparams a bit, dropped out an isinstance() callMike Bayer2009-08-081-0/+2
|
* merge 0.6 series to trunk.Mike Bayer2009-08-061-207/+468
|
* merged [ticket:1486] fix from 0.6Mike Bayer2009-07-281-3/+12
|
* - Unary expressions such as DISTINCT propagate theirMike Bayer2009-07-251-4/+3
| | | | | type handling to result sets, allowing conversions like unicode and such to take place. [ticket:1420]
* - Fixed a bug in extract() introduced in 0.5.4 wherebyMike Bayer2009-07-171-2/+1
| | | | | | the string "field" argument was getting treated as a ClauseElement, causing various errors within more complex SQL transformations.
* - sqlMike Bayer2009-05-291-1/+1
| | | | | | | | | | | | | | | | - Removed an obscure feature of execute() (including connection, engine, Session) whereby a bindparam() construct can be sent as a key to the params dictionary. This usage is undocumented and is at the core of an issue whereby the bindparam() object created implicitly by a text() construct may have the same hash value as a string placed in the params dictionary and may result in an inappropriate match when computing the final bind parameters. Internal checks for this condition would add significant latency to the critical task of parameter rendering, so the behavior is removed. This is a backwards incompatible change for any application that may have been using this feature, however the feature has never been documented.
* - The "polymorphic discriminator" column may be part of aMike Bayer2009-05-171-1/+1
| | | | | primary key, and it will be populated with the correct discriminator value. [ticket:1300]
* Lots of fixes to the code examples to specify imports explicitly.Michael Trier2009-03-311-4/+8
| | | | | | | Explicit imports make it easier for users to understand the examples. Additionally a lot of the examples were fixed to work with the changes in the 0.5.x code base. One small correction to the Case expression. Thanks a bunch to Adam Lowry! Fixes #717.
* extract() is now dialect-sensitive and supports SQLite and others.Jason Kirtland2009-03-301-2/+22
|
* - Lazy loader will not use get() if the "lazy load"Mike Bayer2009-03-291-1/+1
| | | | | | | | | SQL clause matches the clause used by get(), but contains some parameters hardcoded. Previously the lazy strategy would fail with the get(). Ideally get() would be used with the hardcoded parameters but this would require further development. [ticket:1357]
* - An alias() of a select() will convert to a "scalar subquery"Mike Bayer2009-03-211-2/+22
| | | | | | when used in an unambiguously scalar context, i.e. it's used in a comparison operation. This applies to the ORM when using query.subquery() as well.
* - Fixed a recursive pickling issue in serializer, triggeredMike Bayer2009-02-171-0/+6
| | | | by an EXISTS or other embedded FROM construct.
* - Fixed missing _label attribute on Function object, othersMike Bayer2009-02-011-1/+2
| | | | | when used in a select() with use_labels (such as when used in an ORM column_property()). [ticket:1302]
* some docstring stuffMike Bayer2009-01-281-20/+19
|
* - _CalculatedClause is goneMike Bayer2009-01-281-85/+74
| | | | | | | | - Function rolls the various standalone execution functionality of CC into itself, accesses its internal state more directly - collate just uses _BinaryExpression, don't know why it didn't do this already - added new _Case construct, compiles directly - the world is a happier place
* - Query now implements __clause_element__() which producesMike Bayer2009-01-271-13/+13
| | | | | | | | | | its selectable, which means a Query instance can be accepted in many SQL expressions, including col.in_(query), union(query1, query2), select([foo]).select_from(query), etc. - the __selectable__() interface has been replaced entirely by __clause_element__().
* - Further fixes to the "percent signs and spaces in column/tableMike Bayer2009-01-181-6/+6
| | | | | | | | names" functionality. [ticket:1284] - Still doesn't work for PG/MySQL, which unfortunately would require post_process_text() calls all over the place. Perhaps % escaping can be assembled into IdentifierPreparer.quote() since that's where identifier names are received.
* - Query.from_self() as well as query.subquery() both disableMike Bayer2009-01-151-0/+6
| | | | | | | | | | | | | the rendering of eager joins inside the subquery produced. The "disable all eager joins" feature is available publically via a new query.enable_eagerloads() generative. [ticket:1276] - Added a rudimental series of set operations to Query that receive Query objects as arguments, including union(), union_all(), intersect(), except_(), insertsect_all(), except_all(). See the API documentation for Query.union() for examples. - Fixed bug that prevented Query.join() and eagerloads from attaching to a query that selected from a union or aliased union.
* - Improved the methodology to handling percent signs in columnMike Bayer2009-01-141-8/+14
| | | | | | names from [ticket:1256]. Added more tests. MySQL and Postgres dialects still do not issue correct CREATE TABLE statements for identifiers with percent signs in them.
* happy new yearMike Bayer2009-01-121-1/+1
|
* docstrings for the hated fold_equivalents argument/functionMike Bayer2009-01-031-11/+10
|
* - Fixed some deep "column correspondence" issues which couldMike Bayer2009-01-031-5/+33
| | | | | | | | impact a Query made against a selectable containing multiple versions of the same table, as well as unions and similar which contained the same table columns in different column positions at different levels. [ticket:1268]
* - sqlalchemy.sql.expression.Function is now a publicMike Bayer2009-01-021-4/+4
| | | | | | | class. It can be subclassed to provide user-defined SQL functions in an imperative style, including with pre-established behaviors. The postgis.py example illustrates one usage of this.
* - Can pass mapped attributes and column objects as keysMike Bayer2008-12-281-4/+7
| | | | | | | | | to query.update({}). [ticket:1262] - Mapped attributes passed to the values() of an expression level insert() or update() will use the keys of the mapped columns, not that of the mapped attribute.
* *most* py3k warnings are resolved, with the exception of the various ↵Mike Bayer2008-12-181-1/+1
| | | | | | __setslice__ related warnings I don't really know how to get rid of
* merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 ↵Mike Bayer2008-12-181-8/+12
| | | | | | | | testing issues, and also addresses a significant chunk of py3k deprecations. It's mainly expicit __hash__ methods. Additionally, most usage of sets/dicts to store columns uses util-based placeholder names.
* - Query() can be passed a "composite" attributeMike Bayer2008-12-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | as a column expression and it will be expanded. Somewhat related to [ticket:1253]. - Query() is a little more robust when passed various column expressions such as strings, clauselists, text() constructs (which may mean it just raises an error more nicely). - select() can accept a ClauseList as a column in the same way as a Table or other selectable and the interior expressions will be used as column elements. [ticket:1253] - removed erroneous FooTest from test/orm/query -This line, and those below, will be ignored-- M test/orm/query.py M test/orm/mapper.py M test/sql/select.py M lib/sqlalchemy/orm/query.py M lib/sqlalchemy/sql/expression.py M CHANGES
* - _execute_clauseelement() goes back to beingMike Bayer2008-12-171-1/+1
| | | | | | | | | | | | | | | | a private method. Subclassing Connection is not needed now that ConnectionProxy is available. - tightened the interface for the various _execute_XXX() methods to reduce ambiguity - __distill_params() no longer creates artificial [{}] entry, blank dict is no longer passed through to do_execute() in any case unless explicitly sent from the outside as in connection.execute("somestring"), {}) - fixed a few old sql.query tests which were doing that - removed needless do_execute() from mysql dialect - fixed charset param not properly being sent to _compat_fetchone() in mysql
* - turn __visit_name__ into an explicit member.Mike Bayer2008-12-111-4/+45
| | | | [ticket:1244]
* further fix that docstringGaëtan de Menten2008-12-081-1/+1
|
* fixed invalid docstring exampleGaëtan de Menten2008-12-081-1/+1
|
* fix typosGaëtan de Menten2008-12-071-178/+178
|
* need to use absolutes for these, otherwise its dictionary ordering rouletteMike Bayer2008-12-061-4/+4
|
* - postgres docstringMike Bayer2008-12-061-27/+46
| | | | | | - insert/update/delete are documented generatively - values({}) is no longer deprecated, thus enabling unicode/Columns as keys
* - merged -r5338:5429 of sphinx branch.Mike Bayer2008-12-061-72/+74
| | | | | | | | | | | | | - Documentation has been converted to Sphinx. In particular, the generated API documentation has been constructed into a full blown "API Reference" section which organizes editorial documentation combined with generated docstrings. Cross linking between sections and API docs are vastly improved, a javascript-powered search feature is provided, and a full index of all classes, functions and members is provided.
* - union() and union_all() will not whackMike Bayer2008-12-061-2/+1
| | | | | | | | any order_by() that has been applied to the select()s inside. If you union() a select() with order_by() (presumably to support LIMIT/OFFSET), you should also call self_group() on it to apply parenthesis.