Commit Graph

65 Commits

Author SHA1 Message Date
Ants Aasma 6bbc7dd157 change the in_ API to accept a sequence or a selectable [ticket:750] 2007-10-16 22:57:05 +00:00
Mike Bayer f67fcd1822 - move PG RETURNING tests to postgres dialect test
- added server_version_info() support for PG dialect
- exclude PG versions < 8.4 for RETURNING tests
2007-10-04 03:19:38 +00:00
Ants Aasma e82ca71cc5 add support for returning results from inserts and updates for postgresql 8.2+. [ticket:797] 2007-10-02 23:57:54 +00:00
Mike Bayer 8c14291b6d - adjusted operator precedence of NOT to match '==' and others, so that
~(x <operator> y) produces NOT (x <op> y), which is better compatible with MySQL.
   [ticket:764].  this doesn't apply to "~(x==y)" as it does in 0.3 since ~(x==y)
   compiles to "x != y", but still applies to operators like BETWEEN.
2007-09-08 20:28:26 +00:00
Mike Bayer 5ba8a25afe added assertion case for [ticket:764] 2007-09-08 20:13:54 +00:00
Mike Bayer 986e82700e - column defaults and onupdates, executing inline, will add parenthesis
for subqueries and other parenthesis-requiring expressions
2007-09-06 16:37:37 +00:00
Mike Bayer 3126d464e7 - removed "parameters" argument from clauseelement.compile(), replaced with
"column_keys".  the parameters sent to execute() only interact with the
  insert/update statement compilation process in terms of the column names
  present but not the values for those columns.
  produces more consistent execute/executemany behavior, simplifies things a
  bit internally.
2007-09-04 00:08:57 +00:00
Mike Bayer 69f7084c9b - merged inline inserts branch
- all executemany() style calls put all sequences and SQL defaults inline into a single SQL statement
and don't do any pre-execution
- regular Insert and Update objects can have inline=True, forcing all executions to be inlined.
- no last_inserted_ids(), lastrow_has_defaults() available with inline execution
- calculation of pre/post execute pushed into compiler; DefaultExecutionContext greatly simplified
- fixed postgres reflection of primary key columns with no sequence/default generator, sets autoincrement=False
- fixed postgres executemany() behavior regarding sequences present, not present, passivedefaults, etc.
- all tests pass for sqlite, mysql, postgres; oracle tests pass as well as they did previously including all
insert/update/default functionality
2007-09-01 19:49:26 +00:00
Jason Kirtland fba14f6047 from foo import (name, name) isn't valid syntax for 2.3. ah well.
omitting modules from sqlalchemy.__all__...
2007-08-21 22:20:52 +00:00
Jason Kirtland 6228e72cb1 - omitted 'table' and 'column' from 'from sqlalchemy import *'
- also omitted all modules and classes that aren't expicitly public
- omitted 'Smallinteger' (small i), but it's still in schema
- omitted NullType-related items from types.__all__
- patched up a few tests to use sql.table and sql.column, other related.
2007-08-21 01:31:23 +00:00
Mike Bayer 820346549b - modified SQL operator functions to be module-level operators, allowing
SQL expressions to be pickleable [ticket:735]

- small adjustment to mapper class.__init__ to allow for Py2.6 object.__init__()
  behavior
2007-08-18 01:00:44 +00:00
Mike Bayer 087f235c33 - merged "fasttypes" branch. this branch changes the signature
of convert_bind_param() and convert_result_value() to callable-returning
bind_processor() and result_processor() methods.  if no callable is
returned, no pre/post processing function is called.
- hooks added throughout base/sql/defaults to optimize the calling
of bind param/result processors so that method call overhead is minimized.
special cases added for executemany() scenarios such that unneeded "last row id"
logic doesn't kick in, parameters aren't excessively traversed.
- new performance tests show a combined mass-insert/mass-select test as having 68%
fewer function calls than the same test run against 0.3.
- general performance improvement of result set iteration is around 10-20%.
2007-08-14 21:53:32 +00:00
Mike Bayer 6614209895 - generalized a SQLCompileTest out of select.py, installed
into dialect/mssql.py, dialect/oracle.py, sql/generative.py
- fixed oracle issues [ticket:732], [ticket:733], [ticket:734]
2007-08-13 20:00:38 +00:00
Mike Bayer 578efcfeb3 - decoupled all ColumnElements from also being Selectables. this means
that anything which is a column expression does not have a "c" or a
"columns" attribute.  Also works for select().as_scalar(); _ScalarSelect
is a columnelement, so you can't say select().as_scalar().c.foo, which is
a pretty confusing mistake to make.  in the case of _ScalarSelect made
an explicit raise if you try to access 'c'.
2007-08-09 21:50:23 +00:00
Mike Bayer c7ee47e545 - migrated 'desc', 'asc', and 'distinct' to be in the Operators framework
- fixes to operator() method signature/calling
2007-08-07 17:12:35 +00:00
Mike Bayer 8446b80533 - added desc() and asc() directly to CompareMixin 2007-08-06 21:52:24 +00:00
Mike Bayer 2dde45881b - docs
- added some convenience functions to selects, clauseelements
- fixed distinct()
2007-08-06 21:32:37 +00:00
Mike Bayer 68fd1be8d2 - edits
- added "params" to ansisql compiler
2007-08-06 01:51:54 +00:00
Mike Bayer b73b14f070 - draft sqlexpression tutorial
- added some generative methods to exists()
- got clause adapter to work with join()
2007-08-06 00:59:09 +00:00
Mike Bayer 14a0c29362 added values() generative method to Insert/Update 2007-08-02 03:13:02 +00:00
Mike Bayer 45650694ee fixed pydoc bug in [ticket:564] 2007-07-29 02:13:29 +00:00
Mike Bayer ed4fc64bb0 merging 0.4 branch to trunk. see CHANGES for details. 0.3 moves to maintenance branch in branches/rel_0_3. 2007-07-27 04:08:53 +00:00
Ants Aasma 51c0d90c8d add missing grouping for compound selects. fixes ticket #623 2007-06-26 18:00:57 +00:00
Ants Aasma 987581e6d2 fix precedence of between (ticket #621) 2007-06-25 18:14:40 +00:00
Mike Bayer bc58df9c1f - fixed precedence of operators so that parenthesis are correctly applied
[ticket:620]
- calling <column>.in_() (i.e. with no arguments) will return
"CASE WHEN (<column> IS NULL) THEN NULL ELSE 0 END = 1)", so that
NULL or False is returned in all cases, rather than throwing an error
[ticket:545]
2007-06-25 17:07:25 +00:00
Mike Bayer f9dc30f239 added test for correlation of scalar subqueries to a JOIN object 2007-06-24 18:46:02 +00:00
Mike Bayer 7cfd3973ce - fixed "where"/"from" criterion of select() to accept a unicode string
in addition to regular string - both convert to text()
2007-06-23 18:47:28 +00:00
Mike Bayer 3c1a7710f0 - added standalone distinct() function in addition to column.distinct()
[ticket:558]
2007-06-21 17:42:42 +00:00
Mike Bayer 2b2e27d886 CompoundSelect (i.e. UNION etc.) needed self_group() to provide parenthesis 2007-05-23 15:20:25 +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