summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
Commit message (Collapse)AuthorAgeFilesLines
* - correlated subqueries work inside of ORDER BY, GROUP BYMike Bayer2007-02-241-4/+13
|
* - exists() becomes useable as a standalone selectable, not just in aMike Bayer2007-02-231-4/+11
| | | | WHERE clause
* - implemented foreign_keys argument on relation() [ticket:385]Mike Bayer2007-02-101-1/+1
| | | | | | | - PropertyLoader figures out accurate remote_side collection based on foreign_keys, legacy foreignkey, primary/secondaryjoin/polymorphic - reworked lazyloader, sync to work straight off foreign_keys/ remote_side collections
* - added literal_column() to specify a column clause that should not undergo ↵Mike Bayer2007-02-041-5/+10
| | | | | | | any quoting - straight text sent to select() added as literal_column - fix for issue in [ticket:450]
* OK nevermind that last commit, rolling the quoting fix backMike Bayer2007-02-041-1/+1
|
* - more quoting fixes for [ticket:450]...quoting more aggressive (but still ↵Mike Bayer2007-02-041-5/+6
| | | | | | | | skips already-quoted literals) - got mysql to have "format" as default paramstyle even if mysql module not available, allows unit tests to pass in non-mysql system for [ticket:457]. all the dialects should be changed to pass in their usual paramstyle.
* - added a "supports_execution()" method to ClauseElement, so that individualMike Bayer2007-02-021-3/+15
| | | | | kinds of clauses can express if they are appropriate for executing...such as, you can execute a "select", but not a "Table" or a "Join".
* removed various print statementsMike Bayer2007-01-281-1/+0
|
* merged the polymorphic relationship refactoring branch in. i want to go ↵Mike Bayer2007-01-281-1/+7
| | | | | | | | | | | | | further on that branch and introduce the foreign_keys argument, and further centralize the "intelligence" about the joins and selectables into PropertyLoader so that lazyloader/sync can be simplified, but the current branch goes pretty far. - relations keep track of "polymorphic_primaryjoin", "polymorphic_secondaryjoin" which it derives from the plain primaryjoin/secondaryjoin. - lazy/eagerloaders work from those polymorphic join objects. - the join exported by PropertyLoader to Query/SelectResults is the polymorphic join, so that join_to/etc work properly. - Query builds itself against the base Mapper again, not the "polymorphic" mapper. uses the "polymorphic" version only as appropriate. this helps join_by/join_to/etc to work with polymorphic mappers. - Query will also adapt incoming WHERE criterion to the polymorphic mapper, i.e. the "people" table becomes the "person_join" automatically. - quoting has been modified since labels made out of non-case-sensitive columns could themselves require quoting..so case_sensitive defaults to True if not otherwise specified (used to be based on the identifier itself). - the test harness gets an ORMTest base class and a bunch of the ORM unit tests are using it now, decreases a lot of redundancy.
* - calling corresponding_column with keys_ok matches columns on name, not ↵Mike Bayer2007-01-241-2/+2
| | | | | | | | | | | | | | | | key, since the name is meaningful with regards to SQL relationships, the key is not - adjustments to the recent polymorphic relationship refactorings, specifically for many-to-one relationships to polymorphic unions that did not contain the base table [ticket:439]. the lazy/eager clause adaption to the selectable will match up on straight column names (i.e. its a more liberal policy) - lazy loader will not attempt to adapt the clause to the selectable if loads_polymorphic is not enabled, since the more liberal policy of adapting columns fails for more elaborate join conditions - will have to see if ppl want to do complex joins with polymorphic relations... may have to add "polymorphic_primaryjoin" in that case as a last resort (would make working around these issues a snap, tho...)
* - tightened down conditions used to locate "relation direction", associatingMike Bayer2007-01-201-1/+9
| | | | | | | | the "foreignkey" of the relationship with the "primaryjoin". the column match now must be exact, not just "corresponding". this enables self-referential relationships on a polymorphic mapper. - a little bit of improvement to the concept of a "concrete" inheritance mapping, though that concept is not well fleshed out yet (added test case to support concrete mappers on top of a polymorphic base).
* - trailing underscores are trimmed from func.<xxx> calls, such as func.if_()Mike Bayer2007-01-191-0/+2
|
* - changed "BooleanExpression" to subclass from "BinaryExpression", so that ↵Mike Bayer2007-01-191-9/+8
| | | | | | | | | | | boolean expressions can also follow column-clause behaviors (i.e. label(), etc). - query.select() had to become more picky about what it considers to be a full "selectable" and what it considers to be a fragment that represents a WHERE criterion - looks for the presence of a FromClause now (which is still pretty liberal, since i originally intended the check to be for select() only). the previous exception-catch method also added a little stack tracing overhead anyway.
* - another fix to subquery correlation so that a subquery which has only one FROMMike Bayer2007-01-191-1/+7
| | | | | element will *not* correlate that single element, since at least one FROM element is required in a query.
* - added optional constructor to sql.ColumnCollectionMike Bayer2007-01-151-0/+3
| | | | | | | - mapper sets its "primary_key" attribute to be the ultimately decided primary_key column collection post-compilation - added compare() method to MapperProperty, defines a comparison operation of the columns represented by the property to some value - all the above combines into today's controversial feature: saying query.select_by(somerelationname=someinstance) will create the join of the primary key columns represented by "somerelationname"'s mapper to the actual primary key in "someinstance". - docs for the above
* - the "op()" function is now treated as an "operation", rather than a ↵Mike Bayer2007-01-081-1/+1
| | | | | | | "comparison". the difference is, an operation produces a BinaryExpression from which further operations can occur whereas comparison produces the more restrictive BooleanExpression
* copyright updateMike Bayer2007-01-051-1/+1
|
* - fix to correlation of subqueries when the column list of the select statementMike Bayer2006-12-281-3/+6
| | | | | | is constructed with individual calls to append_column(); this fixes an ORM bug whereby nested select statements were not getting correlated with the main select generated by the Query object.
* reversing last commitRick Morrison2006-12-181-1/+1
|
* added missing ref to between in sql.py __all__Rick Morrison2006-12-171-1/+1
|
* - string-based FROM clauses fixed, i.e. select(..., from_obj=["sometext"])Mike Bayer2006-12-121-1/+1
|
* - sending a selectable to an IN no longer creates a "union" out of multipleMike Bayer2006-11-291-4/+7
| | | | | selects; only one selectable to an IN is allowed now (make a union yourself if union is needed; explicit better than implicit, dont guess, etc.)
* added label() function to Select class, useable only with selectMike Bayer2006-11-271-1/+14
| | | | that has scalar=True
* - made kwargs parsing to Table strict; removed various obsoluete ↵Mike Bayer2006-11-261-50/+30
| | | | | | | | | | | "redefine=True" kw's from the unit tests - documented instance variables in ANSICompiler - fixed [ticket:120], adds "inline_params" set to ANSICompiler which DefaultDialect picks up on when determining defaults. added unittests to query.py - additionally fixed up the behavior of the "values" parameter on _Insert/_Update - more cleanup to sql/Select - more succinct organization of FROM clauses, removed silly _process_from_dict methods and JoinMarker object
* some clenaup on the "correlation" API on the _Select classMike Bayer2006-11-251-13/+17
|
* - cleanup on some instance vars in Select (is_scalar, is_subquery, _froms is ↵Mike Bayer2006-11-251-36/+52
| | | | | | | __froms, removed unused 'nowait', '_text', etc) - cleaned up __repr__ on Column, AbstractTypeEngine - added standalone intersect(_all), except(_all) functions, unit tests illustrating nesting patterns [ticket:247]
* figured out how a Select can be in its own _froms list, changed assertion to ↵Mike Bayer2006-10-311-2/+4
| | | | just a continue
* converted imports to absoluteMike Bayer2006-10-261-1/+0
|
* updates to oracleMike Bayer2006-10-221-2/+2
| | | | added more ordering to schema collections for better predictability
* renamed Column/ColumnClause "hidden" to "_is_oid"Mike Bayer2006-10-221-5/+5
|
* some docstring stuffMike Bayer2006-10-201-1/+1
|
* ok, TableClause should be publicMike Bayer2006-10-171-9/+9
|
* reorganizing classnames a bit, flagging "private" classes in the sql package,Mike Bayer2006-10-171-130/+142
| | | | | getting the generated docs to look a little nicer. fixes to extensions, sqlsoup etc. to be compatible with recent API tweaks
* - a fair amount of cleanup to the schema package, removal of ambiguousMike Bayer2006-10-141-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | methods, methods that are no longer needed. slightly more constrained useage, greater emphasis on explicitness. - table_iterator signature fixup, includes fix for [ticket:288] - the "primary_key" attribute of Table and other selectables becomes a setlike ColumnCollection object; is no longer ordered or numerically indexed. a comparison clause between two pks that are derived from the same underlying tables (i.e. such as two Alias objects) can be generated via table1.primary_key==table2.primary_key - append_item() methods removed from Table and Column; preferably construct Table/Column/related objects inline, but if needed use append_column(), append_foreign_key(), append_constraint(), etc. - table.create() no longer returns the Table object, instead has no return value. the usual case is that tables are created via metadata, which is preferable since it will handle table dependencies. - added UniqueConstraint (goes at Table level), CheckConstraint (goes at Table or Column level) fixes [ticket:217] - index=False/unique=True on Column now creates a UniqueConstraint, index=True/unique=False creates a plain Index, index=True/unique=True on Column creates a unique Index. 'index' and 'unique' keyword arguments to column are now boolean only; for explcit names and groupings of indexes or unique constraints, use the UniqueConstraint/Index constructs explicitly. - relationship of Metadata/Table/SchemaGenerator/Dropper has been improved so that the schemavisitor receives the metadata object for greater control over groupings of creates/drops. - added "use_alter" argument to ForeignKey, ForeignKeyConstraint, but it doesnt do anything yet. will utilize new generator/dropper behavior to implement.
* - the "foreign_key" attribute on Column and ColumnElement in generalMike Bayer2006-10-081-5/+11
| | | | | | | | | is deprecated, in favor of the "foreign_keys" list/set-based attribute, which takes into account multiple foreign keys on one column. "foreign_key" will return the first element in the "foreign_keys" list/set or None if the list is empty. - added a user test to the relationships test, testing various new things this change allows
* - Function objects know what to do in a FROM clause now. theirMike Bayer2006-10-031-2/+13
| | | | | | | | behavior should be the same, except now you can also do things like select(['*'], from_obj=[func.my_function()]) to get multiple columns from the result, or even use sql.column() constructs to name the return columns [ticket:172]. generally only postgres understands the syntax (and possibly oracle).
* - added test suite to test improved from_obj/join behavior with ↵Mike Bayer2006-09-281-5/+2
| | | | | | | | Query/eagerloading/SelectResults - EagerLoader looks more carefully for the correct Table/Join/FromClause to bind its outer join onto - sqlite boolean datatype converts bind params from python booleans to integer - took out assertion raise from 'name' property of CompoundSelect
* decruftifyMike Bayer2006-09-281-17/+28
|
* - pool will auto-close open cursors, or can be configured to raise an error ↵Mike Bayer2006-09-281-70/+49
| | | | | | | | instead - consolidated scalar() calls into ResultProxy scalar(), fixed ResultProxy scalar() to apply typing rules - general de-cruftification of ClauseElement/Compiled (yes i know theres crufty things everywhere)
* - BooleanExpression includes new "negate" argument to specifyMike Bayer2006-09-211-12/+22
| | | | | | the appropriate negation operator if one is available. - calling a negation on an "IN" or "IS" clause will result in "NOT IN", "IS NOT" (as opposed to NOT (x IN y)).
* added extract() function to sql dialectMike Bayer2006-09-141-2/+6
|
* - unicode fix for startswith()/endswith() [ticket:296]Mike Bayer2006-09-051-2/+2
|
* simplification to quoting to just cache strings per-dialect, added quoting ↵Mike Bayer2006-09-041-1/+3
| | | | | | for alias and label names fixes [ticket:294]
* added limit/offset to union queriesMike Bayer2006-08-261-0/+2
|
* [ticket:280] statement execution supports using the same BindParamMike Bayer2006-08-181-5/+12
| | | | | object more than once in an expression; simplified handling of positional parameters. nice job by Bill Noon figuring out the basic idea.
* quoting facilities set up so that database-specific quoting can beMike Bayer2006-08-121-1/+3
| | | | | | | turned on for individual table, schema, and column identifiers when used in all queries/creates/drops. Enabled via "quote=True" in Table or Column, as well as "quote_schema=True" in Table. Thanks to Aaron Spike for his excellent efforts. [ticket:155]
* removed superfluous **paramsMike Bayer2006-08-111-2/+2
|
* added "nowait" flag to Select() [ticket:270]Mike Bayer2006-08-111-1/+3
|
* oops: committed the rest of [changeset:1759], removed print in sqlite + ↵Mike Bayer2006-08-031-2/+2
| | | | restored error check in Join
* - better check for ambiguous join conditions in sql.Join; propigates to aMike Bayer2006-08-031-0/+5
| | | | | | | better error message in PropertyLoader (i.e. relation()/backref()) for when the join condition can't be reasonably determined. - sqlite creates ForeignKeyConstraint objects properly upon table reflection.