Commit Graph

44 Commits

Author SHA1 Message Date
Ants Aasma 8b89aa795c merge compound select grouping patch from trunk (ticket #623) 2007-06-26 18:31:57 +00:00
Ants Aasma 73b76e57ac merged between precedence from trunk ([2785]) 2007-06-25 19:20:53 +00:00
Mike Bayer 9225b3dee9 merged operator precedence fixes/tests IN fixes/tests from trunk r2782-r2783 2007-06-25 17:22:14 +00:00
Mike Bayer 11b0fdc1b6 merged trunk r2755-r2778 2007-06-24 20:09:54 +00:00
Mike Bayer 13ac46eb3f - merge of generative_sql branch
- copy_container() removed.  ClauseVisitor.traverse() now features "clone"
flag which allows traversal with copy-and-modify-in-place behavior
- select() objects copyable now [ticket:52] [ticket:569]
- improved support for custom column_property() attributes which
  feature correlated subqueries...work better with eager loading now.
- accept_visitor()  methods removed.  ClauseVisitor now genererates method
names based on class names, or an optional __visit_name__ attribute.  calls
regular visit_XXX methods as they exist, can optionally call an additional
"pre-descent" enter_XXX method to allow stack-based operations on traversals
- select() and union()'s now have "generative" behavior.  methods like
order_by() and group_by() return a *new* instance - the original instance
is left unchanged.  non-generative methods remain as well.
- the internals of select/union vastly simplified - all decision making
regarding "is subquery" and "correlation" pushed to SQL generation phase.
select() elements are now *never* mutated by their enclosing containers
or by any dialect's compilation process
2007-06-24 19:58:41 +00:00
Jason Kirtland 5b779d30c3 - Added testbase.Table and testbase.Column, interceptors that can set up
test-run- and dialect-specific options on those objects
  All tests re-pointed to go through the interceptors
- Removed mysql_engine= from table declarations, replaced with a general
  flag indicating storage requirements
- Added ability to choose a global MySQL storage engine for all tests
  --mysql-engine=<whatever>
  If none is specified, tests use the old db-default/InnoDB behavior
- Added ability to append arbitrary table creation params
  --table-option=KEY=VALUE
  For MySQL 3, use this to set mysql_type instead of --mysql-engine
- Removed a couple dead test modules
2007-06-15 22:35:53 +00:00
Mike Bayer 5430c7177a - fixed bug where selectable.corresponding_column(selectable.c.col)
would not return selectable.c.col, if the selectable is a join
of a table and another join involving the same table.  messed
up ORM decision making [ticket:593]
- removed is_natural_case function from ANSIIdentifierPreparer
2007-06-06 23:39:25 +00:00
Mike Bayer 5c31a8c5e9 - merged trunk r2653
- small orm fixes
2007-05-26 20:10:06 +00:00
Mike Bayer 9102d678ab - removed "no group by's in a select thats part of a UNION"
restriction [ticket:578]
2007-05-18 19:01:47 +00:00
Mike Bayer 1848439d44 restored outerjoin test 2007-05-15 16:51:40 +00:00
Mike Bayer ae4b954b1a - parenthesis are applied to clauses via a new _Grouping construct.
uses operator precedence to more intelligently apply parenthesis
to clauses, provides cleaner nesting of clauses (doesnt mutate
clauses placed in other clauses, i.e. no 'parens' flag)
- added 'modifier' keyword, works like func.<foo> except does not
add parenthesis.  e.g. select([modifier.DISTINCT(...)]) etc.
2007-05-14 22:25:36 +00:00
Mike Bayer 3de128138a - _Label propigates "_hide_froms()" so that scalar selects
behave more properly with regards to FROM clause #574
2007-05-11 00:21:29 +00:00
Mike Bayer 752ef2802c - _Label class overrides compare_self to return its ultimate object.
meaning, if you say someexpr.label('foo') == 5, it produces
the correct "someexpr == 5".
2007-05-03 22:31:52 +00:00
Jason Kirtland 93d212a138 - merged in the combined patch for #474, #475, #476 (attached to #476) and a new set of tests 2007-04-19 19:35:03 +00:00
Mike Bayer 4fffc21c87 - the "where" criterion of an update() and delete() now correlates
embedded select() statements against the table being updated or
deleted.  this works the same as nested select() statement
correlation, and can be disabled via the correlate=False flag on
the embedded select().
2007-04-18 22:54:40 +00:00
Mike Bayer b9ce8e38c9 - small fix to allow successive compiles of the same SELECT object
which features LIMIT/OFFSET.  oracle dialect needs to modify
the object to have ROW_NUMBER OVER and wasn't performing
the full series of steps on successive compiles.
2007-04-13 22:22:07 +00:00
Mike Bayer aee39b2847 - the "mini" column labels generated when using subqueries, which
are to work around glitchy SQLite behavior that doesnt understand
"foo.id" as equivalent to "id", are now only generated in the case
that those named columns are selected from (part of [ticket:513])
- MS-SQL better detects when a query is a subquery and knows not to
generate ORDER BY phrases for those [ticket:513]
2007-04-11 20:55:27 +00:00
Mike Bayer c13846c6b6 - sending None as an argument to func.<something> will produce
an argument of NULL
2007-03-28 23:18:04 +00:00
Mike Bayer e0b638a704 - column label and bind param "truncation" also generate
deterministic names now, based on their ordering within the
full statement being compiled.  this means the same statement
will produce the same string across application restarts and
allowing DB query plan caching to work better.
- cleanup to sql.ClauseParameters since it was just falling
apart, API made more explicit
- many unit test tweaks to adjust for bind params not being
"pre" truncated, changes to ClauseParameters
2007-03-28 07:19:14 +00:00
Mike Bayer 32440f2b3b - preliminary support for unicode table and column names added. 2007-03-27 16:04:34 +00:00
Mike Bayer cef652a2d6 - slightly better support for bind params as column clauses, either
via bindparam() or via literal(), i.e. select([literal('foo')])
- removed "table" argument from column().  this does not add the column
to the table anyway so was misleading.
- Select _exportable_columns() only exports Selectable instances
- Select uses _exportable_columns() when searching for engines
instead of _raw_columns for similar reasons (non selectables have no engine)
- _BindParamClause no longer has a _make_proxy().  its not a ColumnElement.
- _Label detects underlying column element and will generate its own
column()._make_proxy() if the element is not a ColumnElement.  this
allows a Label to be declared for nearly anything and it can export
itself as a column on a containing Selectable.
2007-03-21 20:43:34 +00:00
Mike Bayer e736817a92 - bindparam() names are now repeatable! specify two
distinct bindparam()s with the same name in a single statement,
and the key will be shared.  proper positional/named args translate
at compile time.  for the old behavior of "aliasing" bind parameters
with conflicting names, specify "unique=True" - this option is
still used internally for all the auto-genererated (value-based)
     bind parameters.
2007-03-03 21:02:26 +00:00
Mike Bayer 7e2ae824a5 - use_labels flag on select() wont auto-create labels for literal text
column elements, since we can make no assumptions about the text. to
create labels for literal columns, you can say "somecol AS somelabel",
or use literal_column("somecol").label("somelabel")
- quoting wont occur for literal columns when they are "proxied" into the
column collection for their selectable (is_literal flag is propigated)
2007-03-01 20:14:17 +00:00
Mike Bayer abc9971544 fix typo 2007-02-25 01:24:33 +00:00
Mike Bayer 41802e102c - correlated subqueries work inside of ORDER BY, GROUP BY 2007-02-24 00:17:08 +00:00
Mike Bayer 736bc3bd51 - exists() becomes useable as a standalone selectable, not just in a
WHERE clause
2007-02-23 20:46:27 +00:00
Mike Bayer 37a61a1b49 - another fix to subquery correlation so that a subquery which has only one FROM
element will *not* correlate that single element, since at least one FROM element is
required in a query.
2007-01-19 02:19:38 +00:00
Mike Bayer a4c73cc8ae - the "op()" function is now treated as an "operation", rather than a "comparison".
the difference is, an operation produces a BinaryExpression from which further operations
  can occur whereas comparison produces the more restrictive BooleanExpression
2007-01-08 19:09:02 +00:00
Mike Bayer 5369b3df8c - fix to correlation of subqueries when the column list of the select statement
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.
2006-12-28 00:27:58 +00:00
Mike Bayer 13d989b2d0 - sending a selectable to an IN no longer creates a "union" out of multiple
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.)
2006-11-29 22:13:58 +00:00
Mike Bayer 9bb80a8f11 figured out how a Select can be in its own _froms list, changed assertion to just a continue 2006-10-31 00:51:16 +00:00
Mike Bayer 758828ed54 assorted firebird fixes from Lele Gaifax 2006-10-07 00:54:14 +00:00
Mike Bayer 887fdc87ef - BooleanExpression includes new "negate" argument to specify
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)).
2006-09-21 17:15:33 +00:00
Mike Bayer 3dd5d834ad added extract() function to sql dialect 2006-09-14 16:41:18 +00:00
Mike Bayer 47d8b03b14 - changed "for_update" parameter to accept False/True/"nowait"
and "read", the latter two of which are interpreted only by
Oracle and Mysql [ticket:292]
- added "lockmode" argument to base Query select/get functions,
including "with_lockmode" function to get a Query copy that has
a default locking mode.  Will translate "read"/"update"
arguments into a for_update argument on the select side.
[ticket:292]
2006-09-10 23:52:04 +00:00
Mike Bayer f3d72a7187 - unicode fix for startswith()/endswith() [ticket:296] 2006-09-05 15:39:59 +00:00
Mike Bayer 0c7250a474 - added case_sensitive argument to MetaData, Table, Column, determines
itself automatically based on if a parent schemaitem has a non-None
setting for the flag, or if not, then whether the identifier name is all lower
case or not.  when set to True, quoting is applied to identifiers with mixed or
uppercase identifiers.  quoting is also applied automatically in all cases to
identifiers that are known to be reserved words or contain other non-standard
characters. various database dialects can override all of this behavior, but
currently they are all using the default behavior.  tested with postgres, mysql,
sqlite.  needs more testing with firebird, oracle, ms-sql. part of the ongoing
work with [ticket:155]
2006-08-31 18:58:22 +00:00
Mike Bayer 23e3420fc9 added limit/offset to union queries 2006-08-26 14:42:18 +00:00
Mike Bayer b3927fbb88 inserting './lib/' into sys.path since PYTHONPATH no longer straightforward with latest setuptools 2006-06-29 00:28:55 +00:00
Mike Bayer 1ffed8432e cast converted into its own ClauseElement so that it can have an explicit compilation
function in ANSICompiler
MySQLCompiler then skips most CAST calls since it only seems to support the standard syntax for Date
types; other types now a TODO for MySQL
then, polymorphic_union() function now CASTs null()s to the type corresponding to the columns in the UNION,
since postgres doesnt like mixing NULL with integer types
(long road for that .....)
2006-06-17 00:53:33 +00:00
Mike Bayer 0642dcb796 unit tests for dangling subquery, many-to-many clear-and-resave 2006-06-14 15:39:46 +00:00
Mike Bayer 6d22c93181 separated standalone between(), column.between(), put literal checking for both, favor column.between() 2006-06-08 17:38:37 +00:00
Mike Bayer c133b136e1 fixed typing for between() operator, [ticket:202] 2006-06-08 17:29:18 +00:00
Mike Bayer 120dcee5a7 reorganized unit tests into subdirectories 2006-06-05 17:25:51 +00:00