summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - Converted MAGICCOOKIE=object() to a little symbol implementation to ease ↵Jason Kirtland2008-02-221-5/+4
| | | | object inspection and debugging
* - can again create aliases of selects against textualMike Bayer2008-02-191-0/+1
| | | | FROM clauses, [ticket:975]
* - Fixed a couple pyflakes, cleaned up imports & whitespaceJason Kirtland2008-02-143-130/+123
|
* - fixed bug in result proxy where anonymously generatedMike Bayer2008-02-141-1/+1
| | | | | column labels would not be accessible using their straight string name
* - fixed bug introduced in r4070 where union() and other compound selects ↵Mike Bayer2008-02-122-3/+2
| | | | | | | would not get an OID column if it only contained one selectable element, due to missing return in _proxy_column() - visit_column() calls itself to render a primary key col being used as the interpretation of the oid col instead of relying upon broken partial logic
* - added generative where(<criterion>) method to delete()Mike Bayer2008-02-081-2/+33
| | | | | | | and update() constructs which return a new object with criterion joined to existing criterion via AND, just like select().where(). - compile assertions use assertEquals()
* - Added deferrability support to constraintsJason Kirtland2008-02-081-0/+14
|
* Fix: deletes with schemas on MSSQL 2000 [ticket:967]Paul Johnston2008-02-081-5/+11
|
* - Some more reST docstring correctionsJason Kirtland2008-02-061-31/+30
|
* - Added free-form `DDL` statements, can be executed standalone or tied to ↵Jason Kirtland2008-02-051-0/+15
| | | | | | the DDL create/drop lifecycle of Tables and MetaData. [ticket:903] - Added DDL event hooks, triggers callables before and after create / drop.
* lock in replacing '%' with '%%'Mike Bayer2008-02-041-1/+2
|
* - add dummy column to appease older SQLite verisons in unicode.pyMike Bayer2008-02-041-2/+6
| | | | - add test "escape_literal_column" comiler method to start addressing literal '%' character
* - some consolidation of tests in select.py, movedMike Bayer2008-02-011-0/+3
| | | | | | | other tests to more specific modules - added "now()" as a generic function; on SQLite and Oracle compiles as "CURRENT_TIMESTAMP"; "now()" on all others [ticket:943]
* - Workaround for datetime quirk, LHS comparisons to SA expressions now work.Jason Kirtland2008-01-311-0/+3
|
* - Friendlier exception messages for unbound, implicit executionJason Kirtland2008-01-311-1/+7
| | | | - Implicit binding failures now raise UnboundExecutionError
* - added "autocommit=True" kwarg to select() and text(),Mike Bayer2008-01-311-3/+23
| | | | | | | | | as well as generative autocommit() method on select(); for statements which modify the database through some user-defined means other than the usual INSERT/UPDATE/ DELETE etc., this flag will enable "autocommit" behavior during execution if no transaction is in progress [ticket:915]
* - the startswith(), endswith(), and contains() operatorsMike Bayer2008-01-311-33/+33
| | | | | | | | | now concatenate the wildcard operator with the given operand in SQL, i.e. "'%' || <bindparam>" in all cases, accept text('something') operands properly [ticket:962] - cast() accepts text('something') and other non-literal operands properly [ticket:962]
* - query.join() can also accept tuples of attributeMike Bayer2008-01-231-0/+3
| | | | | | | | | | | name/some selectable as arguments. This allows construction of joins *from* subclasses of a polymorphic relation, i.e.: query(Company).\ join( [('employees', people.join(engineer)), Engineer.name] )
* more capability added to reduce_columnsMike Bayer2008-01-231-3/+7
|
* factor create_row_adapter into sql.util.row_adapterMike Bayer2008-01-201-0/+41
|
* - Oracle assembles the correct columns in the result setMike Bayer2008-01-191-3/+10
| | | | | | column mapping when generating a LIMIT/OFFSET subquery, allows columns to map properly to result sets even if long-name truncation kicks in [ticket:941]
* - some expression fixup:Mike Bayer2008-01-192-22/+46
| | | | | | | | | | | | | | | | | | | | | | - the '.c.' attribute on a selectable now gets an entry for every column expression in its columns clause; previously, "unnamed" columns like functions and CASE statements weren't getting put there. Now they will, using their full string representation if no 'name' is available. - The anonymous 'label' generated for otherwise unlabeled functions and expressions now propagates outwards at compile time for expressions like select([select([func.foo()])]) - a CompositeSelect, i.e. any union(), union_all(), intersect(), etc. now asserts that each selectable contains the same number of columns. This conforms to the corresponding SQL requirement. - building on the above ideas, CompositeSelects now build up their ".c." collection based on the names present in the first selectable only; corresponding_column() now works fully for all embedded selectables.
* maintain the ordering of the given collection of columns when reducing so ↵Mike Bayer2008-01-151-1/+1
| | | | | | that primary key collections remain ordered the same as in the mapped table
* finally, a really straightforward reduce() method which reduces colsMike Bayer2008-01-152-54/+35
| | | | | | | to the minimal set for every test case I can come up with, and now replaces all the cruft in Mapper._compile_pks() as well as Join.__init_primary_key(). mappers can now handle aliased selects and figure out the correct PKs pretty well [ticket:933]
* - select_table mapper turns straight join into aliased select + custom PK, ↵Mike Bayer2008-01-152-1/+37
| | | | | | | to allow joins onto select_table mappers - starting a generalized reduce_columns func
* - query.join() can now accept class-mapped attributesMike Bayer2008-01-141-2/+2
| | | | | | | | | as arguments, which can be used in place or in any combination with strings. In particular this allows construction of joins to subclasses on a polymorphic relation, i.e. query(Company).join(['employees', Engineer.name]), etc.
* - applying some refined versions of the ideas in the smarter_polymorphicMike Bayer2008-01-141-0/+19
| | | | | | | | | | | | branch - slowly moving Query towards a central "aliasing" paradigm which merges the aliasing of polymorphic mappers to aliasing against arbitrary select_from(), to the eventual goal of polymorphic mappers which can also eagerload other relations - supports many more join() scenarios involving polymorphic mappers in most configurations - PropertyAliasedClauses doesn't need "path", EagerLoader doesn't need to guess about "towrap"
* fixed NOT ILIKEMike Bayer2008-01-111-1/+1
|
* - added "ilike()" operator to column operations.Mike Bayer2008-01-112-1/+5
| | | | | compiles to ILIKE on postgres, lower(x) LIKE lower(y) on all others [ticket:727]
* - Warnings are now issued as SAWarning instead of RuntimeWarning; ↵Jason Kirtland2008-01-111-4/+4
| | | | | | util.warn() wraps this up. - SADeprecationWarning has moved to exceptions. An alias remains in logging until 0.5.
* redid the _for_ddl String/Text deprecation warning correctly [ticket:912]Mike Bayer2008-01-091-1/+1
|
* - fixed bug in union() so that select() statements which don't deriveMike Bayer2008-01-081-1/+2
| | | | from FromClause objects can be unioned
* - fixed an attribute history bug whereby assigning a new collectionMike Bayer2008-01-071-2/+2
| | | | | | | | | | | to a collection-based attribute which already had pending changes would generate incorrect history [ticket:922] - fixed delete-orphan cascade bug whereby setting the same object twice to a scalar attribute could log it as an orphan [ticket:925] - generative select.order_by(None) / group_by(None) was not managing to reset order by/group by criterion, fixed [ticket:924]
* - changed name of TEXT to Text since its a "generic" type; TEXT name isMike Bayer2008-01-052-17/+2
| | | | | | | deprecated until 0.5. The "upgrading" behavior of String to Text when no length is present is also deprecated until 0.5; will issue a warning when used for CREATE TABLE statements (String with no length for SQL expression purposes is still fine) [ticket:912]
* Experimental: modestly more informative repr() for some expressions (using ↵Jason Kirtland2008-01-051-0/+8
| | | | .description)
* Migrated a few in-function 'from x import y' to the 'global x; if x is None' ↵Jason Kirtland2008-01-051-160/+168
| | | | style.
* add anonymous labels to function callsMike Bayer2008-01-041-1/+1
|
* - further fix to new TypeDecorator, so that subclasses of TypeDecorators ↵Mike Bayer2008-01-021-2/+2
| | | | | | work properly - _handle_dbapi_exception() usage changed so that unwrapped exceptions can be rethrown with the original stack trace
* happy new yearMike Bayer2008-01-012-2/+2
|
* - reworked all lazy/deferred/expired callables to beMike Bayer2007-12-211-2/+3
| | | | | | | | serializable class instances, added pickling tests - cleaned up "deferred" polymorphic system so that the mapper handles it entirely - columns which are missing from a Query's select statement now get automatically deferred during load.
* introductory docstring bonanzaMike Bayer2007-12-181-1/+13
|
* a little pre-lunch decrufting and cleanupMike Bayer2007-12-182-61/+71
|
* get most oracle tests in sql working again....Mike Bayer2007-12-182-1/+5
|
* - cleanup; lambdas removed from properties; properties mirror same-named ↵Mike Bayer2007-12-182-101/+97
| | | | | | functions (more like eventual decorator syntax); remove some old methods, factor out some "raiseerr" ugliness to outer lying functions. - corresponding_column() integrates "require_embedded" flag with other set arithmetic
* - select().as_scalar() will raise an exception if the select does not haveMike Bayer2007-12-181-7/+11
| | | | | | | | | | | | exactly one expression in its columns clause. - added "helper exception" to select.type access, generic functions raise the chance of this happening - a slight behavioral change to attributes is, del'ing an attribute does *not* cause the lazyloader of that attribute to fire off again; the "del" makes the effective value of the attribute "None". To re-trigger the "loader" for an attribute, use session.expire(instance, [attrname]). - fix ormtutorial for IS NULL
* - more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads,Mike Bayer2007-12-163-52/+48
| | | | | | | | in this case when mapped against a select statement [ticket:904] - _hide_froms logic in expression totally localized to Join class, including search through previous clone sources - removed "stop_on" from main visitors, not used - "stop_on" in AbstractClauseProcessor part of constructor, ClauseAdapter sets it up based on given clause - fixes to is_derived_from() to take previous clone sources into account, Alias takes self + cloned sources into account. this is ultimately what the #904 bug was.
* moved hide_froms and aggregate_hide_froms to be only on FromClauseMike Bayer2007-12-161-28/+19
|
* - more query testsMike Bayer2007-12-101-7/+33
| | | | | | | | | - trying to refine some of the adaptation stuff - query.from_statement() wont allow further generative criterion - added a warning to columncollection when selectable is formed with conflicting columns (only in the col export phase) - some method rearrangement on schema/columncollection.... - property conflicting relation warning doesnt raise for concrete
* - Query.select_from() now replaces all existing FROM criterion withMike Bayer2007-12-092-6/+12
| | | | | | | | | | the given argument; the previous behavior of constructing a list of FROM clauses was generally not useful as is required filter() calls to create join criterion, and new tables introduced within filter() already add themselves to the FROM clause. The new behavior allows not just joins from the main table, but select statements as well. Filter criterion, order bys, eager load clauses will be "aliased" against the given statement.
* - flush() refactor merged from uow_nontree branch r3871-r3885Mike Bayer2007-12-082-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - topological.py cleaned up, presents three public facing functions which return list/tuple based structures, without exposing any internals. only the third function returns the "hierarchical" structure. when results include "cycles" or "child" items, 2- or 3- tuples are used to represent results. - unitofwork uses InstanceState almost exclusively now. new and deleted lists are now dicts which ref the actual object to provide a strong ref for the duration that they're in those lists. IdentitySet is only used for the public facing versions of "new" and "deleted". - unitofwork topological sort no longer uses the "hierarchical" version of the sort for the base sort, only for the "per-object" secondary sort where it still helps to group non-dependent operations together and provides expected insert order. the default sort deals with UOWTasks in a straight list and is greatly simplified. Tests all pass but need to see if svilen's stuff still works, one block of code in _sort_cyclical_dependencies() seems to not be needed anywhere but i definitely put it there for a reason at some point; if not hopefully we can derive more test coverage from that. - the UOWEventHandler is only applied to object-storing attributes, not scalar (i.e. column-based) ones. cuts out a ton of overhead when setting non-object based attributes. - InstanceState also used throughout the flush process, i.e. dependency.py, mapper.save_obj()/delete_obj(), sync.execute() all expect InstanceState objects in most cases now. - mapper/property cascade_iterator() takes InstanceState as its argument, but still returns lists of object instances so that they are not dereferenced. - a few tricks needed when dealing with InstanceState, i.e. when loading a list of items that are possibly fresh from the DB, you *have* to get the actual objects into a strong-referencing datastructure else they fall out of scope immediately. dependency.py caches lists of dependent objects which it loads now (i.e. history collections). - AttributeHistory is gone, replaced by a function that returns a 3-tuple of added, unchanged, deleted. these collections still reference the object instances directly for the strong-referencing reasons mentiontioned, but it uses less IdentitySet logic to generate.